build(docker): make e-dant/watcher install robust#2432
Merged
Conversation
The watcher install step fetches the latest release tarball URL from
the GitHub API, then pipes the response through grep/awk/sed/xargs
into curl and tar. When the API returns anything that does not include
a tarball_url (rate limit response, 5xx, auth error), the pipeline
silently produces an empty URL and dies with the opaque pair:
curl: (2) no URL specified
tar: Child returned status 1
Two converging issues caused this in CI:
1. .github/workflows/docker.yaml's bake step did not export
GITHUB_TOKEN to the bake-action environment, so the secret mount
in docker-bake.hcl resolved to empty and the API call ran
unauthenticated. With the 60 req/hr unauth cap, parallel matrix
jobs are easy to rate-limit. static.yaml's equivalent bake step
already passes the token; docker.yaml was the outlier.
2. The Dockerfile pipeline used `curl -s` (no -f, no error surfacing)
and parsed JSON with grep+awk+sed. Any non-success response sent
the build down the same opaque tar/curl error path with no clue as
to why.
Pass GITHUB_TOKEN to the bake step, install jq in both Dockerfile and
alpine.Dockerfile, and rewrite the install with `curl -fsSL` plus
explicit empty-URL detection so failures surface a clear message
instead of a phantom curl/tar error.
Failing run that prompted this: #2430 amd64 job 76318473755
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes silent failures in the Docker image build when installing e-dant/watcher. Two converging issues caused opaque curl: (2) no URL specified / tar: Child returned status 1 errors: the bake-action was not receiving GITHUB_TOKEN (so the install hit GitHub's unauthenticated rate limit), and the install pipeline used curl -s plus a grep|awk|sed chain that silently produced an empty URL on any non-release API response.
Changes:
- Pass
GITHUB_TOKENto the bake Build step indocker.yamlso theid=github-tokensecret mount actually resolves. - Rewrite the watcher install in both
Dockerfileandalpine.Dockerfileas a POSIX heredoc usingcurl -fsSL,jq -r '.tarball_url // empty', and an explicit empty-URL guard with a diagnostic message. - Add
jqto the build-deps in both Dockerfiles.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
.github/workflows/docker.yaml |
Adds GITHUB_TOKEN to the bake step env so the id=github-token secret mount is populated. |
Dockerfile |
Installs jq; replaces fragile grep/awk/sed/xargs pipeline with curl -fsSL + jq + empty-URL check in a heredoc; preserves cmake flags and ldconfig. |
alpine.Dockerfile |
Same fix as Dockerfile, adapted for Alpine (apk add jq, no ldconfig). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
editorconfig-checker flagged the heredoc body as space-indented; the project's .editorconfig requires tabs for *.Dockerfile and Dockerfile already uses tabs everywhere else.
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.
Root cause
runner-php-8-3-31-trixieon https://github.com/php/frankenphp/actions/runs/25961840516/job/76318473755 (PR #2430,linux/amd64) failed with:Two converging issues:
.github/workflows/docker.yamldid not exportGITHUB_TOKENto the bake-action environment.docker-bake.hcldeclaressecret = [\"id=github-token,env=GITHUB_TOKEN\"], but the Build step'senv:block only setSHA,VERSION,PHP_VERSION,BASE_FINGERPRINT. The secret mount resolved to empty, the watcher install fell into the unauthenticated branch, and parallel matrix jobs trivially hit GitHub's 60 req/hr unauth cap.static.yaml's bake step already passesGITHUB_TOKEN;docker.yamlwas the outlier.The watcher install pipeline silently swallows API errors.
curl -s(no-f) hides HTTP errors;grep tarball_url | awk | sed | xargs curl -L | tar xzproduces empty output when the API response is anything other than a normal release JSON (rate limit message, 5xx, auth fail).xargs curl -Lthen runs with no URL, andtar xzgets empty stdin — yielding the opaque pair above with no signal as to why.Fix
docker.yaml: passGITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}to the bake Build step's env block (mirrorsstatic.yaml).Dockerfileandalpine.Dockerfile: installjq, rewrite the watcher install withcurl -fsSLplusjq -r '.tarball_url // empty'and an explicit empty-URL check that prints a useful error. Heredoc form for readability; logic kept POSIX so it works under bothbash(Debian) andash(Alpine).Cmake/build flags and final
ldconfigstep are unchanged.