fix: add retry loop to CI wget for update-kustomize-tag #216
No reviewers
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/basketball-api!216
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "230-ci-wget-retry"
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
BusyBox wget has no built-in retry flags. Transient forgejo-http connection failures cause the kustomize tag update step to fail silently. This wraps the wget call in a 5-attempt retry loop with 5s backoff and a fatal exit if all attempts fail.
Changes
.woodpecker.yaml: Replaced barewgetcall inupdate-kustomize-tagstep with a retry loop (5 attempts, 5s sleep between retries, fatal on total failure)Test Plan
python3 -c "import yaml; yaml.safe_load(open('.woodpecker.yaml'))"update-kustomize-tagstep succeedsRelated
🤖 Generated with Claude Code
PR #216 Review
DOMAIN REVIEW
Tech stack: Woodpecker CI YAML (shell scripting, YAML block scalars, Woodpecker variable substitution)
YAML block scalar analysis -- This is the core issue. The PR changes the
update-kustomize-tagstep from a barewgetto a retry loop but keeps the>-(folded block scalar) from the original. This worked before because all lines (wget,--header, URL) were at the same base indentation and>-folded them into a single line. The new code introduces aforloop, pushing thewgetand its arguments to a deeper indentation level (10 spaces vs 8 spaces base). Under YAML>-rules, lines more-indented than the first content line have their newlines preserved, not folded. This means the shell receives:The wget command and its
--header/URL arguments are on separate shell lines with no backslash continuations. The shell executeswget -O /tmp/update-kustomize-tag.shalone (which likely errors or downloads nothing), then tries to run--header="..."as a standalone command (fails). The&& breaknever fires because it's chained to the URL line, not wget's exit code.Cross-repo comparison: Both
westside-app/.woodpecker.yaml(line 58) andpal-e-app/.woodpecker.yaml(line 89) implement the identical retry pattern but use|(literal block scalar) with\backslash continuations on the wget arguments. That is the correct approach.$$escaping: The change from${FORGEJO_TOKEN}to$${FORGEJO_TOKEN}is correct. Woodpecker interprets single-$expressions as its own substitution;$$passes a literal$to the shell, which then reads the environment variable injected viafrom_secret. The original single-$was a latent bug (worked because Woodpecker passes through unknown variable names). Same applies to$$iin the echo statement.BLOCKERS
1.
>-folded scalar breaks multi-line wget command -- As detailed above, the>-block scalar preserves newlines for the more-indented lines inside theforloop body, causing the wget command to be split across multiple shell lines without continuations. This will cause the step to fail on every run.Fix: Change
>-to|and add\backslash continuations on the wget--headerand URL lines. Reference the working pattern in/home/ldraney/westside-app/.woodpecker.yaml(lines 58-68) or/home/ldraney/pal-e-app/.woodpecker.yaml(lines 89-97).NITS
1.
test -fvstest -s-- The guard usestest -f(file exists) buttest -s(file exists AND non-empty) is safer. A zero-byte download (e.g., HTTP 200 with empty body on a transient error) would passtest -fbut failtest -s. Thepal-e-appversion already usestest -s. Thewestside-appversion also usestest -f(same gap). Consider adoptingtest -shere as the stronger check.2. DRY observation -- This retry-loop-plus-wget pattern is now copy-pasted across three repos (
basketball-api,westside-app,pal-e-app) with minor divergences (>-vs|,test -fvstest -s, auth header vs no auth). Not a blocker for this PR, but the pattern is ripe for extraction into a shared wrapper script or Woodpecker plugin.SOP COMPLIANCE
230-ci-wget-retrymatchespal-e-platform#230forgejo_admin/pal-e-platform#230)from_secret)PROCESS OBSERVATIONS
>-scalar issue means this PR would break the kustomize tag update step on every pipeline run, preventing ArgoCD deployments. The fix is straightforward (change to|+ add\continuations).yaml.safe_load()validation, but YAML parse validation only checks syntax -- it cannot catch the semantic issue where>-produces a different string than intended. Shell-level validation (e.g.,shellcheckor manual inspection of the folded output) would be needed.VERDICT: NOT APPROVED
The
>-folded block scalar will break the wget command by preserving newlines inside the for-loop body. Change to|with backslash continuations on the wget arguments, matching the proven pattern inwestside-appandpal-e-app. Thetest -ftotest -supgrade is a nit.PR #216 Review (Re-review after fix commit)
DOMAIN REVIEW
Tech stack: Woodpecker CI YAML (shell scripting in BusyBox alpine/git container).
Previous rejection raised two issues:
>-(folded block scalar) collapsed the for-loop into a single line, breaking the shell syntax.test -fonly checks file existence, not content;test -sis needed to catch zero-byte downloads.Fix verification -- both resolved:
|(literal), preserving newlines. The for-loop, wget with backslash continuations, and test guard all render correctly as multi-line shell. FIXED.test -s(exists AND non-empty), catching both missing-file and empty-file failure modes. FIXED.Additional code review:
$$iand$${FORGEJO_TOKEN}correctly use Woodpecker double-dollar escaping to prevent variable interpolation at YAML parse time.&& breakon success) is sound. All exit paths covered: success breaks loop, total failure hitstest -sguard withexit 1.from_secret: forgejo_token-- no hardcoded credentials.|block andsh /tmp/update-kustomize-tag.share separate YAML list entries undercommands:, so step failure on the download block correctly prevents script execution..woodpecker.yamlchanged (1 file, +10/-4 lines). No scope creep.BLOCKERS
None. Previous blockers resolved.
NITS
None.
SOP COMPLIANCE
230-ci-wget-retryreferences pal-e-platform#230)PROCESS OBSERVATIONS
Cross-repo fix pattern: issue lives on pal-e-platform (#230), code change on basketball-api. This is the first consumer repo getting the retry wrapper around the shared
update-kustomize-tag.shdownload step. Issue #206 (pal-e-platform) tracks rollout to all 8 app repos -- once this PR validates, the pattern can be replicated. Good MTTR improvement for transient network failures in CI.VERDICT: APPROVED