Skip to content

ci(containers): pin the Ubuntu base by digest and drop the weekly rebuild (#235) - #255

Merged
mmcky merged 1 commit into
mainfrom
feat/235-pin-base-digest
Nov 5, 2026
Merged

mmcky merged 1 commit into
mainfrom
feat/235-pin-base-digest

Conversation

@mmcky

@mmcky mmcky commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

build-containers.yml rebuilt both images every Monday, and three docs promised that this kept them current with Ubuntu security updates. It didn't. When ubuntu:24.04 had not moved, BuildKit replayed every layer from the :latest cache and republished the same image (#235: four of the seven Mondays from 2026-08-24 to 2026-10-05, and 10-12 and 10-26 since). When it had moved, the images' floating packages re-resolved with no pull request, which is how plotly 7 reached the lean image and broke the lecture matrix for three weeks (#222). On #234 the maintainer chose option (b): pin the base by digest, have Dependabot propose each base move, drop the schedule, and correct the docs. This PR does that, so every change to an image, OS updates included, now arrives as a pull request that #245 builds and smoke-tests before :latest moves.

Changes

File Change
containers/quantecon/Dockerfile, containers/quantecon-build/Dockerfile FROM ubuntu:24.04@sha256:fe81560990fae86dc4743202b2cb4d3df98d0bcf949173cecef15ce1127ef852, with a comment on why.
.github/dependabot.yml The docker entry no longer ignores ubuntu outright. It ignores only version-update:semver-major and version-update:semver-minor, which holds the 24.04 tag and lets digest updates through. The two docker groups become one group without update-types (see below).
.github/workflows/build-containers.yml schedule: removed. The comments that mentioned it are fixed (the trigger list, the main-<sha> note, Report failure). Alerting is unchanged: Report failure still fires on any non-dispatch failure, which is now a push.
.github/workflows/test-containers-lectures.yml Its own schedule: (Monday 02:00 UTC) against :latest, the maintainer's choice of the options sent through the organiser. The test job's if: admits schedule. Comments that said the workflow runs "off the weekly container build" are fixed. Report failure is untouched: it already alerts on any non-dispatch event.
scripts/check-base-pins.sh New. Every FROM in containers/*/Dockerfile must be <image>:<tag>@sha256:<64 hex>. Every FROM of one <image>:<tag> must pin the same digest across all the Dockerfiles. scratch and earlier build stages are skipped; a FROM ${ARG} fails, since it can't be checked. Also --self-test.
.github/workflows/validate-containers.yml The plan job runs the self-test, then the check, on every event, before deciding which images to build. It writes the pinned base to the step summary.
.github/workflows/test-actions.yml One path added to the gate's must-run self-test list, so IGNORED can never come to cover scripts/check-base-pins.sh.
README.md, containers/quantecon/README.md, docs/CONTAINER-GUIDE.md, docs/dev/ARCHITECTURE.md The weekly-rebuild and security-update claims now describe what the images do: no scheduled rebuilds, and OS updates when the pinned base moves, through a reviewed Dependabot pull request. They cross-reference #129 for what the pin does not make reproducible (apt packages and some Python packages still resolve at build time; consumers still float on :latest). Smallest correct edits: the docs session restructures these files in #191 and #192 and keeps the wording.
CONTRIBUTING.md Both Staged Releases sentences about scheduled rebuilds pushing :latest untested. The organiser agreed this edit lands here, with the behaviour.
CHANGELOG.md One entry under [Unreleased] → Changed.

The digest, and why the pin should change neither image

  • How I got it. I resolved the manifest list from Docker Hub's registry API on 2026-11-05: an anonymous pull token for library/ubuntu, then a request for /v2/library/ubuntu/manifests/24.04 that accepts the OCI index and Docker manifest-list types. The Docker-Content-Digest header was sha256:fe81560990fae86dc4743202b2cb4d3df98d0bcf949173cecef15ce1127ef852. This is the multi-arch index digest, the form Dependabot writes. Its amd64 manifest is sha256:78d4744e…, created 2026-10-25, with a single layer sha256:7a48b8f0… (29.77 MB).
  • :latest already uses it. build-containers run 41956606594, deps: bump the conda group across 2 directories with 1 update #223's merge build and the one that produced the current :latest of both images, logs FROM docker.io/library/ubuntu:24.04@sha256:fe81560990fae86dc4743202b2cb4d3df98d0bcf949173cecef15ce1127ef852 in both jobs. It also downloads the same 7a48b8f0… base layer.
  • So the build should be a cache replay. BuildKit keys the FROM step on the resolved digest, and the unpinned FROM resolved to the same one. This PR's candidate builds should therefore show every step CACHED, and the candidates' layers should be identical to :latest's. I can't compare package lists locally: there is no Docker here, and an anonymous GHCR pull is refused (Reproducibility: what would it take to rebuild a published lecture exactly? #129's point 1). The comparison is this PR's own run; see What to watch.

Dependabot: a digest move, never 26.04

I didn't run a Dependabot dry run (the dependabot CLI needs Docker). The evidence is dependabot-core's source and a public repository with the same configuration.

  • The ignore holds the tag and passes digest moves. For a tag@digest pin, dependabot-core works out the latest tag from the comparable tags, minus ignored versions, and then compares the digest of that tag. With majors and minors ignored the latest tag stays 24.04, so a new digest under 24.04 is a digest-only refresh. Ignore conditions never match it, because it changes no version (update_checker.rb, digest_requirement_up_to_date?). Ignoring ubuntu with no update-types, as before, stops both kinds.
  • The same configuration in use. vdenisov/mkvtool's .github/dependabot.yml pins ubuntu:24.04@sha256:… and ignores ubuntu with exactly these two update types.
    • Before that ignore, its first Dependabot run opened "Bump ubuntu from 24.04 to 26.04" (2026-07-28).
    • Since then it has received only digest moves under 24.04: "Bump ubuntu from 4fbb8e6 to 68ee220" (2026-08-10) and "Bump ubuntu from 68ee220 to fe81560" (2026-11-02), the second to the digest pinned here.
    • Unconstrained, Dependabot is proposing 24.04 → 26.04 across GitHub this week, so the ignore is needed.
  • One group, not two. In dependabot-core, a group's update-types are applied by SemverGroupingRules#allow_grouping?. It compares the current version with the latest. When neither major, minor nor patch has risen, as in a digest-only refresh, it returns false, so the update is kept out of the group. With our previous docker (minor/patch) and docker-major groups, each base move would therefore have arrived as two ungrouped pull requests, one per directory, and could have merged one image ahead of the other. A group with no update-types takes it (return true unless update_types, line 45), so both Dockerfiles move in one PR, as the conda group's do.

What I checked, and how

  • The issue's premises, re-checked against origin/main before writing code. All held; one was narrower than written.
  • scripts/check-base-pins.sh --self-test passes. It runs 3 passing and 8 failing cases, plus a missing file and no files. Each failing case must fail with its own error message, so none passes by failing for the wrong reason. The cases: unpinned, lower-case from, a digest without a tag, a short digest, mismatched digests across files, mismatched digests across stages, a FROM ${BASE}, and no FROM.
  • The check can fail on the real files. On this tree it passes and prints ubuntu:24.04@sha256:fe81560… (containers/quantecon-build/Dockerfile:8, containers/quantecon/Dockerfile:8). On copies of the real Dockerfiles it fails as it should:
    • with the lean image's FROM unpinned: FROM ubuntu:24.04 is not pinned as <image>:<tag>@sha256:<digest>, exit 1;
    • with its digest changed to 00000…: FROM ubuntu:24.04 pins sha256:00000…, but …/full.Dockerfile:8 pins sha256:fe815…: the images must move their base together, exit 1.
  • Lint. I ran shellcheck 0.11.0 on the script (clean) and actionlint 1.7.12 with shellcheck on the five changed workflows. The changed steps are clean. The remaining findings (SC2001, SC2016, SC2086) were already in unchanged steps, and validate-containers.yml has the same three as on main.
  • python scripts/generate-docs.py --check and --check-examples pass.
  • git diff origin/main -- CHANGELOG.md only adds lines under [Unreleased].
  • This PR's run is the end-to-end test. It changes both Dockerfiles, validate-containers.yml and build-containers.yml, so it builds and smoke-tests both images as pr-<N> candidates.

What to watch

  • This PR's Container images / … jobs:
    • Plan's new step should print Base image: ubuntu:24.04@sha256:fe81560… for both Dockerfiles.

    • Both candidate builds should show every step CACHED, and finish in about a minute rather than 7-8. Any step that isn't cached means the candidate differs from :latest, and I'll report it here.

    • Image size for each candidate should match the current :latest, byte for byte on the compressed figure, since that is the sum of the same layers. From test-container run 41957231876, which followed run 41956606594:

      Image Compressed On disk
      quantecon:latest 3389682650 bytes (3.39 GB) 8780165009 bytes (8.78 GB)
      quantecon-build:latest 2849454397 bytes (2.85 GB) 7103053613 bytes (7.10 GB)
  • The merge rebuilds both :latest images. It should be the same cache replay, so consumers get the same layers under a new manifest.
  • Dependabot's first docker run after the merge. It reads dependabot.yml from main. Insights → Dependency graph → Dependabot → docker → the latest job log should show the ubuntu ignore conditions and "No update needed for ubuntu 24.04", because the pin is current. The first base move, when Canonical next republishes 24.04, should arrive as one "bump the docker group across 2 directories" PR that edits both Dockerfiles. That PR builds full candidates (7-8 min each), and the lecture matrix runs after it merges.
  • If digest PRs stop arriving. dependabot-core has an experiment, docker_digest_only_update_suppression (dependabot-core#15103), that stops digest-only updates for versioned tags like 24.04. Distro codenames like noble are exempt. It is evidently off in production today (the mkvtool move of 2026-11-02 above). If GitHub turns it on, base moves would stop with no error. The fix would be FROM ubuntu:noble@sha256:…, the same image under a tag Dependabot treats as non-comparable. If no base-move PR arrives within about six weeks, check this first.
  • The first scheduled matrix run, Monday 2026-11-09 02:00 UTC. It should run all 8 legs against :latest, check out main's actions at github.sha, and on failure open or comment on the usual tracking issue.
  • Staged release. No action changes behaviour here, so there's nothing for the canary to exercise beyond its normal run. The images take effect on merge, as every container PR does.

Not in this PR

Closes #235.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WT8bMa8fZsd2ykLqLqrwtW

Copilot AI balanced review requested due to automatic review settings November 5, 2026 05:38
@mmcky
mmcky force-pushed the feat/235-pin-base-digest branch from 01a5b09 to 673b46c Compare November 5, 2026 05:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.

🟢 Approval recommended

The change is narrowly focused on enforcing digest-pinned Ubuntu bases and shifting updates to reviewed PRs, backed by a new validator integrated into CI/workflows and aligned documentation, with no active issues indicated in the review evidence.

No open issues 🎉

What changed in this PR

This pull request updates the container maintenance and release policy so Ubuntu base-image changes (including security updates) occur only via reviewed pull requests, rather than via an unattended weekly rebuild that can silently republish cached layers or introduce unreviewed dependency drift.

Changes:

  • Pin both container Dockerfiles to ubuntu:24.04@sha256:… and enforce consistent base digests across images.
  • Remove the weekly scheduled container rebuild; keep a weekly scheduled lecture-matrix run against :latest.
  • Configure Dependabot to propose digest refreshes while preventing tag jumps (e.g., 24.04 → 26.04), and update docs/CHANGELOG to match the new behavior.
File Summary
scripts/​check-base-pins.sh Adds a validator (with --self-test) to require tag@sha256:digest pins and enforce the same base digest across Dockerfiles.
README.md Updates user-facing guidance to reflect “updates via reviewed PRs” rather than weekly rebuilds.
docs/​dev/​ARCHITECTURE.md Aligns architecture documentation with PR-driven container updates and the removal of scheduled rebuilds.
docs/​CONTAINER-GUIDE.md Revises container update policy documentation to match digest pinning + Dependabot PR flow.
CONTRIBUTING.md Updates contribution/staged-release notes to remove references to scheduled container rebuilds.
containers/​quantecon/​README.md Updates container README wording around update cadence and security updates under the new policy.
containers/​quantecon/​Dockerfile Pins ubuntu:24.04 by digest and documents rationale.
containers/​quantecon-build/​Dockerfile Pins ubuntu:24.04 by digest (matching the other image) and documents rationale.
CHANGELOG.md Records the container update-policy change under [Unreleased].
.github/​workflows/​validate-containers.yml Runs the new base-pin self-test/check early in CI and surfaces the pinned base in the workflow summary.
.github/​workflows/​test-containers-lectures.yml Adds/adjusts a weekly schedule against :latest and updates gating/comments accordingly.
.github/​workflows/​test-actions.yml Ensures the new base-pin checker is included in the “must-run” self-test gating.
.github/​workflows/​build-containers.yml Removes the weekly schedule and updates comments to reflect push/dispatch-driven builds.
.github/​dependabot.yml Allows Ubuntu digest-only refreshes while ignoring semver major/minor tag upgrades; consolidates docker grouping.

This pull request is too complex or risky for automated approval.

Review effort: Balanced

@mmcky

mmcky commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Candidate comparison: the pin changes neither image. Run 41975512521 (head 673b46c) passed all 48 checks.

  • Plan: the new step ran check-base-pins self-test passed, then printed Base image: ubuntu:24.04@sha256:fe81560990fae86dc4743202b2cb4d3df98d0bcf949173cecef15ce1127ef852 (containers/quantecon-build/Dockerfile:8, containers/quantecon/Dockerfile:8).
  • Builds: both logs show FROM docker.io/library/ubuntu:24.04@sha256:fe81560…, and all 12 steps after it ([2/13] to [13/13]) are CACHED in each image. That includes the apt layer, the conda layer and the build_date marker. The build jobs took 32 s (full) and 20 s (lean), against 7-8 min for a real rebuild.
  • Sizes: byte for byte, the same as the current :latest from test-container run 41957231876.
Image Compressed, :latest Compressed, pr-255-20261105-054057-673b46c On disk, :latest On disk, candidate
quantecon 3389682650 3389682650 8780165009 8780165009
quantecon-build 2849454397 2849454397 7103053613 7103053613

The compressed figure is the sum of the registry manifest's layer sizes. Equal sums with every step cached mean the candidates carry the same layers as :latest, so the merge's rebuild should republish the same layers under a new manifest. I didn't compare package lists directly: an anonymous GHCR pull is refused (#129), and I have no Docker locally. With every layer replayed from :latest's cache, the package lists cannot differ.

Copilot's review found no issues and left no inline comments, so there are no threads to answer.

Claude Code (on behalf of mmcky)

…uild (#235)

As decided on #234. A scheduled build-containers.yml run replayed every
layer from cache and republished an unchanged image whenever ubuntu:24.04
had not moved, while the docs promised weekly security updates; when it
had moved, the images' floating packages re-resolved with no pull request
(#222).

- Both Dockerfiles pin ubuntu:24.04@sha256:fe81560..., the digest the
  current :latest images were built on (build-containers run 41956606594).
- Dependabot's docker entry ignores ubuntu's major and minor updates only,
  so it proposes each new 24.04 digest but not 26.04, in one group without
  update-types: a digest-only update has no semver level and would
  otherwise arrive as one PR per directory.
- build-containers.yml loses its schedule. test-containers-lectures.yml
  gains its own Monday 02:00 UTC schedule against :latest, so the lecture
  matrix still runs weekly with no image change behind it.
- validate-containers.yml's plan job runs scripts/check-base-pins.sh on
  every event: each FROM pins <image>:<tag>@sha256:<digest>, and the
  images pin the same base.
- README.md, containers/quantecon/README.md, docs/CONTAINER-GUIDE.md,
  docs/dev/ARCHITECTURE.md and CONTRIBUTING.md say what the images now do,
  and point to #129 for what the pin does not make reproducible.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WT8bMa8fZsd2ykLqLqrwtW
@mmcky
mmcky force-pushed the feat/235-pin-base-digest branch from 673b46c to 7dcb38b Compare November 5, 2026 06:10
@mmcky

mmcky commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

After the rebase onto c26a575 (head 7dcb38b): still green and still the same images. Run 41978676210 passed all 52 checks.

  • Builds: both candidates built on ubuntu:24.04@sha256:fe81560… with all 12 steps after FROM CACHED.
  • Compressed sizes: identical to :latest again: 3389682650 bytes (full) and 2849454397 bytes (lean).
  • On-disk sizes: the full image is identical again (8780165009). The lean image measured 7103164968 bytes, 111,355 bytes (0.0016%) more than the 7103053613 from the first run and from :latest.

That difference comes from the measurement, not the image. Each size job logs Docker's overlay2 status:

Size job Runner image Native Overlay Diff Lean on disk
:latest, run 41957231876 — false 7103053613
pr-255, first run ubuntu-26.04 20261025.179.1 false 7103053613
pr-255, this run ubuntu-26.04 20261101.64.1 true 7103164968

Every job that ran with native overlay diff off reproduces the figure exactly, including the full-image job in each run. The compressed sums, taken from the registry manifest, are equal on every run, so the layers are the same. The on-disk figure in test-container.yml's size report therefore varies slightly with the runner image, which is worth knowing when comparing reports. It is outside this PR's scope.

Claude Code (on behalf of mmcky)

@mmcky
mmcky merged commit 00d16de into main Nov 5, 2026
52 checks passed
@mmcky
mmcky deleted the feat/235-pin-base-digest branch November 5, 2026 07:35
@mmcky

mmcky commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

After the merge (00d16de): the new :latest carries the same layers as the old one.

  • Build: build-containers run 41988360556 built both images on ubuntu:24.04@sha256:fe81560…, with all 12 steps after FROM CACHED. Each job took about 28 s.
  • Digests: the pushed digests are new, as expected. The manifest list, the image manifest and the config all differ from the previous :latest, because every build writes a new config: new OCI labels (revision, created) and BuildKit's inline cache metadata. I can't read the configs to list every difference (GHCR refuses an anonymous pull). The layers did not change, as the next point shows.
Image Previous :latest (run 41956606594) New :latest (run 41988360556)
quantecon manifest list sha256:50e02d1de5d9… sha256:d30a6e32be5e…
quantecon config sha256:ebee8ca25e5b… sha256:e8bd45bd9f92…
quantecon-build manifest list sha256:1621d4441522… sha256:da9377fd52d2…
quantecon-build config sha256:f4d7c06640c0… sha256:70c3a5219481…
  • Layers: the post-push size report in test-container run 41988430730 (smoke tests green) matches the previous :latest byte for byte, compressed and on disk. Both jobs ran with Native Overlay Diff: false, as the baseline did.
Image Compressed, before / after On disk, before / after
quantecon 3389682650 / 3389682650 8780165009 / 8780165009
quantecon-build 2849454397 / 2849454397 7103053613 / 7103053613

With every step cached and the registry layer sizes summing to the same bytes, consumers pulling :latest get the layers they already had. The lecture matrix triggered by this build is the organiser's to watch. The first scheduled matrix run is due Monday 2026-11-09 02:00 UTC.

Claude Code (on behalf of mmcky)

mmcky added a commit that referenced this pull request Nov 5, 2026
…ates and container READMEs (#191) (#260)

PR 4 of the user manual (#178). docs/user gains five chapters:
getting-started.md (the templates, their jobs and permissions, the
changes a site makes to them, and migrating an existing repository),
composition.md, containers.md, versioning.md and security.md. They
describe main as it is after #254, #255, #257 and #258, with one
alert for the two inputs the templates use that ship in v0.15.0.

templates/README.md and the three container READMEs become signposts.
The container READMEs' build, update and test sections move to a new
docs/dev/CONTAINERS.md. docs/MIGRATION-GUIDE.md and
docs/CONTAINER-GUIDE.md are removed; their per-repository migration
notes go to PLAN's rollout section. The root README points at the
manual, CONTRIBUTING's doc-update table names each chapter, and its
known limit on Dependabot says bumps come on each repository's own
schedule.

A root SECURITY.md says to report a vulnerability privately, through
the Security tab, and what is in scope. The harness gate's IGNORED
treats it as documentation, root only, and its self-test checks that.

PLAN: item 6 is done (#253, #258), item 10 moves to PR 5, and the rows
for #232, #233, #235, #239 and #247 record their closure.


Claude-Session: https://claude.ai/code/session_01WT8bMXc6EroDo2qFL1pCjS

Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

build-containers: scheduled rebuilds republish a cached image, while the docs promise weekly security updates

2 participants