Skip to content

Scheduled container rebuilds: refresh OS packages weekly, or pin the base image by digest and move it by pull request? #234

Closed

Description

@mmcky

From the 2026-10-06 codebase review (finding M4; record: .qe/dev/log/2026-10-06-codebase-review.md, #220).

The choice

What should a scheduled run of build-containers.yml do: refresh the images' OS packages every week, or leave the images alone until a pull request changes them?

Why it needs deciding

build-containers.yml rebuilds both images every Monday (:15-17) and takes the layer cache from the published :latest (cache-from at :79 and :121, cache-to: type=inline). BuildKit reuses a layer when its instruction and its parent are unchanged. So when ubuntu:24.04 resolves to the same digest as last time, a scheduled run replays every layer from cache, including apt-get install, conda env create and the build_date marker, and republishes the same image. The build logs show this:

  • fully cached, in about 20-40 s: the scheduled runs of 2026-08-31, 2026-09-07, 2026-09-21 and 2026-09-28;
  • rebuilt, in about 7-8 min, because the base digest had moved: 2026-08-24, 2026-09-14 and 2026-10-05.

The pattern held after the review. The scheduled runs of 2026-10-12 and 2026-10-26 took 40 s and 24 s, and those of 2026-10-19 and 2026-11-02 about 8.5 min.

The documentation says something different:

  • README.md:156 promises "Weekly automated builds (Monday 2am UTC) for security updates".
  • containers/quantecon/README.md:135 says the image "automatically stays current with Ubuntu 24.04 security updates".
  • docs/dev/ARCHITECTURE.md:55 lists "Weekly rebuilds".

When the base does move, these re-resolve together, with no pull request:

This is what broke #222. The scheduled rebuild of 2026-10-19 re-resolved the lean image's then-unpinned plotly to 7.x, which cannot export images with the image's kaleido 0.2, and the lecture matrix's lecture-python-advanced.myst leg failed on the lean image every week after that. #226 (2026-11-04) pinned each lean-image conda package that the anaconda=2026.07 metapackage also pins, at the metapackage's version. That leaves the four above and the pip layer.

Options

(a) Refresh weekly.

  • First finish pinning the lean image's Python layer: fix(containers): pin the lean image's conda layer to the Anaconda 2026.07 baseline (#222) #226 pinned its conda packages, but its pip packages still carry >= floors. The full image already uses == for its build tools.
  • Then make scheduled runs actually rebuild, with no-cache on schedule events or a weekly cache-bust build argument on the apt step.
  • OS updates then arrive weekly, and the Python stack moves only through pull requests.
  • Cost: a cold build of about 7-8 min per image every week.
  • Two cautions:
    • no-cache-filters cannot isolate the apt step in a single-stage Dockerfile.
    • Without the pinning first, this option turns the silent drift from every two or three weeks into every week.

(b) Pin the base.

  • Pin FROM ubuntu:24.04@sha256:… in both Dockerfiles, so each base move arrives as a Dependabot pull request, which containers: no validation runs before the tag every consumer pins moves #142's planned pull-request builds would test.
  • The Dependabot docker entry currently ignores ubuntu entirely (.github/dependabot.yml). It would need to allow digest updates while still holding the 24.04 tag.
  • Drop the schedule, or keep it and document it as a cache warm-up.
  • OS updates then arrive whenever Canonical republishes the base (every few weeks), reviewed rather than silent.

Either way, the three documents above must say what the images actually do. The task that implements the choice waits on this issue (native dependency).

The review's recommendation: (b), with the rest of the lean image's Python layer pinned too (#226 did the conda packages). Every change to an image then arrives as a pull request. That fits the dependency policy in docs/dev/PLAN.md, the reproducibility goal of #129 and the validation plan of #142. Choose (a) if weekly OS patches matter more than reviewing each image change.

Closing

Close as completed, with the choice and its reasons recorded in a comment. If the question is mooted, close it as not planned, then re-scope or close the task that waits on it.

Activity

  1. added
    security
    discuss
    on Nov 4, 2026
  2. added theissue type on Nov 4, 2026
  3. added 2 commits that reference this issue on Nov 4, 2026
  4. mmcky commented on Nov 4, 2026

    @mmcky
    ContributorAuthor

    Decided 2026-11-04: option (b), pin the base.

    1. Pin FROM ubuntu:24.04@sha256:… in both Dockerfiles, so a base move arrives as a Dependabot pull request instead of silently. The Dependabot docker entry stops ignoring ubuntu and allows digest updates while holding the 24.04 tag.
    2. Drop the weekly schedule: from build-containers.yml. With the base pinned, a scheduled run has nothing to pick up, so every image change comes from a pull request.
    3. Correct the docs that promise weekly security updates (README.md:156, containers/quantecon/README.md:135, docs/dev/ARCHITECTURE.md:55) to say what the images actually do: OS updates arrive when the pinned base moves, through a reviewed pull request.

    Why: every change to an image then arrives as a pull request. That fits the dependency policy in docs/dev/PLAN.md and the validation plan of #142, whose phase 1 (pull-request builds and smoke tests, in progress) is what tests those Dependabot base moves before :latest moves. It also ends the silent re-resolution that broke #222.

    #235 carries the implementation, after #142's phase 1 lands. Closing as completed.

    Posted by Claude Code (on behalf of mmcky), from the 2026-11-04 decision session.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    discusssecurity

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions