Compare commits

...

2 commits

Author SHA1 Message Date
62ba381d06 Merge pull request 'build-push: drop the empty ${{ }} that silenced the registry login' (#155) from fix/build-push-empty-expression into dev
All checks were successful
secrets-guard / encrypted (push) Successful in 5s
PR build (required check) / changes (pull_request) Successful in 7s
secrets-guard / encrypted (pull_request) Successful in 5s
shell-lint / shellcheck (pull_request) Successful in 7s
shell-lint / shellcheck (push) Successful in 19s
PR build (required check) / validate-observability (pull_request) Successful in 19s
PR build (required check) / build-frontend (pull_request) Successful in 23s
PR build (required check) / build-backend (pull_request) Successful in 44s
PR build (required check) / gate (pull_request) Successful in 1s
2026-08-01 18:18:45 +00:00
Emi Griffith
5f7075e2cf build-push: drop the empty ${{ }} that silenced the registry login
All checks were successful
secrets-guard / encrypted (pull_request) Successful in 5s
shell-lint / shellcheck (pull_request) Successful in 7s
PR build (required check) / changes (pull_request) Successful in 16s
PR build (required check) / build-backend (pull_request) Has been skipped
PR build (required check) / validate-observability (pull_request) Has been skipped
PR build (required check) / build-frontend (pull_request) Has been skipped
PR build (required check) / gate (pull_request) Successful in 1s
Forgejo evaluates ${{ }} expressions inside a step's `run:` script, comments
included. An EMPTY expression is a parse error, and the runner's response is to
drop the step -- no log line, no error, no failed status. The login step simply
never ran, so every subsequent `docker push` went out anonymous.

The registry then answers `unauthorized: reqPackageAccess` (or, depending on
the client path, `no basic auth credentials`), which reads exactly like a
revoked token or a missing scope. It is neither. Both are downstream of a
comment.

Isolated on one branch, one variable, back to back:

  * empty expression present -> both legs fail, no `Login Succeeded` in the log
  * empty expression removed -> both legs pass, `Login Succeeded` present,
    sha-df409f88b3fd published for backend and frontend

Nothing was wrong with the credential. The token, its scope and whether it sat
at repo or organization level were all ruled out first: pushes to
jinemi/thermograph/* succeed by hand from vps1 and from the runner host, with
matching and mismatched usernames, and the run log shows REGISTRY_TOKEN
arriving in the job environment.

Do not write a bare ${{ }} in a run block, in a comment or otherwise.
2026-08-01 11:17:48 -07:00

View file

@ -131,7 +131,7 @@ jobs:
# credential that was in fact valid. Strip first, echo never.
#
# The token also goes through the ENVIRONMENT rather than being
# interpolated into the script text. `${{ }}` is substituted before bash
# interpolated into the script text. An expression is substituted before bash
# parses the line, so a value containing a quote or newline would change
# the shape of the command itself rather than just its arguments.
tok=$(printf '%s' "$REGISTRY_TOKEN" | tr -d ' \t\r\n')