mirror of
https://github.com/Dokploy/templates
synced 2025-06-26 18:16:07 +00:00
Merge pull request #59 from Dokploy/feat/ci-cd-validate
chore: enhance README with new helper variables and add meta.json val…
This commit is contained in:
commit
f455de7c92
76
.github/workflows/validate.yml
vendored
76
.github/workflows/validate.yml
vendored
@ -49,6 +49,82 @@ jobs:
|
||||
echo "✅ Blueprint folders validated successfully."
|
||||
fi
|
||||
|
||||
- name: Validate meta.json structure and required fields
|
||||
run: |
|
||||
echo "🔍 Validating meta.json structure and required fields..."
|
||||
|
||||
# First check if meta.json exists and is valid JSON
|
||||
if [ ! -f "meta.json" ]; then
|
||||
echo "❌ meta.json file not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! jq empty meta.json 2>/dev/null; then
|
||||
echo "❌ meta.json is not a valid JSON file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ERROR=0
|
||||
ERRORS_FOUND=""
|
||||
|
||||
# Debug: Show total number of entries
|
||||
TOTAL_ENTRIES=$(jq '. | length' meta.json)
|
||||
echo "📊 Total entries in meta.json: $TOTAL_ENTRIES"
|
||||
|
||||
# Get all entries at once and process them
|
||||
TOTAL_INDEX=$(($TOTAL_ENTRIES - 1))
|
||||
|
||||
for i in $(seq 0 $TOTAL_INDEX); do
|
||||
entry=$(jq -c ".[$i]" meta.json)
|
||||
INDEX=$((i + 1))
|
||||
|
||||
echo "-------------------------------------------"
|
||||
echo "🔍 Checking entry #$INDEX..."
|
||||
|
||||
# Get the ID for better error reporting
|
||||
ID=$(echo "$entry" | jq -r '.id // "UNKNOWN"')
|
||||
echo "📝 Processing entry with ID: $ID"
|
||||
|
||||
# Validate required top-level fields
|
||||
for field in "id" "name" "version" "description" "logo" "links" "tags"; do
|
||||
if [ "$(echo "$entry" | jq "has(\"$field\")")" != "true" ]; then
|
||||
ERROR_MSG="❌ Entry #$INDEX (ID: $ID) is missing required field: $field"
|
||||
echo "$ERROR_MSG"
|
||||
ERRORS_FOUND="${ERRORS_FOUND}${ERROR_MSG}\n"
|
||||
ERROR=1
|
||||
fi
|
||||
done
|
||||
|
||||
# Validate links object required fields
|
||||
if [ "$(echo "$entry" | jq 'has("links")')" == "true" ]; then
|
||||
for link_field in "github" "website" "docs"; do
|
||||
if [ "$(echo "$entry" | jq ".links | has(\"$link_field\")")" != "true" ]; then
|
||||
ERROR_MSG="❌ Entry #$INDEX (ID: $ID): links object is missing required field: $link_field"
|
||||
echo "$ERROR_MSG"
|
||||
ERRORS_FOUND="${ERRORS_FOUND}${ERROR_MSG}\n"
|
||||
ERROR=1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Validate tags array is not empty
|
||||
if [ "$(echo "$entry" | jq '.tags | length')" -eq 0 ]; then
|
||||
ERROR_MSG="❌ Entry #$INDEX (ID: $ID): tags array cannot be empty"
|
||||
echo "$ERROR_MSG"
|
||||
ERRORS_FOUND="${ERRORS_FOUND}${ERROR_MSG}\n"
|
||||
ERROR=1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "-------------------------------------------"
|
||||
if [ $ERROR -eq 1 ]; then
|
||||
echo "❌ meta.json structure validation failed."
|
||||
echo -e "Summary of all errors found:${ERRORS_FOUND}"
|
||||
exit 1
|
||||
else
|
||||
echo "✅ meta.json structure validated successfully."
|
||||
fi
|
||||
|
||||
- name: Validate meta.json matches blueprint folders and logo files
|
||||
run: |
|
||||
echo "🔍 Validating meta.json against blueprint folders and logos..."
|
||||
|
@ -131,7 +131,7 @@ My content
|
||||
"""
|
||||
```
|
||||
|
||||
Important: you can reference any variable in the `domains`, `env` and `mounts` sections. just use the `${variable_name}` syntax, in the case you don't want to define a variable, you can use the `domain`, `base64`, `password`, `hash`, `uuid`, `randomPort` or `timestamp` helpers.
|
||||
Important: you can reference any variable in the `domains`, `env` and `mounts` sections. just use the `${variable_name}` syntax, in the case you don't want to define a variable, you can use the `domain`, `base64`, `password`, `hash`, `uuid`, `randomPort`, `timestamp`, `jwt`, `email`, or `username` helpers.
|
||||
|
||||
### Helpers
|
||||
|
||||
@ -145,6 +145,8 @@ We have a few helpers that are very common when creating a template, these are:
|
||||
- `randomPort`: This is a helper that will generate a random port for the template.
|
||||
- `timestamp`: This is a helper that will generate a timestamp.
|
||||
- `jwt or jwt:length`: This is a helper that will generate a jwt for the template.
|
||||
- `email`: This is a helper that will generate a random email for the template.
|
||||
- `username`: This is a helper that will generate a random username in lowercase for the template.
|
||||
|
||||
|
||||
|
||||
|
19
meta.json
19
meta.json
@ -1,5 +1,4 @@
|
||||
[
|
||||
{
|
||||
[ {
|
||||
"id": "appwrite",
|
||||
"name": "Appwrite",
|
||||
"version": "1.6.0",
|
||||
@ -1543,7 +1542,8 @@
|
||||
"logo": "it-tools.svg",
|
||||
"links": {
|
||||
"github": "https://github.com/CorentinTh/it-tools",
|
||||
"website": "https://it-tools.tech"
|
||||
"website": "https://it-tools.tech",
|
||||
"docs": "https://it-tools.tech/docs"
|
||||
},
|
||||
"tags": [
|
||||
"developer",
|
||||
@ -1577,7 +1577,8 @@
|
||||
"logo": "glance.png",
|
||||
"links": {
|
||||
"github": "https://github.com/glanceapp/glance",
|
||||
"docs": "https://github.com/glanceapp/glance/blob/main/docs/configuration.md"
|
||||
"docs": "https://github.com/glanceapp/glance/blob/main/docs/configuration.md",
|
||||
"website": "https://glance.app/"
|
||||
},
|
||||
"tags": [
|
||||
"dashboard",
|
||||
@ -2055,7 +2056,8 @@
|
||||
"logo": "logo.png",
|
||||
"links": {
|
||||
"github": "https://github.com/supernova3339/anonupload",
|
||||
"docs": "https://github.com/Supernova3339/anonupload/blob/main/env.md"
|
||||
"docs": "https://github.com/Supernova3339/anonupload/blob/main/env.md",
|
||||
"website": "https://anonupload.com/"
|
||||
},
|
||||
"tags": [
|
||||
"file-sharing",
|
||||
@ -2172,7 +2174,9 @@
|
||||
"description": "Barrage is a minimalistic Deluge WebUI app with full mobile support. It features a responsive mobile-first design, allowing you to manage your torrents with ease from any device.",
|
||||
"logo": "logo.png",
|
||||
"links": {
|
||||
"github": "https://github.com/maulik9898/barrage"
|
||||
"github": "https://github.com/maulik9898/barrage",
|
||||
"website": "https://github.com/maulik9898/barrage",
|
||||
"docs": "https://github.com/maulik9898/barrage/blob/main/README.md"
|
||||
},
|
||||
"tags": [
|
||||
"torrents",
|
||||
@ -2443,7 +2447,8 @@
|
||||
"logo": "logo.png",
|
||||
"links": {
|
||||
"github": "https://github.com/linuxserver/docker-chromium",
|
||||
"docs": "https://docs.linuxserver.io/images/docker-chromium"
|
||||
"docs": "https://docs.linuxserver.io/images/docker-chromium",
|
||||
"website": "https://docs.linuxserver.io/images/docker-chromium"
|
||||
},
|
||||
"tags": [
|
||||
"browser",
|
||||
|
Loading…
Reference in New Issue
Block a user