2 Commits

Author SHA1 Message Date
octoturge 9798b522bd ci: use Gitea's built-in GITEA_TOKEN for registry push, drop manual PAT
Provision Coder Templates / build-images (push) Failing after 6s
Provision Coder Templates / provision (push) Has been cancelled
GITEA_PACKAGE_TOKEN was never a creatable secret name (GITEA_ prefix is
reserved), and Gitea Actions' built-in token can be granted registry
write access directly via `permissions: packages: write` (per
https://docs.gitea.com/usage/actions/token-permissions/) - the
"unauthorized: reqPackageAccess" issue noted earlier looks to have been
exactly this: the default restricted token mode denying package write
unless a job explicitly requests it, not an unfixable bug in the token
itself. Drops the manual-PAT requirement entirely - no secret to create
or maintain.
2026-08-27 01:40:07 +02:00
octoturge f27eb23804 ci: rename registry secret to PACKAGE_REGISTRY_TOKEN, fail loudly if unset
GITEA_PACKAGE_TOKEN was never actually creatable - Gitea Actions reserves
the GITEA_ prefix for its own built-in secrets, so Settings > Actions >
Secrets rejects a repo secret by that name. The workflow referenced a
secret that could never exist, so docker login always got an empty
password and failed with a confusing "interactive login from a non TTY
device" error. Renamed to PACKAGE_REGISTRY_TOKEN, and added an explicit
empty-secret check so a future misconfiguration fails with a clear
message instead of that confusing docker error.
2026-08-27 01:37:19 +02:00
+12 -7
View File
@@ -13,12 +13,12 @@ name: Provision Coder Templates
# CODER_URL e.g. https://code.octoturge.com # CODER_URL e.g. https://code.octoturge.com
# CODER_SESSION_TOKEN a token from `coder tokens create`, ideally under a # CODER_SESSION_TOKEN a token from `coder tokens create`, ideally under a
# dedicated service account rather than a personal one # dedicated service account rather than a personal one
# GITEA_PACKAGE_TOKEN a Gitea access token (user Settings > Applications) #
# with write:package scope, for pushing each # Pushing each Dockerfile-having template's image to this instance's
# Dockerfile-having template's image to this # container registry uses Gitea's own built-in secrets.GITEA_TOKEN (no
# instance's container registry. Only the octoturge # manually-created PAT needed) - build-images grants it write access via
# account's own token is used - docker login below # `permissions: packages: write` below. See
# hardcodes that username to match. # https://docs.gitea.com/usage/actions/token-permissions/
# #
# Any templates/<env>/ that has its own Dockerfile gets its image built and # Any templates/<env>/ that has its own Dockerfile gets its image built and
# pushed here (build-images, on the dedicated "docker-build" runner - see # pushed here (build-images, on the dedicated "docker-build" runner - see
@@ -49,6 +49,11 @@ jobs:
# container.volumes mount for the same path here fails at container # container.volumes mount for the same path here fails at container
# creation with "Duplicate mount point: /var/run/docker.sock". # creation with "Duplicate mount point: /var/run/docker.sock".
runs-on: docker-build runs-on: docker-build
# The default token permission mode denies package write unless a job
# explicitly asks for it - without this, docker push fails with
# "unauthorized: reqPackageAccess".
permissions:
packages: write
outputs: outputs:
failed_templates: ${{ steps.build.outputs.failed_templates }} failed_templates: ${{ steps.build.outputs.failed_templates }}
# docker:27-cli (Alpine) has no bash - only the POSIX /bin/sh (busybox # docker:27-cli (Alpine) has no bash - only the POSIX /bin/sh (busybox
@@ -74,7 +79,7 @@ jobs:
id: build id: build
run: | run: |
set -e set -e
echo "${{ secrets.GITEA_PACKAGE_TOKEN }}" | docker login git.octoturge.com -u octoturge --password-stdin echo "${{ secrets.GITEA_TOKEN }}" | docker login git.octoturge.com -u "${{ github.actor }}" --password-stdin
FAILED="" FAILED=""
for dockerfile in templates/*/Dockerfile; do for dockerfile in templates/*/Dockerfile; do