fix(ci): authenticate PlantUML release lookup and fail on unresolved versions - #130
Draft
GordonBeeming wants to merge 1 commit into
Draft
fix(ci): authenticate PlantUML release lookup and fail on unresolved versions#130GordonBeeming wants to merge 1 commit into
GordonBeeming wants to merge 1 commit into
Conversation
…versions Build #723 failed the java image with a 404 fetching .../releases/download//plantuml-.jar. The empty path segments came from prepare-versions: the anonymous api.github.com call for the PlantUML latest release was rate-limited (403, 60/hour shared per runner IP), so PLANTUML_TAG resolved to an empty string and the next echo built a malformed URL anyway. The failure was silent because `curl -fsSL ... | jq` takes its exit status from jq, so the step's `bash -e` never aborted. Every version lookup in the step shares that shape. - Send the repo GITHUB_TOKEN on the api.github.com call, raising the limit from 60/hour per IP to 1000/hour per repo. - Add `set -euo pipefail` plus fetch/require helpers so a failed download or an empty/null value fails the step at the lookup instead of building a broken URL for the image build to trip over. - Replace `curl | head -1` for the Go version with a parameter expansion; under pipefail the early pipe close could fail the command. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016Dsw1e9DPk8V5WoPf8MmPo
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What broke
Build #723 failed in the Build java job:
Note the empty path segments:
download//plantuml-.jar. The version was missing, not wrong.Root cause
It starts one job earlier, in
prepare-versions. That job's log has a single unexplained line:…and the job still reported success.
The 403 came from the anonymous PlantUML release lookup:
Two things combined:
api.github.comallows 60 requests/hour, counted per source IP and shared across every job on that runner. Hosted runners exhaust it routinely, which is why this is intermittent — #722 passed on this exact commit.curl -fsSL … | jqtakes its exit status fromjq, notcurl, so the step'sbash -enever aborted.PLANTUML_TAGbecame empty and the very nextechobuilt the malformed URL regardless, handing a guaranteed-404 build arg to the java image.So a transient API hiccup was converted into a hard image-build failure four minutes later, with the real cause buried in a different job's log.
Every other lookup in that step has the same
curl | jqshape and the same silent-empty-string failure mode.Changes
.github/workflows/publish.yml,prepare-versionsjob only:GITHUB_TOKEN, raising the limit from 60/hour per IP to 1,000/hour per repo.set -euo pipefailandfetch/requirehelpers so a failed download, or a value that comes back empty ornull, fails the step where the lookup happens with a named::error::, instead of silently emitting a broken URL. Applied to all lookups in the step, not just PlantUML.curl 'https://go.dev/VERSION?m=text' | head -1with a parameter expansion.head -1closes the pipe after the first of two lines, which underpipefailwould fail the command.No Dockerfiles changed, so no regeneration is needed.
Trade-off
An unresolvable version now fails the build rather than proceeding. That's deliberate: the alternative is publishing an image built from a broken or silently stale URL. With the call authenticated, a 403 here should be very unlikely.
Testing
prepare-versionsis gated onif: github.ref == 'refs/heads/main', so on apull_requestevent it and every dependent image build are skipped. Run #724 is green withPrepare Versions,Build ${{ matrix.image }}andBuild Proxy Imageall skipped.So the step was run directly against the real endpoints instead. Every other lookup resolves correctly under the new
set -euo pipefail, confirming no regression from that change:The PlantUML call then hit a real 403, and the new code behaved as intended:
That is the fix demonstrated end to end: the same 403 that silently produced
download//plantuml-.jarin #723 now stops the step with a named error.Also verified in isolation:
tag_name: null→ aborts with::error::could not resolve plantuml_tagplantuml-1.2025.4.jar, correctlyv-strippedbash -ereproducesdownload//plantuml-.jarexactly, confirming the diagnosisrequirebash -nand a YAML parse both passStill unverified: the success path of the authenticated API call, which needs a real
GITHUB_TOKENand network access toapi.github.com. That will first be exercised by the next scheduled/mainrun after merge.