Skip to content

ci: fail the publish job when the Tier 2 image is not public - #5523

Merged
zackees merged 2 commits into
masterfrom
fix/ghcr-public-verify
Nov 23, 2026
Merged

zackees merged 2 commits into
masterfrom
fix/ghcr-public-verify

Conversation

@zackees

@zackees zackees commented Nov 23, 2026

Copy link
Copy Markdown
Member

Short answer: nothing stops it. Oversight, confirmed in the code.

ci/tier2_image.py opens with:

The package must be PUBLIC: anonymous probes and Docker pulls need no credentials, including on forks.

…and the image is nothing but ubuntu:26.04 plus 85 Ubuntu packages (rust/tools/linux-validate/apt-packages.txt) and six bootstrap packages (git ca-certificates curl sudo zstd eatmydata), all installed from the public Ubuntu archive. No OBS source, no credentials, no private toolchain. The Dockerfile and both package lists are already in this public repo, so the image leaks nothing that isn't already public.

What actually went wrong

  1. A GHCR package created by a workflow is private by default, and switching it is a manual org-settings action.
  2. publish() only printed Published {tag}; ensure the GHCR package visibility is public and carried on.
  3. select_image() treats every probe error as "no image" and silently returns stock Ubuntu.

So the flip was never done, nothing failed, and prebaked=false has appeared on every run since the image was introduced — including the whole pool era.

This PR

Adds ci/tier2_image.py verify, which probes the identity tag anonymously and fails with the exact setting to change:

ghcr.io/obs-rust/tier2-linux:fd8a2056… is not anonymously readable (HTTP 401): the
package is private. Anonymous probes and Docker pulls need no credentials, so make
https://github.com/orgs/obs-rust/packages/container/tier2-linux/settings public;
until then every Tier 2 job silently rebuilds from stock Ubuntu.

and runs it in the tier2-image publish job immediately after publish — one HTTP request with the module's existing 5 s timeout.

Also drops the now-redundant "ensure the visibility is public" print, since the next step enforces it.

Merge order matters

Flip the package to public before merging this, otherwise master pushes go red by design. That red is the point: the failure mode we're removing is a silent one that survived months.

Tests

$ cd ci && uv run --no-project python -m unittest test_tier2_image
Ran 15 tests ... OK
$ uv run --no-project ruff check ci/tier2_image.py ci/test_tier2_image.py
All checks passed!

New cases: verify exits non-zero for 401/403/404 with the settings URL in the message, exits non-zero when the tag is missing, passes on an anonymous read; and the publish job runs verify after publish.

ci/tier2_image.py opens with "The package must be PUBLIC: anonymous probes
and Docker pulls need no credentials, including on forks", but nothing ever
checked it. publish() only printed "ensure the GHCR package visibility is
public" and moved on, and select_image() treats every probe error as "no
image" and silently uses stock Ubuntu. A newly published org package is
private by default, so the invariant was never satisfied: prebaked=false
appears in every run, including the pool era, and each Linux Tier 2 job
re-downloads its package set from archive.ubuntu.com.

Add a verify command that probes the identity tag anonymously and fails with
the setting to change and the reason, and run it in the publish job after
publish. The probe is one request with a 5 s timeout, so the cost is nil and
a future regression cannot hide for another cycle.

Note: merging this before the package is public turns master pushes red on
purpose. Flip the visibility first.
The ci/ self-test gate fails any test that prints a ResourceWarning (#2235),
and verify() turned a private-package HTTPError into a SystemExit without
closing the response it held. Close it first and read the status before, so
the failure message and the gate both stay correct.
@zackees
zackees added this pull request to the merge queue Nov 23, 2026
Merged via the queue into master with commit cb0d23e Nov 23, 2026
42 checks passed
@zackees
zackees deleted the fix/ghcr-public-verify branch November 23, 2026 18:58
@obs-rust-project-manager obs-rust-project-manager Bot moved this from In review to Done in obs-rust Multiview Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant