feat: auto-update kustomize image tag after build (#204) #113
No reviewers
Labels
No labels
domain:backend
domain:devops
domain:frontend
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/westside-app!113
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "204-auto-tag-update"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds a post-build
update-tagstep to the Woodpecker pipeline that automatically updates the kustomize overlay image tag in pal-e-deployments after a successful build-and-push. This is the westside-app pilot for the pattern described in pal-e-platform#204.Changes
.woodpecker.yaml-- addedupdate-tagstep afterbuild-and-pushthat:newTaginoverlays/westsidekingsandqueens/prod/kustomization.yamlto${CI_COMMIT_SHA}alpine/gitimage (same as clone step, known to work in CI)ci_forgejo_tokenWoodpecker secret with push access to pal-e-deploymentsTest Plan
ci_forgejo_tokenWoodpecker secret for westside-app (manual step)newTaginoverlays/westsidekingsandqueens/prod/kustomization.yamlReview Checklist
Related Notes
project-pal-e-platform-- the project this work belongs toQA Review
Scope: 1 file changed, 16 additions, 0 deletions. Adds
update-tagstep to.woodpecker.yaml.Checked
cd /tmp/deploymentspersistence -- Woodpecker concatenates commands into a single shell script, socdpersists across subsequent commands. Correct.sedcommand -- properly quoted for YAML, uses|delimiter to avoid conflicts with path separatorsgit diff --cached --quiet && echo "No tag change" || git commit ...prevents empty commits when tag is unchangedsecrets: [ci_forgejo_token](Woodpecker-native), token referenced via${CI_FORGEJO_TOKEN}env var in push URL. No hardcoded credentials.whenconditions -- matches build-and-push exactly:event: [push, manual],branch: mainalpine/gitmatches clone step, known to work in CIforgejo-http.forgejo.svc.cluster.local:80(no hairpin)deploy: update westsidekingsandqueens image to ${CI_COMMIT_SHA}is clear and grep-friendlyPrerequisites (not blocking PR)
ci_forgejo_tokenWoodpecker secret must be created manually before this step will workforgejo_admin/pal-e-deploymentsNits
None.
VERDICT: APPROVE
PR #113 Review
DOMAIN REVIEW
Tech stack: Woodpecker CI pipeline (YAML), kustomize GitOps pattern, shell scripting.
This PR adds a post-build
update-tagstep to the Woodpecker pipeline that clones pal-e-deployments, updates the kustomizenewTagviased, commits, and pushes. The pattern is sound -- this is the standard "CI updates GitOps repo" approach for ArgoCD-driven deployments.Pipeline structure review:
alpine/git) is consistent with the existing clone step. Good.whenconditions (push/manual on main) match thebuild-and-pushstep. Good.secrets: [ci_forgejo_token]correctly declares the secret dependency so Woodpecker masks it in logs.sedpattern (s|newTag: .*|newTag: ${CI_COMMIT_SHA}|) works correctly for the westsidekingsandqueens overlay, which has exactly onenewTagon line 65 of/home/ldraney/pal-e-deployments/overlays/westsidekingsandqueens/prod/kustomization.yaml.git diff --cached --quiet && echo "No tag change" || git commit ...pattern correctly handles the idempotent case (no change = no commit). The subsequentgit pushwith no new commits is harmless (prints "Everything up-to-date").deploy: update westsidekingsandqueens image to ${CI_COMMIT_SHA}) is descriptive and traceable.BLOCKERS
1. Unauthenticated clone of private repo will fail
The
git clonecommand uses an unauthenticated URL:However,
pal-e-deploymentsis a private repository ("private": truefrom Forgejo API). This clone will fail with a 401/403. The push URL correctly embeds the token (http://woodpecker:${CI_FORGEJO_TOKEN}@...), but the clone URL does not.Fix: Use the authenticated URL for the clone as well:
This is a blocker because the step will fail on every execution.
NITS
sedreplaces ALLnewTaglines -- For the westsidekingsandqueens overlay this is safe (only onenewTagentry). However, other overlays (e.g., pal-e-docs) have multiplenewTagentries for different images. When this pattern is rolled out to other services, thesedcommand will need to be scoped to the correct image block. Worth noting for the rollout plan.git pushruns even when no commit was made -- When the tag is unchanged, no commit is created butgit pushstill executes (harmlessly). A slightly cleaner pattern would exit early:This avoids the unnecessary push roundtrip. Non-blocking since the current behavior is correct.
Token in git URL may leak on push failure -- If the
git pushfails (e.g., force-push protection, network issue), git may print the full URL including the embedded token in the error message. Woodpecker's secret masking mitigates this for CI logs, but consider usinggit remote set-urlwith a named remote instead of inline credentials for defense-in-depth:This is standard practice and also avoids duplicating the URL between clone and push.
SOP COMPLIANCE
204-auto-tag-updatereferences pal-e-platform#204)## Changesheader (changes are described in Summary, but template expects a separate section)project-pal-e-platform)PROCESS OBSERVATIONS
ci_forgejo_tokenWoodpecker secret. The Test Plan correctly calls out the manual secret creation step. Ensure the secret is created before merging to avoid a broken pipeline on the next push to main.sednit above should be tracked for the rollout phase.VERDICT: NOT APPROVED
One blocker: the
git cloneof private repopal-e-deploymentsuses an unauthenticated URL and will fail. Add the token to the clone URL to match the push URL pattern.PR #113 Re-Review
PREVIOUS BLOCKER STATUS
The previous review identified a blocker: unauthenticated
git cloneof the privatepal-e-deploymentsrepo would fail at runtime. Commit99c3ae6was pushed to fix this.Verdict: RESOLVED. The
update-tagstep now usesCI_FORGEJO_TOKENin both thegit clone(line 53) andgit push(line 60) URLs, and declaressecrets: [ci_forgejo_token](line 61) to inject the token. Woodpecker automatically masks declared secrets in log output, so the token embedded in the URLs will not leak.DOMAIN REVIEW
Tech stack: Woodpecker CI pipeline YAML (CI/CD infrastructure).
alpine/gitmatches the existing clone step -- consistent, minimal, known to work in this cluster.overlays/westsidekingsandqueens/prod/kustomization.yamlexists inpal-e-deploymentsand containsnewTag: <sha>on line 65. Thesedpattern's|newTag: .*|newTag: ${CI_COMMIT_SHA}|'correctly matches and replaces.git diff --cached --quiet && echo "No tag change" || git commit -m ...properly handles idempotency (re-runs with same SHA will not create empty commits).event: [push, manual]+branch: mainmatches thebuild-and-pushstep -- the update-tag step only fires after a successful build.git pushwould fail (non-fast-forward). The pipeline would fail and need re-trigger. This is acceptable for a pilot and matches standard GitOps CI patterns.secretsdirective, never hardcoded. Theci_forgejo_tokensecret must be created manually per the test plan.BLOCKERS
None. The previous blocker (unauthenticated clone) is resolved.
NITS
DRY: Forgejo internal URL repeated twice -- The URL
http://woodpecker:${CI_FORGEJO_TOKEN}@forgejo-http.forgejo.svc.cluster.local:80/forgejo_admin/pal-e-deployments.gitappears in both the clone and push commands (lines 53, 60). Consider extracting to an environment variable at the step level for maintainability when this pattern rolls out to other repos. Non-blocking for a pilot.No retry on push failure -- As noted in the domain review, concurrent pushes to main could cause a non-fast-forward rejection. A
git pull --rebase && git pushretry would make this more robust. Acceptable for pilot scope.SOP COMPLIANCE
204-auto-tag-updatereferences pal-e-platform#204)project-pal-e-platform).woodpecker.yaml, +16 lines)PROCESS OBSERVATIONS
ci_forgejo_tokenWoodpecker secret to be created before merge. Test plan correctly captures this as a manual prerequisite.VERDICT: APPROVED
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.