ci: log in with a write:package PAT called REGISTRY_TOKEN
Run 1364 got as far as building and naming the image, then every blob upload 401'd with 'unauthorized: reqPackageAccess'. Forgejo's container routes run reqPackageAccess(Write), which checks the login token's own scope list for write:package and rejects a scoped token without it — the token only has to be scoped, since an unscoped token skips the check. The repo's FORGEJO_TOKEN secret is such a scoped token. FORGEJO_/GITHUB_ are reserved secret prefixes, so that name cannot be created or updated through the API; the workflow now reads REGISTRY_TOKEN instead.
This commit is contained in:
parent
005d271175
commit
88b95f6a95
1 changed files with 11 additions and 4 deletions
|
|
@ -144,12 +144,19 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
# GITHUB_TOKEN login "succeeds" but blob uploads 401 (Forgejo packages
|
# GITHUB_TOKEN login "succeeds" but blob uploads 401 (Forgejo packages
|
||||||
# reject the Actions token). Use a user PAT with write:package.
|
# reject the Actions token). Use a user PAT.
|
||||||
if [ -z "${{ secrets.FORGEJO_TOKEN }}" ]; then
|
# The PAT must carry the `write:package` scope: Forgejo mints a push
|
||||||
echo "Missing repo secret FORGEJO_TOKEN (user PAT, not GITHUB_TOKEN)"
|
# token even without it and then rejects every blob upload with
|
||||||
|
# `unauthorized: reqPackageAccess` (routers/api/packages/api.go
|
||||||
|
# reqPackageAccess -> AccessTokenScopeWritePackage).
|
||||||
|
# Name is REGISTRY_TOKEN, not FORGEJO_TOKEN: Forgejo reserves the
|
||||||
|
# FORGEJO_/GITHUB_ prefixes and refuses to create or update them via
|
||||||
|
# the API.
|
||||||
|
if [ -z "${{ secrets.REGISTRY_TOKEN }}" ]; then
|
||||||
|
echo "Missing repo secret REGISTRY_TOKEN (user PAT with write:package, not GITHUB_TOKEN)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "${{ secrets.FORGEJO_TOKEN }}" | docker login "${{ steps.img.outputs.reg }}" \
|
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "${{ steps.img.outputs.reg }}" \
|
||||||
-u sirius --password-stdin
|
-u sirius --password-stdin
|
||||||
|
|
||||||
- name: Build application image (api / ingester / cameras)
|
- name: Build application image (api / ingester / cameras)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue