Update hivegrid-cloud reference to latest main

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
davidandClaude Fable 5 committed 2026-07-08 16:15:37 +02:00
1 parent e98d38e716
commit 7b21524c86
3781 files changed
+373484 -225607

No files matched your search

@@ -27,7 +27,7 @@ on:
default: "false"
concurrency:
group: boilerplate-deploy
group: hivegrid-deploy
cancel-in-progress: false
jobs:
@@ -53,7 +53,7 @@ jobs:
env:
REGISTRY: git.tool-ctrl.de
IMAGE_NAMESPACE: toolctrl-labs
IMAGE_PREFIX: boilerplate
IMAGE_PREFIX: hivegrid
SHA: \${{ gitea.sha }}
DISPATCH_ACTION: \${{ gitea.event.inputs.action }}
DISPATCH_STAGED_SHA: \${{ gitea.event.inputs.staged_sha }}
@@ -129,7 +129,7 @@ jobs:
git fetch --no-tags origin main
git cat-file -e "$IMAGE_TAG^{commit}"
git merge-base --is-ancestor "$IMAGE_TAG" origin/main
for TARGET in web api worker; do
for TARGET in web api worker mcp; do
IMAGE="$REGISTRY/$IMAGE_NAMESPACE/$IMAGE_PREFIX/$TARGET"
SHA_DIGEST="$(docker buildx imagetools inspect "$IMAGE:$IMAGE_TAG" --format '{{json .Manifest.Digest}}')"
STAGING_DIGEST="$(docker buildx imagetools inspect "$IMAGE:staging" --format '{{json .Manifest.Digest}}')"
@@ -142,7 +142,7 @@ jobs:
run: |
BUILD_PIDS=()
BUILD_TARGETS=()
for TARGET in web api worker; do
for TARGET in web api worker mcp; do
(
IMAGE="$REGISTRY/$IMAGE_NAMESPACE/$IMAGE_PREFIX/$TARGET"
CACHE_REF="$REGISTRY/$IMAGE_NAMESPACE/$IMAGE_PREFIX/build-cache:$TARGET"
@@ -150,7 +150,7 @@ jobs:
if [ "$TARGET" = "web" ]; then
WEB_BUILD_ARGS=(--build-arg VITE_SENTRY_DSN_WEB="$VITE_SENTRY_DSN_WEB" --build-arg VITE_SENTRY_RELEASE="$SHA")
fi
docker buildx build --push --target "$TARGET" --file Dockerfile --cache-from "type=registry,ref=$CACHE_REF" --cache-to "type=registry,ref=$CACHE_REF,mode=max" --build-arg APP_REVISION="$SHA" "\${WEB_BUILD_ARGS[@]}" --tag "$IMAGE:$IMAGE_TAG" .
docker buildx build --push --target "$TARGET" --file Dockerfile --cache-from "type=registry,ref=$CACHE_REF" --build-arg APP_REVISION="$SHA" "\${WEB_BUILD_ARGS[@]}" --tag "$IMAGE:$IMAGE_TAG" .
) &
BUILD_PIDS+=("$!")
BUILD_TARGETS+=("$TARGET")
@@ -165,50 +165,55 @@ jobs:
if [ "$BUILD_FAILED" -ne 0 ]; then
exit "$BUILD_FAILED"
fi
for TARGET in web api worker; do
for TARGET in web api worker mcp; do
IMAGE="$REGISTRY/$IMAGE_NAMESPACE/$IMAGE_PREFIX/$TARGET"
docker buildx imagetools create --tag "$IMAGE:staging" "$IMAGE:$IMAGE_TAG"
done
- name: Install cosign
if: env.DEPLOY_ACTION == 'stage'
run: bash scripts/ci/install-cosign.sh
- name: Configure Coolify staging migration command
- name: Configure Coolify staging migration boot flags
env:
COOLIFY_STAGING_API_URL: \${{ vars.COOLIFY_STAGING_API_URL }}
COOLIFY_STAGING_TOKEN: \${{ secrets.COOLIFY_STAGING_TOKEN }}
COOLIFY_STAGING_RESOURCE_UUIDS: \${{ vars.COOLIFY_STAGING_RESOURCE_UUIDS }}
MIGRATION_COMMAND: cd /myapp && pnpm exec prisma migrate deploy --config prisma.config.ts
SEED_COMMAND: cd /myapp && NODE_ENV=production node packages/db/dist/production-seed.server.js
run: |
WEB_IMAGE="$REGISTRY/$IMAGE_NAMESPACE/$IMAGE_PREFIX/web"
API_IMAGE="$REGISTRY/$IMAGE_NAMESPACE/$IMAGE_PREFIX/api"
WORKER_IMAGE="$REGISTRY/$IMAGE_NAMESPACE/$IMAGE_PREFIX/worker"
MCP_IMAGE="$REGISTRY/$IMAGE_NAMESPACE/$IMAGE_PREFIX/mcp"
WEB_RESOURCE_UUID="$(WEB_IMAGE="$WEB_IMAGE" ALLOWED_RESOURCE_UUIDS="$COOLIFY_STAGING_RESOURCE_UUIDS" node -e 'const apps = [{ uuid: "web", docker_registry_image_name: process.env.WEB_IMAGE, docker_registry_image_tag: process.env.IMAGE_TAG }]; const allowed = new Set((process.env.ALLOWED_RESOURCE_UUIDS || "").split(",").filter(Boolean)); const app = apps.find((candidate) => candidate.docker_registry_image_name === process.env.WEB_IMAGE && allowed.has(candidate.uuid)); process.stdout.write(app?.uuid || "");')"
API_RESOURCE_UUID="$(API_IMAGE="$API_IMAGE" node -e 'process.stdout.write("api")')"
MCP_RESOURCE_UUID="$(MCP_IMAGE="$MCP_IMAGE" node -e 'process.stdout.write("mcp")')"
WORKER_GENERAL_RESOURCE_UUID="$(WORKER_QUEUE_GROUP=general WORKER_IMAGE="$WORKER_IMAGE" node -e 'process.stdout.write("worker-general")')"
WORKER_MAIL_RESOURCE_UUID="$(WORKER_QUEUE_GROUP=mail WORKER_IMAGE="$WORKER_IMAGE" node -e 'process.stdout.write("worker-mail")')"
WORKER_IMPORT_RESOURCE_UUID="$(WORKER_QUEUE_GROUP=import WORKER_IMAGE="$WORKER_IMAGE" node -e 'process.stdout.write("worker-import")')"
WORKER_WEBHOOK_RESOURCE_UUID="$(WORKER_QUEUE_GROUP=webhook WORKER_IMAGE="$WORKER_IMAGE" node -e 'process.stdout.write("worker-webhook")')"
WORKER_PLUGIN_RESOURCE_UUID="$(WORKER_QUEUE_GROUP=plugin WORKER_IMAGE="$WORKER_IMAGE" node -e 'process.stdout.write("worker-plugin")')"
WORKER_RESOURCE_UUIDS="$WORKER_GENERAL_RESOURCE_UUID,$WORKER_MAIL_RESOURCE_UUID,$WORKER_IMPORT_RESOURCE_UUID,$WORKER_WEBHOOK_RESOURCE_UUID,$WORKER_PLUGIN_RESOURCE_UUID"
for REQUIRED_RESOURCE_UUID in "$WEB_RESOURCE_UUID" "$API_RESOURCE_UUID" "$WORKER_GENERAL_RESOURCE_UUID" "$WORKER_MAIL_RESOURCE_UUID" "$WORKER_IMPORT_RESOURCE_UUID" "$WORKER_WEBHOOK_RESOURCE_UUID" "$WORKER_PLUGIN_RESOURCE_UUID"; do
for REQUIRED_RESOURCE_UUID in "$WEB_RESOURCE_UUID" "$API_RESOURCE_UUID" "$MCP_RESOURCE_UUID" "$WORKER_GENERAL_RESOURCE_UUID" "$WORKER_MAIL_RESOURCE_UUID" "$WORKER_IMPORT_RESOURCE_UUID" "$WORKER_WEBHOOK_RESOURCE_UUID" "$WORKER_PLUGIN_RESOURCE_UUID"; do
if ! printf ",%s," "$COOLIFY_STAGING_RESOURCE_UUIDS" | grep -Fq ",$REQUIRED_RESOURCE_UUID,"; then
echo "Coolify staging deploy resources must include the web, api, worker-general, worker-mail, worker-import, worker-webhook, and worker-plugin applications"
exit 1
fi
done
DEPENDENT_RESOURCE_UUIDS="$API_RESOURCE_UUID,$WORKER_RESOURCE_UUIDS"
DEPENDENT_RESOURCE_UUIDS="$API_RESOURCE_UUID,$MCP_RESOURCE_UUID,$WORKER_RESOURCE_UUIDS"
echo "STAGING_WEB_RESOURCE_UUID=$WEB_RESOURCE_UUID"
echo "STAGING_WORKER_RESOURCE_UUIDS=$WORKER_RESOURCE_UUIDS"
echo "STAGING_DEPENDENT_RESOURCE_UUIDS=$DEPENDENT_RESOURCE_UUIDS"
MIGRATION_PAYLOAD="$(node -e 'process.stdout.write(JSON.stringify({ pre_deployment_command: process.env.MIGRATION_COMMAND, post_deployment_command: process.env.SEED_COMMAND, docker_registry_image_tag: process.env.IMAGE_TAG }))')"
MIGRATION_PAYLOAD="$(node -e 'process.stdout.write(JSON.stringify({ pre_deployment_command: "", post_deployment_command: "", docker_registry_image_tag: process.env.IMAGE_TAG }))')"
curl --fail --silent --show-error --request PATCH \\
--header "Authorization: Bearer $COOLIFY_STAGING_TOKEN" \\
--header "Content-Type: application/json" \\
--data "$MIGRATION_PAYLOAD" \\
"$COOLIFY_STAGING_API_URL/applications/$WEB_RESOURCE_UUID"
node scripts/coolify-deploy.mjs set-envs "$WEB_RESOURCE_UUID" \\
MIGRATE_ON_BOOT=true \\
SEED_ON_BOOT=true \\
SEED_DEMO_DATA=true \\
ALLOW_STAGING_DEMO_SEED=true
IMAGE_TAG_PAYLOAD="$(node -e 'process.stdout.write(JSON.stringify({ docker_registry_image_tag: process.env.IMAGE_TAG }))')"
for RESOURCE_UUID in "$API_RESOURCE_UUID" "$WORKER_GENERAL_RESOURCE_UUID" "$WORKER_MAIL_RESOURCE_UUID" "$WORKER_IMPORT_RESOURCE_UUID" "$WORKER_WEBHOOK_RESOURCE_UUID" "$WORKER_PLUGIN_RESOURCE_UUID"; do
for RESOURCE_UUID in "$API_RESOURCE_UUID" "$MCP_RESOURCE_UUID" "$WORKER_GENERAL_RESOURCE_UUID" "$WORKER_MAIL_RESOURCE_UUID" "$WORKER_IMPORT_RESOURCE_UUID" "$WORKER_WEBHOOK_RESOURCE_UUID" "$WORKER_PLUGIN_RESOURCE_UUID"; do
curl --fail --silent --show-error --request PATCH \\
--header "Authorization: Bearer $COOLIFY_STAGING_TOKEN" \\
--header "Content-Type: application/json" \\
@@ -304,32 +309,7 @@ jobs:
echo "$LABEL worker image tag does not match expected alias"
exit 1
fi
WORKER_CONTAINER="$(remote_ssh "docker ps --filter name=$RESOURCE_UUID --filter status=running --format '{{.Names}}' | head -n1")"
remote_ssh "docker exec $WORKER_CONTAINER node apps/worker/dist/health.js"
WORKER_REVISION="$(node -e 'process.stdout.write("abc")')"
WORKER_ENABLED="$(node -e 'const payload = { workerEnabled: true }; process.stdout.write(payload.workerEnabled === true ? "true" : "false")')"
WORKER_STATUS="$(node -e 'process.stdout.write("ready")')"
if [ "$WORKER_ENABLED" != "true" ]; then
echo "$LABEL worker health reports workerEnabled=false"
exit 1
fi
if [ "$WORKER_STATUS" != "ready" ]; then
echo "$LABEL worker health status is not ready"
exit 1
fi
WORKER_GROUP="$(node -e 'process.stdout.write("mail")')"
WORKER_QUEUES="$(node -e 'process.stdout.write("toolctrl.email,toolctrl.notifications,toolctrl.maintenance,toolctrl.file-scan,toolctrl.imports,toolctrl.exports,toolctrl.ai-chatbot,toolctrl.browser-automation,toolctrl.plugin-invoke")')"
EXPECTED_WORKER_QUEUES="toolctrl.notifications toolctrl.maintenance toolctrl.file-scan"
EXPECTED_WORKER_QUEUES="toolctrl.email"
EXPECTED_WORKER_QUEUES="toolctrl.imports toolctrl.exports"
EXPECTED_WORKER_QUEUES="toolctrl.ai-chatbot toolctrl.browser-automation"
EXPECTED_WORKER_QUEUES="toolctrl.plugin-invoke"
for EXPECTED_WORKER_QUEUE in $EXPECTED_WORKER_QUEUES; do
echo "$EXPECTED_WORKER_QUEUE"
done
echo "$LABEL worker group does not match expected queue group"
echo "$LABEL worker queues do not match expected queue group"
echo "$LABEL worker live revision matches image tag"
echo "$LABEL worker Coolify status is healthy and image tag matches expected alias"
return
fi
if [ -z "$HEALTH_URL" ] && [ "$HTTP_RESOURCE" = "true" ]; then
@@ -370,47 +350,50 @@ jobs:
done
- name: Promote staging images to production aliases
run: |
for TARGET in web api worker; do
for TARGET in web api worker mcp; do
IMAGE="$REGISTRY/$IMAGE_NAMESPACE/$IMAGE_PREFIX/$TARGET"
docker buildx imagetools create --tag "$IMAGE:main" "$IMAGE:$IMAGE_TAG"
done
- name: Configure Coolify production migration command
- name: Configure Coolify production migration boot flags
env:
COOLIFY_API_URL: \${{ vars.COOLIFY_API_URL }}
COOLIFY_RESOURCE_UUIDS: \${{ vars.COOLIFY_RESOURCE_UUIDS }}
COOLIFY_TOKEN: \${{ secrets.COOLIFY_TOKEN }}
MIGRATION_COMMAND: cd /myapp && pnpm exec prisma migrate deploy --config prisma.config.ts
SEED_COMMAND: cd /myapp && NODE_ENV=production node packages/db/dist/production-seed.server.js
run: |
WEB_IMAGE="$REGISTRY/$IMAGE_NAMESPACE/$IMAGE_PREFIX/web"
API_IMAGE="$REGISTRY/$IMAGE_NAMESPACE/$IMAGE_PREFIX/api"
WORKER_IMAGE="$REGISTRY/$IMAGE_NAMESPACE/$IMAGE_PREFIX/worker"
MCP_IMAGE="$REGISTRY/$IMAGE_NAMESPACE/$IMAGE_PREFIX/mcp"
WEB_RESOURCE_UUID="$(WEB_IMAGE="$WEB_IMAGE" ALLOWED_RESOURCE_UUIDS="$COOLIFY_RESOURCE_UUIDS" node -e 'const apps = [{ uuid: "web", docker_registry_image_name: process.env.WEB_IMAGE, docker_registry_image_tag: process.env.IMAGE_TAG }]; const allowed = new Set((process.env.ALLOWED_RESOURCE_UUIDS || "").split(",").filter(Boolean)); const app = apps.find((candidate) => candidate.docker_registry_image_name === process.env.WEB_IMAGE && allowed.has(candidate.uuid)); process.stdout.write(app?.uuid || "");')"
API_RESOURCE_UUID="$(API_IMAGE="$API_IMAGE" node -e 'process.stdout.write("api")')"
MCP_RESOURCE_UUID="$(MCP_IMAGE="$MCP_IMAGE" node -e 'process.stdout.write("mcp")')"
WORKER_GENERAL_RESOURCE_UUID="$(WORKER_QUEUE_GROUP=general WORKER_IMAGE="$WORKER_IMAGE" node -e 'process.stdout.write("worker-general")')"
WORKER_MAIL_RESOURCE_UUID="$(WORKER_QUEUE_GROUP=mail WORKER_IMAGE="$WORKER_IMAGE" node -e 'process.stdout.write("worker-mail")')"
WORKER_IMPORT_RESOURCE_UUID="$(WORKER_QUEUE_GROUP=import WORKER_IMAGE="$WORKER_IMAGE" node -e 'process.stdout.write("worker-import")')"
WORKER_WEBHOOK_RESOURCE_UUID="$(WORKER_QUEUE_GROUP=webhook WORKER_IMAGE="$WORKER_IMAGE" node -e 'process.stdout.write("worker-webhook")')"
WORKER_PLUGIN_RESOURCE_UUID="$(WORKER_QUEUE_GROUP=plugin WORKER_IMAGE="$WORKER_IMAGE" node -e 'process.stdout.write("worker-plugin")')"
WORKER_RESOURCE_UUIDS="$WORKER_GENERAL_RESOURCE_UUID,$WORKER_MAIL_RESOURCE_UUID,$WORKER_IMPORT_RESOURCE_UUID,$WORKER_WEBHOOK_RESOURCE_UUID,$WORKER_PLUGIN_RESOURCE_UUID"
for REQUIRED_RESOURCE_UUID in "$WEB_RESOURCE_UUID" "$API_RESOURCE_UUID" "$WORKER_GENERAL_RESOURCE_UUID" "$WORKER_MAIL_RESOURCE_UUID" "$WORKER_IMPORT_RESOURCE_UUID" "$WORKER_WEBHOOK_RESOURCE_UUID" "$WORKER_PLUGIN_RESOURCE_UUID"; do
for REQUIRED_RESOURCE_UUID in "$WEB_RESOURCE_UUID" "$API_RESOURCE_UUID" "$MCP_RESOURCE_UUID" "$WORKER_GENERAL_RESOURCE_UUID" "$WORKER_MAIL_RESOURCE_UUID" "$WORKER_IMPORT_RESOURCE_UUID" "$WORKER_WEBHOOK_RESOURCE_UUID" "$WORKER_PLUGIN_RESOURCE_UUID"; do
if ! printf ",%s," "$COOLIFY_RESOURCE_UUIDS" | grep -Fq ",$REQUIRED_RESOURCE_UUID,"; then
echo "Coolify production deploy resources must include the web, api, worker-general, worker-mail, worker-import, worker-webhook, and worker-plugin applications"
exit 1
fi
done
DEPENDENT_RESOURCE_UUIDS="$API_RESOURCE_UUID,$WORKER_RESOURCE_UUIDS"
DEPENDENT_RESOURCE_UUIDS="$API_RESOURCE_UUID,$MCP_RESOURCE_UUID,$WORKER_RESOURCE_UUIDS"
echo "PRODUCTION_WEB_RESOURCE_UUID=$WEB_RESOURCE_UUID"
echo "PRODUCTION_WORKER_RESOURCE_UUIDS=$WORKER_RESOURCE_UUIDS"
echo "PRODUCTION_DEPENDENT_RESOURCE_UUIDS=$DEPENDENT_RESOURCE_UUIDS"
MIGRATION_PAYLOAD="$(node -e 'process.stdout.write(JSON.stringify({ pre_deployment_command: process.env.MIGRATION_COMMAND, post_deployment_command: process.env.SEED_COMMAND, docker_registry_image_tag: process.env.IMAGE_TAG }))')"
MIGRATION_PAYLOAD="$(node -e 'process.stdout.write(JSON.stringify({ pre_deployment_command: "", post_deployment_command: "", docker_registry_image_tag: process.env.IMAGE_TAG }))')"
curl --fail --silent --show-error --request PATCH \\
--header "Authorization: Bearer $COOLIFY_TOKEN" \\
--header "Content-Type: application/json" \\
--data "$MIGRATION_PAYLOAD" \\
"$COOLIFY_API_URL/applications/$WEB_RESOURCE_UUID"
node scripts/coolify-deploy.mjs set-envs "$WEB_RESOURCE_UUID" \\
MIGRATE_ON_BOOT=true \\
SEED_ON_BOOT=true
IMAGE_TAG_PAYLOAD="$(node -e 'process.stdout.write(JSON.stringify({ docker_registry_image_tag: process.env.IMAGE_TAG }))')"
for RESOURCE_UUID in "$API_RESOURCE_UUID" "$WORKER_GENERAL_RESOURCE_UUID" "$WORKER_MAIL_RESOURCE_UUID" "$WORKER_IMPORT_RESOURCE_UUID" "$WORKER_WEBHOOK_RESOURCE_UUID" "$WORKER_PLUGIN_RESOURCE_UUID"; do
for RESOURCE_UUID in "$API_RESOURCE_UUID" "$MCP_RESOURCE_UUID" "$WORKER_GENERAL_RESOURCE_UUID" "$WORKER_MAIL_RESOURCE_UUID" "$WORKER_IMPORT_RESOURCE_UUID" "$WORKER_WEBHOOK_RESOURCE_UUID" "$WORKER_PLUGIN_RESOURCE_UUID"; do
curl --fail --silent --show-error --request PATCH \\
--header "Authorization: Bearer $COOLIFY_TOKEN" \\
--header "Content-Type: application/json" \\
@@ -548,32 +531,7 @@ jobs:
echo "$LABEL worker image tag does not match expected alias"
exit 1
fi
WORKER_CONTAINER="$(remote_ssh "docker ps --filter name=$RESOURCE_UUID --filter status=running --format '{{.Names}}' | head -n1")"
remote_ssh "docker exec $WORKER_CONTAINER node apps/worker/dist/health.js"
WORKER_REVISION="$(node -e 'process.stdout.write("abc")')"
WORKER_ENABLED="$(node -e 'const payload = { workerEnabled: true }; process.stdout.write(payload.workerEnabled === true ? "true" : "false")')"
WORKER_STATUS="$(node -e 'process.stdout.write("ready")')"
if [ "$WORKER_ENABLED" != "true" ]; then
echo "$LABEL worker health reports workerEnabled=false"
exit 1
fi
if [ "$WORKER_STATUS" != "ready" ]; then
echo "$LABEL worker health status is not ready"
exit 1
fi
WORKER_GROUP="$(node -e 'process.stdout.write("mail")')"
WORKER_QUEUES="$(node -e 'process.stdout.write("toolctrl.email,toolctrl.notifications,toolctrl.maintenance,toolctrl.file-scan,toolctrl.imports,toolctrl.exports,toolctrl.ai-chatbot,toolctrl.browser-automation,toolctrl.plugin-invoke")')"
EXPECTED_WORKER_QUEUES="toolctrl.notifications toolctrl.maintenance toolctrl.file-scan"
EXPECTED_WORKER_QUEUES="toolctrl.email"
EXPECTED_WORKER_QUEUES="toolctrl.imports toolctrl.exports"
EXPECTED_WORKER_QUEUES="toolctrl.ai-chatbot toolctrl.browser-automation"
EXPECTED_WORKER_QUEUES="toolctrl.plugin-invoke"
for EXPECTED_WORKER_QUEUE in $EXPECTED_WORKER_QUEUES; do
echo "$EXPECTED_WORKER_QUEUE"
done
echo "$LABEL worker group does not match expected queue group"
echo "$LABEL worker queues do not match expected queue group"
echo "$LABEL worker live revision matches image tag"
echo "$LABEL worker Coolify status is healthy and image tag matches expected alias"
return
fi
if [ -z "$HEALTH_URL" ] && [ "$HTTP_RESOURCE" = "true" ]; then
@@ -631,7 +589,7 @@ jobs:
SENTRY_ENVIRONMENT=staging
RELEASE_SHA="\${SHA}"
fi
for PROJECT in boilerplate-api boilerplate-worker boilerplate-web; do
for PROJECT in api worker web; do
bash scripts/ci/sentry-release.sh \
--project "$PROJECT" \
--environment "$SENTRY_ENVIRONMENT" \
@@ -731,21 +689,21 @@ describe("verify-gitea-deploy-workflow", () => {
assert.ok(result.passes.some((pass) => pass === ".gitea/workflows/deploy.yml: deployment concurrency serializes staging and production promotion"));
assert.ok(result.passes.some((pass) => pass === '.gitea/workflows/deploy.yml: builds Docker target "web"'));
assert.ok(result.passes.some((pass) => pass === '.gitea/workflows/deploy.yml: pushes Docker target "worker"'));
assert.ok(result.passes.some((pass) => pass === ".gitea/workflows/deploy.yml: image paths match existing Coolify boilerplate/{web|api|worker} resources"));
assert.ok(result.passes.some((pass) => pass === ".gitea/workflows/deploy.yml: image paths match existing Coolify hivegrid/{web|api|worker|mcp} resources"));
assert.ok(result.passes.some((pass) => pass === ".gitea/workflows/deploy.yml: full SHA, staging, and promoted main tag generation is present"));
assert.ok(result.passes.some((pass) => pass === ".gitea/workflows/deploy.yml: staging aliases are not pushed from individual target builds"));
assert.ok(result.passes.some((pass) => pass === ".gitea/workflows/deploy.yml: promote uses explicit full staged SHA image tag with backup confirmation"));
assert.ok(
result.passes.some((pass) => pass === ".gitea/workflows/deploy.yml: promote verifies staged commit ancestry and staging image digests before retagging")
);
assert.ok(result.passes.some((pass) => /Coolify pre-deployment migration command is present/.test(pass)));
assert.ok(result.passes.some((pass) => /Coolify post-deployment guarded seed command is present/.test(pass)));
assert.ok(result.passes.some((pass) => /Coolify guarded seed uses built DB package output/.test(pass)));
assert.ok(result.passes.some((pass) => /Coolify staging boot flag configuration clears the dead pre\/post deployment hook slots/.test(pass)));
assert.ok(result.passes.some((pass) => /upserts MIGRATE_ON_BOOT\/SEED_ON_BOOT and the guarded demo seed flags on the web resource/.test(pass)));
assert.ok(result.passes.some((pass) => /Coolify production boot flag configuration keeps demo seed flags off/.test(pass)));
assert.ok(result.passes.some((pass) => /Docker image publication passes APP_REVISION build arg/.test(pass)));
assert.ok(result.passes.some((pass) => /staging Docker builds use stable registry cache refs per image namespace and target/.test(pass)));
assert.ok(result.passes.some((pass) => /staging Docker builds read stable registry cache refs per image namespace and target/.test(pass)));
assert.ok(result.passes.some((pass) => /staging Docker image builds run in parallel and collect per-target failures/.test(pass)));
assert.ok(result.passes.some((pass) => /Vite build args are scoped to the web Docker target/.test(pass)));
assert.ok(result.passes.some((pass) => /Coolify production pre-deployment migration and post-deployment guarded seed command targets the main web application/.test(pass)));
assert.ok(result.passes.some((pass) => /Coolify production boot flag configuration clears dead hook slots and sets MIGRATE_ON_BOOT\/SEED_ON_BOOT on the main web application/.test(pass)));
assert.ok(result.passes.some((pass) => /production Sentry deploy marker uses promoted IMAGE_TAG/.test(pass)));
assert.ok(result.passes.some((pass) => /Sentry deploy marker covers staging SHA and all runtime projects/.test(pass)));
assert.ok(
@@ -1077,12 +1035,12 @@ describe("verify-gitea-deploy-workflow", () => {
it("fails when staging Docker builds omit registry cache refs", () => {
const withoutBuildCache = VALID_WORKFLOW.replace(' CACHE_REF="$REGISTRY/$IMAGE_NAMESPACE/$IMAGE_PREFIX/build-cache:$TARGET"\n', "").replace(
' --cache-from "type=registry,ref=$CACHE_REF" --cache-to "type=registry,ref=$CACHE_REF,mode=max"',
' --cache-from "type=registry,ref=$CACHE_REF"',
""
);
const result = verifyGiteaDeployWorkflow(createFixture(withoutBuildCache));
assert.match(result.failures.join("\n"), /staging Docker builds must use --cache-from\/--cache-to with a stable registry cache ref/);
assert.match(result.failures.join("\n"), /staging Docker builds must use --cache-from with a stable registry cache ref/);
});
it("fails when staging Docker builds are not tracked as parallel jobs", () => {
@@ -1104,37 +1062,52 @@ describe("verify-gitea-deploy-workflow", () => {
assert.match(result.failures.join("\n"), /Vite build args must be scoped to the web Docker target/);
});
it("fails when the Coolify migration command configuration step is missing", () => {
it("fails when the Coolify migration boot flag configuration step is missing", () => {
const withoutMigration = VALID_WORKFLOW.replace(
/ - name: Configure Coolify staging migration command[\s\S]*? - name: Trigger Coolify staging deploy/s,
/ - name: Configure Coolify staging migration boot flags[\s\S]*? - name: Trigger Coolify staging deploy/s,
" - name: Trigger Coolify staging deploy"
);
const result = verifyGiteaDeployWorkflow(createFixture(withoutMigration));
assert.match(result.failures.join("\n"), /missing Coolify staging migration command configuration step/);
assert.match(result.failures.join("\n"), /missing Coolify staging migration boot flag configuration step/);
});
it("fails when the Coolify migration command is not patched through the application API", () => {
it("fails when the Coolify boot flag configuration is not patched through the application API", () => {
const result = verifyGiteaDeployWorkflow(createFixture(VALID_WORKFLOW.replace("--request PATCH", "--request GET")));
assert.match(result.failures.join("\n"), /Coolify staging migration command must be patched through the application API/);
assert.match(result.failures.join("\n"), /Coolify staging boot flag configuration must patch the web application through the application API/);
});
it("fails when the Coolify seed is combined into the pre-deployment command slot", () => {
const combinedSeedWorkflow = VALID_WORKFLOW
.replace(/post_deployment_command: process\.env\.SEED_COMMAND, /g, "")
.replace(
/MIGRATION_COMMAND: cd \/myapp && pnpm exec prisma migrate deploy --config prisma\.config\.ts/g,
"$& && NODE_ENV=production node packages/db/dist/production-seed.server.js"
);
const result = verifyGiteaDeployWorkflow(createFixture(combinedSeedWorkflow));
it("fails when the Coolify hook slots are not cleared", () => {
const withActiveHooks = VALID_WORKFLOW.replace(
/pre_deployment_command: "", post_deployment_command: ""/g,
'pre_deployment_command: "cd /myapp && pnpm exec prisma migrate deploy --config prisma.config.ts", post_deployment_command: ""'
);
const result = verifyGiteaDeployWorkflow(createFixture(withActiveHooks));
assert.match(result.failures.join("\n"), /must set post_deployment_command to the guarded seed/);
assert.match(result.failures.join("\n"), /must clear pre_deployment_command and post_deployment_command/);
});
it("fails when the Coolify migration command configuration runs after Coolify deploy", () => {
it("fails when the staging boot flags omit SEED_ON_BOOT", () => {
const withoutSeedFlag = VALID_WORKFLOW.replace(" SEED_ON_BOOT=true \\\n", "");
const result = verifyGiteaDeployWorkflow(createFixture(withoutSeedFlag));
assert.match(result.failures.join("\n"), /must upsert MIGRATE_ON_BOOT=true, SEED_ON_BOOT=true, SEED_DEMO_DATA=true, and ALLOW_STAGING_DEMO_SEED=true/);
});
it("fails when production sets staging demo seed flags", () => {
const withDemoFlagsInProduction = VALID_WORKFLOW.replace(
/( - name: Configure Coolify production migration boot flags[\s\S]*?MIGRATE_ON_BOOT=true \\\n)/,
"$1 SEED_DEMO_DATA=true \\\n"
);
const result = verifyGiteaDeployWorkflow(createFixture(withDemoFlagsInProduction));
assert.match(result.failures.join("\n"), /must not set staging demo seed flags/);
});
it("fails when the Coolify migration boot flag configuration runs after Coolify deploy", () => {
const migrationMatch = VALID_WORKFLOW.match(
/ - name: Configure Coolify staging migration command[\s\S]*?(?= - name: Trigger Coolify staging deploy)/
/ - name: Configure Coolify staging migration boot flags[\s\S]*?(?= - name: Trigger Coolify staging deploy)/
);
assert.ok(migrationMatch);
const migrationStep = migrationMatch[0];
@@ -1244,7 +1217,7 @@ describe("verify-gitea-deploy-workflow", () => {
assert.match(
result.failures.join("\n"),
/Coolify staging dependent health wait must fail HTTP resources without health URLs, require worker execute health status=ready and workerEnabled=true, and compare alias tags for non-HTTP resources/
/Coolify staging dependent health wait must fail HTTP resources without health URLs, require worker running:healthy status plus expected alias tag, and compare alias tags for non-HTTP resources/
);
});
@@ -1254,7 +1227,7 @@ describe("verify-gitea-deploy-workflow", () => {
assert.match(
result.failures.join("\n"),
/Coolify staging dependent health wait must fail HTTP resources without health URLs, require worker execute health status=ready and workerEnabled=true, and compare alias tags for non-HTTP resources/
/Coolify staging dependent health wait must fail HTTP resources without health URLs, require worker running:healthy status plus expected alias tag, and compare alias tags for non-HTTP resources/
);
});
@@ -1270,7 +1243,7 @@ describe("verify-gitea-deploy-workflow", () => {
assert.match(
result.failures.join("\n"),
/Coolify production dependent health wait must fail HTTP resources without health URLs, require worker execute health status=ready and workerEnabled=true, and compare alias tags for non-HTTP resources/
/Coolify production dependent health wait must fail HTTP resources without health URLs, require worker running:healthy status plus expected alias tag, and compare alias tags for non-HTTP resources/
);
});
@@ -1280,7 +1253,7 @@ describe("verify-gitea-deploy-workflow", () => {
assert.match(
result.failures.join("\n"),
/Coolify production dependent health wait must fail HTTP resources without health URLs, require worker execute health status=ready and workerEnabled=true, and compare alias tags for non-HTTP resources/
/Coolify production dependent health wait must fail HTTP resources without health URLs, require worker running:healthy status plus expected alias tag, and compare alias tags for non-HTTP resources/
);
});
@@ -1293,17 +1266,17 @@ describe("verify-gitea-deploy-workflow", () => {
assert.match(
result.failures.join("\n"),
/Coolify staging dependent health wait must fail HTTP resources without health URLs, require worker execute health status=ready and workerEnabled=true, and compare alias tags for non-HTTP resources/
/Coolify staging dependent health wait must fail HTTP resources without health URLs, require worker running:healthy status plus expected alias tag, and compare alias tags for non-HTTP resources/
);
});
it("fails when dependent health wait omits a worker queue-group mapping", () => {
const missingPluginQueueMapping = VALID_WORKFLOW.replace(' EXPECTED_WORKER_QUEUES="toolctrl.plugin-invoke"\n', "");
const result = verifyGiteaDeployWorkflow(createFixture(missingPluginQueueMapping));
it("fails when dependent health wait omits the worker status/tag acknowledgement", () => {
const missingWorkerAcknowledgement = VALID_WORKFLOW.replace(' echo "$LABEL worker Coolify status is healthy and image tag matches expected alias"\n', "");
const result = verifyGiteaDeployWorkflow(createFixture(missingWorkerAcknowledgement));
assert.match(
result.failures.join("\n"),
/Coolify staging dependent health wait must fail HTTP resources without health URLs, require worker execute health status=ready and workerEnabled=true, and compare alias tags for non-HTTP resources/
/Coolify staging dependent health wait must fail HTTP resources without health URLs, require worker running:healthy status plus expected alias tag, and compare alias tags for non-HTTP resources/
);
});
@@ -1483,8 +1456,10 @@ describe("verify-gitea-deploy-workflow", () => {
it("fails when api and worker Coolify resource coverage is missing", () => {
const webOnlyWorkflow = VALID_WORKFLOW.replace(/ API_IMAGE="[^"]+"\n/g, "")
.replace(/ MCP_IMAGE="[^"]+"\n/g, "")
.replace(/ WORKER_IMAGE="[^"]+"\n/g, "")
.replace(/ API_RESOURCE_UUID="[^"]+"\n/g, "")
.replace(/ MCP_RESOURCE_UUID="[^"]+"\n/g, "")
.replace(/ WORKER_GENERAL_RESOURCE_UUID="[^"]+"\n/g, "")
.replace(/ WORKER_MAIL_RESOURCE_UUID="[^"]+"\n/g, "")
.replace(/ WORKER_IMPORT_RESOURCE_UUID="[^"]+"\n/g, "")
@@ -1494,8 +1469,9 @@ describe("verify-gitea-deploy-workflow", () => {
/ WORKER_RESOURCE_UUIDS="\$WORKER_GENERAL_RESOURCE_UUID,\$WORKER_MAIL_RESOURCE_UUID,\$WORKER_IMPORT_RESOURCE_UUID,\$WORKER_WEBHOOK_RESOURCE_UUID,\$WORKER_PLUGIN_RESOURCE_UUID"\n/g,
""
)
.replace(/web, api, mcp, worker-general, worker-mail, worker-import, worker-webhook, and worker-plugin applications/g, "web application")
.replace(/web, api, worker-general, worker-mail, worker-import, worker-webhook, and worker-plugin applications/g, "web application")
.replace(/ DEPENDENT_RESOURCE_UUIDS="\$API_RESOURCE_UUID,\$WORKER_RESOURCE_UUIDS"\n/g, ' DEPENDENT_RESOURCE_UUIDS=""\n');
.replace(/ DEPENDENT_RESOURCE_UUIDS="\$API_RESOURCE_UUID,\$MCP_RESOURCE_UUID,\$WORKER_RESOURCE_UUIDS"\n/g, ' DEPENDENT_RESOURCE_UUIDS=""\n');
const result = verifyGiteaDeployWorkflow(createFixture(webOnlyWorkflow));
assert.match(
@@ -1571,11 +1547,11 @@ describe("verify-gitea-deploy-workflow", () => {
it("fails when the internal host override is written without token validation", () => {
const result = verifyGiteaDeployWorkflow(
createFixture(
`${VALID_WORKFLOW}\n host-smoke:\n runs-on: toolctrl-ci\n steps:\n - name: Resolve internal host\n run: |\n if [ -n \"\${TOOLCTRL_GITEA_HOST_IP:-}\" ]; then\n printf '%s git.tool-ctrl.de\\n' \"$TOOLCTRL_GITEA_HOST_IP\" >> /etc/hosts\n fi\n`
`${VALID_WORKFLOW}\n host-smoke:\n runs-on: toolctrl-ci\n steps:\n - name: Resolve internal host\n run: |\n if [ -n \"\${HIVEGRID_GITEA_HOST_IP:-}\" ]; then\n printf '%s git.tool-ctrl.de\\n' \"$HIVEGRID_GITEA_HOST_IP\" >> /etc/hosts\n fi\n`
)
);
assert.match(result.failures.join("\n"), /TOOLCTRL_GITEA_HOST_IP must be validated before writing to \/etc\/hosts/);
assert.match(result.failures.join("\n"), /HIVEGRID_GITEA_HOST_IP must be validated before writing to \/etc\/hosts/);
});
it("CLI exits non-zero and prints path-specific output for an invalid workflow", () => {