Skip to content

fix(trigger-coolify-deploy): accept nanoid-style deployment_uuid - #11

Merged
Andreas-Garcia merged 5 commits into
mainfrom
fix/coolify-deployment-uuid-format
Sep 2, 2026
Merged

Andreas-Garcia merged 5 commits into
mainfrom
fix/coolify-deployment-uuid-format

Conversation

@Andreas-Garcia

Copy link
Copy Markdown
Member

Summary

  • Coolify's /api/v1/deployments/applications/{uuid} endpoint now returns nanoid-style deployment_uuid values (e.g. j9rlp1cg3qdsuqi8sqsvykpo) instead of canonical UUIDs.
  • The format-validation regex in cancel_phantom_builds() only matched UUIDs, so it warned and skipped every phantom native build detected — meaning the build was never actually cancelled/stopped.
  • Confirmed in production on the-music-deck-admin PR #208: both preview deploys logged WARNING: unexpected deployment_uuid format ... skipping, then sat queued/in_progress until timing out at 1800s because the uncancelled native build occupied the VPS's single build slot. This is the exact regression PR #144's fix was meant to prevent.
  • Widened the regex to accept both the legacy UUID format and a bounded [0-9a-z]{20,30} nanoid-style id, preserving the shape check since this value is interpolated into a Coolify API URL and an ssh ... docker stop command.
  • Audited the rest of the action for other UUID-shape assumptions on deployment_uuid/phantom_uuid — none found.
  • Added a standalone regression test (tests/deployment_uuid_format.sh) covering UUID, nanoid, and rejected garbage/length-boundary cases, wired into a new test-actions.yml CI workflow.

Follow-up

  • No test harness previously existed for this action's shell logic; this PR adds a minimal one, not a full framework — flag if a heavier setup (bats, etc.) is preferred going forward.
  • After merge, cut a new version tag (repo is currently at v4.3.0) since consumers pin uses: to tags — a fix on main alone won't reach them until they bump.

Test plan

  • Ran tests/deployment_uuid_format.sh locally — all 9 cases pass
  • CI (test-actions.yml) passes on this PR
  • Actionlint passes

🤖 Generated with Claude Code

https://claude.ai/code/session_01LzDQzX3Uqv3qChoZyXx5hv

Coolify's deployments API now returns nanoid-style ids (e.g.
j9rlp1cg3qdsuqi8sqsvykpo) instead of canonical UUIDs for
deployment_uuid. The format-validation regex in
cancel_phantom_builds() only accepted UUIDs, so it warned and
skipped every phantom build, leaving the still-running native
build uncancelled and occupying the VPS's single build slot —
the exact failure mode PR #144's fix was meant to prevent
(confirmed in the-music-deck-admin PR #208 logs, both preview
deploys timed out at 1800s).

Widen the regex to accept both formats, bounded to 20-30
alphanumeric chars to preserve the shape check before the value
is interpolated into a Coolify API URL and an SSH docker stop
command. Add a standalone regression test for the regex plus a
CI workflow to run it.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LzDQzX3Uqv3qChoZyXx5hv
Copilot AI lite review requested due to automatic review settings September 2, 2026 15:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The current grep-based validation can be line-bypassed via newlines; switching to a bash-regex whole-string match (and aligning the test) is needed before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates the trigger-coolify-deploy composite action to correctly handle Coolify’s newer nanoid-style deployment_uuid values so phantom native builds can be detected and cancelled again, and adds a small CI-backed regression test to prevent reintroducing the UUID-only assumption.

Changes:

  • Broadened the deployment_uuid/phantom_uuid format validation to accept both legacy UUIDs and bounded nanoid-style IDs.
  • Added a standalone shell regression test script covering accept/reject cases for the ID format.
  • Introduced a new GitHub Actions workflow to run the shell test on PRs and pushes.
File summaries
File Description
.github/workflows/test-actions.yml Adds a CI job to run the new shell regression test.
.github/actions/trigger-coolify-deploy/tests/deployment_uuid_format.sh Adds a regression test suite for the deployment UUID shape validation.
.github/actions/trigger-coolify-deploy/action.yml Expands the ID validation regex used before interpolating into URL/SSH commands.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/actions/trigger-coolify-deploy/action.yml Outdated
Comment thread .github/actions/trigger-coolify-deploy/tests/deployment_uuid_format.sh Outdated
Andreas-Garcia and others added 2 commits September 2, 2026 17:06
grep -qiE matches per-line, so a newline embedded in phantom_uuid
could let a later line slip past the ^...$ anchors even though the
value is interpolated into a Coolify API URL and an SSH docker stop
command. Switch to bash's [[ =~ ]] so the anchors apply to the whole
string.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LzDQzX3Uqv3qChoZyXx5hv
Use bash's [[ =~ ]] instead of grep -qiE to match the fix in
action.yml, and declare `actual` local so the test function stays
self-contained under set -u.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LzDQzX3Uqv3qChoZyXx5hv
Copilot AI review requested due to automatic review settings September 2, 2026 15:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new CI workflow may fail depending on the test script’s executable bit, and the updated logging/comment text in cancel_phantom_builds() is inconsistent with the actual variable being validated.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 3
  • Review effort level: Lite

Comment thread .github/workflows/test-actions.yml Outdated
Comment thread .github/actions/trigger-coolify-deploy/action.yml Outdated
Comment thread .github/actions/trigger-coolify-deploy/action.yml Outdated
Andreas-Garcia and others added 2 commits September 2, 2026 17:10
Running it as a bare file path depends on the executable bit surviving
checkout; invoking via bash is robust regardless of file mode.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LzDQzX3Uqv3qChoZyXx5hv
…uid, in comment/log

The comment and warning message named deployment_uuid, but the
variable actually being validated and logged is phantom_uuid —
fix the naming to avoid confusion when debugging cancellations.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LzDQzX3Uqv3qChoZyXx5hv
Copilot AI review requested due to automatic review settings September 2, 2026 15:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is narrowly scoped, uses a stricter whole-string bash regex check, and includes CI-backed regression coverage for the updated ID validation behavior.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@Andreas-Garcia
Andreas-Garcia merged commit e390aff into main Sep 2, 2026
2 checks passed
@Andreas-Garcia
Andreas-Garcia deleted the fix/coolify-deployment-uuid-format branch September 2, 2026 15:22
Andreas-Garcia added a commit that referenced this pull request Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants