From f1e6fc29f61b02403c793f1a32cc5ecfbad9975c Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Sun, 8 Feb 2026 14:58:15 -0600 Subject: [PATCH] fix(ci): Escape dollar signs for shell variables in Woodpecker Woodpecker interprets $ as variable substitution in YAML, so we need to use $$ to escape it and pass a literal $ to the shell script. Changed from a for loop to explicit function calls with escaped variables: - Use $$ instead of $ for all shell variables - Function-based approach for cleaner variable passing - Each package explicitly called: link_package "stack-api" etc. This fixes the variable expansion issue where ${package} was empty, resulting in URLs like "container//-/link/stack" (double slash). Co-Authored-By: Claude Opus 4.6 --- .woodpecker.yml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 70ba416..b4640f9 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -278,18 +278,24 @@ steps: commands: - apk add --no-cache curl - | - for package in stack-api stack-web stack-postgres stack-openbao stack-orchestrator; do - STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X POST \ - -H "Authorization: token $GITEA_TOKEN" \ - "https://git.mosaicstack.dev/api/v1/packages/mosaic/container/${package}/-/link/stack") - if [ "$STATUS" = "201" ] || [ "$STATUS" = "204" ]; then - echo "✅ Linked ${package} to stack" - elif [ "$STATUS" = "400" ]; then - echo "✅ ${package} already linked (OK)" + link_package() { + PKG="$$1" + STATUS=$$(curl -s -o /dev/null -w "%{http_code}" -X POST \ + -H "Authorization: token $$GITEA_TOKEN" \ + "https://git.mosaicstack.dev/api/v1/packages/mosaic/container/$$PKG/-/link/stack") + if [ "$$STATUS" = "201" ] || [ "$$STATUS" = "204" ]; then + echo "✅ Linked $$PKG to stack" + elif [ "$$STATUS" = "400" ]; then + echo "✅ $$PKG already linked (OK)" else - echo "❌ Warning: ${package} link returned $STATUS" + echo "❌ $$PKG link failed with status $$STATUS" fi - done + } + link_package "stack-api" + link_package "stack-web" + link_package "stack-postgres" + link_package "stack-openbao" + link_package "stack-orchestrator" when: - branch: [main, develop] event: [push, manual, tag]