Skip to content

ci: publish packages through environments, PR images to console-dev, pin actions - #134

Open
Gkrumbach07 wants to merge 1 commit into
mainfrom
ci/publish-environments
Open

Gkrumbach07 wants to merge 1 commit into
mainfrom
ci/publish-environments

Conversation

@Gkrumbach07

@Gkrumbach07 Gkrumbach07 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Follows #133, which is merged. Rebased onto main.

Why

Simon (infra) is setting up publishing so that no job writes a package with the workflow's own token, before the packages go public. This PR is the console side of that.

What changes

Releases publish through the release environment

  • That environment admits only main and release/**, and holds GHCR_TOKEN, which can write to ghcr.io/ai-openshell/console and its chart.
  • Jobs that log in with it:
    • in ci.yml, on a push: build, push-manifest, promote-latest, publish-dev-chart
    • in publish.yml: tag-image, publish-chart
  • No job asks for packages: write any more. image-range still reads with the workflow token.

A pull request publishes nothing to console

  • build still builds both platforms on a PR, but pushes nothing and writes no build cache: cache-to only runs on a push.
  • build uses the environment only on a push (environment: ${{ github.event_name == 'push' && 'release' || '' }}), so a PR run has no environment and can't reach the token, even if it edits the workflow.

PR images go to console-dev, after approval

  • A new pr-image job runs in the pr-images environment. That environment's GHCR_TOKEN can write to ghcr.io/ai-openshell/console-dev only.
  • It runs only for PRs from a branch of this repo, waits for a maintainer to approve, then pushes console-dev:pr-<n> and :sha-<7> for linux/amd64.
  • It runs on plain pull_request, not pull_request_target, as Simon asked, and only reads the cache. Fork PRs get no image, as intended.

Every action in ci.yml is pinned by commit SHA, like publish.yml and follow-upstream.yml.

Tests now enforce all of this: no packages: write anywhere, the exact list of jobs that hold GHCR_TOKEN and their environments, no cache written from a PR, the pr-image rules, and SHA pinning across ci.yml and publish.yml. docs/releasing.md has a new "Who can write the packages" section.

Testing

  • python3 -m unittest discover -s deploy/ci/upstream: 277 pass
  • node --test "scripts/**/*.test.mjs": 88 pass
  • YAML parse of all workflows

Not tested live yet:

  • This PR's own CI checks one thing. A PR run uses the empty-environment case (environment: ''), which I'm relying on to mean "no environment". If GitHub treats it differently, it shows up here first.
  • The push path can only be checked after merge, once the environments exist.

Needs from infra before merge

Names assumed. Tell me if Simon's differ; each is one place to change:

  • Environment release, with deployment branches main and release/**, and secret GHCR_TOKEN.
  • Environment pr-images, with required reviewers (maintainers), and secret GHCR_TOKEN (write on console-dev only).
  • Optional variable GHCR_USERNAME in each, if the token needs a specific user name. Otherwise the run's actor is used.

After merge (infra)

  • The repo's own Actions access to the packages becomes read-only.
  • console, the chart and console-dev are made public, after the old pr-* images are deleted from console.

🤖 Generated with Claude Code

Base automatically changed from chore/simplify-upstream-following to main November 10, 2026 20:16
…pin actions

The organization's infra team (Simon) is setting up two environments, so
that no job writes a package with the workflow's own token:

- `release` (main and release/** only) holds GHCR_TOKEN, which can write
  to ghcr.io/ai-openshell/console and its chart. ci.yml's build (on a
  push), push-manifest, promote-latest and publish-dev-chart, and
  publish.yml's tag-image and publish-chart, log in with it. No job asks
  for packages: write any more.
- `pr-images` (approved by a maintainer) holds a GHCR_TOKEN that can write
  to ghcr.io/ai-openshell/console-dev only. A new pr-image job builds
  console-dev:pr-<n> and :sha-<7> (linux/amd64) for a pull request from a
  branch of this repository, after approval. It runs on pull_request, never
  pull_request_target, and only reads the build cache.
- A pull request no longer pushes anything to console, and writes no build
  cache: cache-to is for pushes only.
- Every action in ci.yml is pinned by commit SHA, as publish.yml and
  follow-upstream.yml are. Tests hold all of it in place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Gage Krumbach <gkrumbac@redhat.com>

This branch had an error being deployed

1 failed deployment
pr-images — 9f2128d4 Deployed Nov 10, 2026 by Gkrumbach07 via pr-image #361
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