Skip to content

feat(ci): authenticated GHCR probe and opt-in private-image credentials - #925

Merged
c-vigo merged 2 commits into
devfrom
feature/920-private-image-ci
Jul 8, 2026
Merged

c-vigo merged 2 commits into
devfrom
feature/920-private-image-ci

Conversation

@c-vigo

@c-vigo c-vigo commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Closes #920

Split out from the shipped-CI audit (#854, audit item 8) and rides the devkit rename cycle (#781). The shipped container-based CI assumed ghcr.io/vig-os/devcontainer was public and unauthenticated; this adds first-class support for private / rate-limited (authenticated) GHCR pulls without breaking public consumers.

What changed

1. Authenticated probe in resolve-image (.github/actions/resolve-image/action.yml, SSoT; mirror under assets/workspace/ regenerated by sync-manifest)

  • New optional inputs registry-token / registry-username (default '').
  • When a token is supplied, docker login ghcr.io runs before the manifest probe; the anonymous path is kept for public images.
  • The probe no longer swallows stderr. On failure it is captured and classified into an actionable ::error:: that distinguishes an auth/denied failure (set GHCR_PULL_TOKEN / grant packages: read) from a genuinely missing tag. The tag-resolution step is untouched.

2. Opt-in credentials on shipped container jobs
Every shipped workflow job that declares container: { image: … } gets:

credentials:
  username: ${{ github.actor }}
  password: ${{ secrets.GHCR_PULL_TOKEN || github.token }}

plus packages: read (added at workflow level where jobs inherit, or in the job's own permissions: block otherwise — no existing permission removed). Every resolve-image caller passes registry-token: ${{ secrets.GHCR_PULL_TOKEN || github.token }} and registry-username: ${{ github.actor }}.

Jobs that received a credentials: block (16):

  • ci.yml: lint, test
  • renovate-changelog-build.yml: build (root SSoT + mirror)
  • release.yml: rollback
  • release-core.yml: validate, finalize, test
  • release-publish.yml: publish
  • prepare-release.yml: prepare
  • promote-release.yml: validate, promote, merge, cleanup
  • sync-main-to-dev.yml: check, sync
  • sync-issues.yml: sync

3. Docs — assets/workspace/docs/container-ci-quirks.md re-framed from a "public-image limitation" note into first-class authenticated-pull documentation (the GHCR_PULL_TOKEN secret contract, the github.token fallback, and the packages: read requirement).

Public-consumer safety

The change is opt-in and non-breaking. With GHCR_PULL_TOKEN unset, ${{ secrets.GHCR_PULL_TOKEN || github.token }} falls back to the automatic GITHUB_TOKEN — never an empty password — and an authenticated pull of a public image with GITHUB_TOKEN succeeds. packages: read is what lets that automatic token read the package. Private-image consumers set GHCR_PULL_TOKEN (or rely on an automatic token with org package access) and the same expression authenticates the pull.

Verification

  • New tests/test_resolve_image_probe.py extracts the probe step's real bash body and drives it against a stubbed docker, asserting: quiet success (anonymous), login runs only when a token is present, denied→auth ::error::, missing→missing-tag ::error::, and failed-login→auth ::error::. test_resolve_image_probe.py + existing test_resolve_image_manifest.py: 7 passed.
  • tests/test_install_script.py: 23 passed (scaffolded-workspace file checks unaffected).
  • Full hook suite just precommit (prek run --all-files) green for both the assets/workspace and root hook sets — including check-yaml, yamllint, check-action-pins, sync-manifest (mirror parity), generate-docs, shellcheck. No actionlint hook is wired in this repo; YAML validity is enforced by check-yaml + yamllint, and all 12 changed YAML files parse.

Changelog

Added under ## Unreleased → ### Added in CHANGELOG.md (root SSoT; the .devcontainer/CHANGELOG.md mirror is regenerated by the sync-manifest hook), cross-linking #854.

c-vigo added 2 commits July 8, 2026 10:08
The shipped container CI assumed ghcr.io/vig-os/devcontainer was public and
unauthenticated. Add first-class support for private / rate-limited pulls:

- resolve-image action gains optional registry-token/registry-username inputs,
  logs in to ghcr.io before the manifest probe when a token is given, and no
  longer swallows the probe stderr; failures are classified into actionable
  ::error:: annotations distinguishing auth/denied from a missing tag.
- Every shipped container job gets an opt-in credentials: block
  (github.actor + secrets.GHCR_PULL_TOKEN || github.token) and packages: read;
  resolve-image callers pass the same token/username to the action.
- Public consumers are unaffected: with GHCR_PULL_TOKEN unset the fallback is
  github.token (never an empty password), which authenticates a public pull.
- container-ci-quirks.md re-framed from a public-image limitation into
  first-class authenticated-pull docs; probe auth-branch bats-style pytest added.

Refs: #920, #854, #781
@c-vigo
c-vigo merged commit b0649e7 into dev Jul 8, 2026
13 checks passed
@c-vigo
c-vigo deleted the feature/920-private-image-ci branch July 8, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant