Skip to content

build(deps): pin every image tool in a Dependabot-managed lockfile - #123

Merged
joe4dev merged 3 commits into
mainfrom
dependabot-central-versions
Nov 18, 2026
Merged

joe4dev merged 3 commits into
mainfrom
dependabot-central-versions

Conversation

@joe4dev

@joe4dev joe4dev commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Summary

Every tool in the Docker image now gets its version from one file that Dependabot updates. Where CI and the image share a dependency, they read it from the same pin. Every Dependabot entry waits 7 days after a release (cooldown), following uv's Dependabot guide.

Tool Before After Dependabot
Node.js node:22-bookworm-slim (floating) node:22.23.5-bookworm-slim, both stages docker (majors by hand, see below)
Terraform HashiCorp apt repo, unpinned FROM hashicorp/terraform:1.17.2, static binary copied in docker
aws-cdk, lstk npm i -g aws-cdk@2.1145.0 @localstack/lstk@1.4.2 npm ci from docker/tools/npm/package-lock.json npm
SAM CLI installer zip, ARG version + SHA-256 uv project docker/tools/sam (pyproject.toml + uv.lock), uv sync --locked into its own venv uv
Snowflake CLI pip install snowflake-cli==3.34.0 (transitive deps unpinned) uv project docker/tools/snowflake, same as SAM uv
uv (build time only) — FROM ghcr.io/astral-sh/uv:0.13.9, mounted into the RUN steps, not in the image docker
dockerode and other server deps npm install dockerode@5.0.1, outside yarn.lock yarn install --production --frozen-lockfile, the same yarn.lock CI tests with npm (existing)
CDK sample app (data/sample-cdk) not covered — npm
GitHub Actions not covered (setup-node@v2 in one job, @v4 elsewhere) @v4 everywhere github-actions

Tool versions are unchanged except Snowflake CLI: Terraform 1.17.2, SAM CLI 1.172.1, aws-cdk 2.1145.0, lstk 1.4.2, Node 22.23.5. Snowflake CLI goes from 3.34.0 to 3.33.0: 3.34.0 was published on 2026-11-17, inside the one-week exclude-newer window, so Dependabot proposes it after the cooldown.

 .github/dependabot.yml
   npm  /                                   (existing)
+  npm  /docker/tools/npm, /data/sample-cdk
+  uv   /docker/tools/sam, /docker/tools/snowflake
+  cooldown: default-days: 7               (every entry, including the existing npm one)
+  docker /                                 (ignores node majors)
+  github-actions /
 workflows
-  run: yarn
+  run: yarn install --frozen-lockfile      (ci.yml x2, azure-smoke.yml)
   docker.yml paths: + docker/**, data/**
   docker.yml smoke: amd64/arm64 matrix (ubuntu-26.04, ubuntu-26.04-arm), was amd64 only
-  docker.yml smoke env CI_LOCALSTACK_AUTH_TOKEN (unused)
   runs-on: ubuntu-latest -> ubuntu-26.04  (docker.yml, ci.yml)

Notes on the choices:

  • SAM CLI and Snowflake CLI are uv projects. Dependabot cannot update a GitHub release zip pinned in an ARG. Each CLI is its own project with its own venv, because their rich pins conflict (see ci(docker): speed up the image build #121). uv.lock is a universal lock with hashes; requires-python = "==3.11.*" matches the image's Debian Python. The image installs with uv sync --locked --no-install-project --no-build --python /usr/bin/python3, using UV_PYTHON_DOWNLOADS=0 and UV_LINK_MODE=copy per uv's Docker guide. uv verifies the lock hashes, --no-build refuses source builds, and uv handles boto3's botocore[crt] extra (awscrt is installed).
  • exclude-newer = "1 week" plus a 7-day cooldown. uv only locks releases at least a week old, and Dependabot only proposes such releases, so its PRs never ask for a version uv refuses to lock. The relative span is stored in uv.lock (exclude-newer-span = "P1W"), so uv sync --locked keeps accepting the lock as time passes. The cooldown is on every Dependabot entry, including the existing root npm one; it delays version updates only, not security updates.
  • Regenerating by hand is uv lock in the tool's directory. No Docker container or pip-tools needed.
  • Node majors stay manual. The workflows use node-version: 22.x and esbuild uses --target=node22, and Dependabot can update neither. Dependabot therefore ignores node majors, and the new src/core/dependency-pins.test.ts fails if the Dockerfile's node major differs from them. CI floats within 22.x; the image is exactly 22.23.5.
  • Both architectures are smoke-tested natively, on one pinned Ubuntu release. The smoke job is a matrix: amd64 on ubuntu-26.04, arm64 on ubuntu-26.04-arm, with the same build and MCP startup steps. arm64 catches arm64-only breakage, such as a locked Python package without an arm64 wheel, before the multi-arch push builds it under QEMU. The arm64 leg runs on PRs, pushes to main and tags, and push waits for both legs. The integration test stays on amd64: its deploys take minutes and do not depend on the image's architecture. Every runner in docker.yml and ci.yml is pinned to ubuntu-26.04, which is what ubuntu-latest resolves to today, so this changes no OS. azure-smoke.yml stays on ubuntu-latest, which it relies on for the Azure CLI.
  • The pin test also guards against regressions. It rejects Dockerfile installs that bypass a lockfile (npm install, npx, pip install, uv pip install, uv sync without --locked, version ARGs) and plain yarn installs in workflows. It also requires every runner in docker.yml and ci.yml to name the same Ubuntu release, either as a literal label or through ${{ matrix.runner }}, and requires an arm64 runner.
  • Debian packages (python3, git, curl) still come from the pinned node image's bookworm base and are not pinned individually.

Evidence

Uncached local builds on an Apple Silicon Mac (Docker Desktop; amd64 is emulated), compared with main after #121:

main This PR
Full build, arm64 (native) 117 s 56 s
Full build, amd64 (emulated) 124 s 107 s
SAM + Snowflake CLI install steps, arm64 46 s (installer + pip) 13.5 s (uv)
Image, uncompressed (arm64 / amd64) 958 / 945 MB 947 / 938 MB
Image, gzip of docker save (arm64 / amd64) 320 / 325 MB 287 / 293 MB

Installing the same locked set into a fresh venv takes pip 15.2 s and uv 2.3 s for SAM CLI, and pip 8.9 s and uv 1.3 s for Snowflake CLI (arm64). The image shrinks because SAM no longer ships its own bundled Python. The amd64 timing reused the arm64 build's uv cache mount for platform-independent wheels. CI builders start cold.

Same behaviour on both images:

  • Tool versions are identical, except Snowflake CLI 3.33.0.
  • sam build succeeds for a python3.11 function (with requests) and a nodejs22.x function (with lodash).
  • snow --version works as root, as --user 1000, and with --read-only.
  • uv is not in the final image, and the SAM venv imports awscrt (the botocore[crt] extra).
  • lstk resolves the right platform package on each arch.
  • tests/docker/validate-image.mjs with the CI smoke settings: tools/list exposes all 15 tools.

yarn test passes 420/420, including the 5 new pin tests. Each of these makes a pin test fail as intended: reverting one ci.yml install to plain yarn, moving the arm64 runner to 24.04, setting a runner back to ubuntu-latest, and computing a runner with an expression.

An adversarial review agent checked the change against dependabot-core's source:

  • the pip-compile header regex and hash preservation (that review predates the switch to uv);
  • FROM --platform=… AS … parsing;
  • directories combined with groups.

It also found the unfrozen yarn installs in CI, the missing arm64 PR build and the too-narrow path filter, all fixed here. A second review of the matrix found no blockers. It checked that ubuntu-24.04-arm runners already passed in this repo, and that main requires no status checks, so the renamed checks smoke (amd64) and smoke (arm64) cannot block merges. It also found that ubuntu-latest already resolves to 26.04, so pinning 24.04 would have been a downgrade, and that the job-level CI_LOCALSTACK_AUTH_TOKEN was unused and would have reached the arm64 leg. Both are fixed. Dependabot PRs get LOCALSTACK_AUTH_TOKEN: the repo already has it as a Dependabot secret, so the integration test still runs real deploys.

Merge Danger

Door: two-way

Blast Radius: Docker image users, CI, maintainers (more Dependabot PRs)

  • SAM CLI changes how it is installed (venv instead of the installer bundle), but not its version. sam build behaves the same in the checks above.
  • More Dependabot PRs. Up to four new weekly grouped PRs: image npm tools, image uv tools, Dockerfile images, and actions. Majors arrive ungrouped.
  • Dependabot's uv support. uv's guide notes that some uv use cases do not work with Dependabot yet (astral-sh/uv#2512). Dependabot's bundled uv must also understand relative exclude-newer. The first uv Dependabot run will show whether both projects update cleanly.
  • Root npm PRs arrive a week later because of the cooldown on the existing entry.
  • arm64 smoke leg. smoke (arm64) runs in parallel with amd64 and takes about 2–3 minutes, less than the amd64 leg, so it adds no wall-clock time. It also runs before releases.
  • Check names change. smoke becomes smoke (amd64) and smoke (arm64). No ruleset or branch protection requires them.
  • Pinned runners need manual upgrades. Dependabot cannot update runs-on labels. Moving to a new Ubuntu release means editing docker.yml and ci.yml together; the pin test enforces it.
  • CDK CLI and library are bumped separately. aws-cdk (the CLI in the image) and aws-cdk-lib (the sample) live in different directories, so they can arrive in separate PRs. A new aws-cdk-lib that needs a newer CLI fails the CDK deploy in the integration test until the CLI PR lands.
  • Not covered: the Terraform provider in data/sample-terraform (~> 5.0, no committed lock), and base image digests (uv's Docker guide recommends a digest for reproducibility; all three images use tags for now).

🤖 Generated with Claude Code

joe4dev and others added 3 commits November 18, 2026 14:57
- Dockerfile takes every tool version from a file Dependabot updates:
  node and terraform from FROM lines (terraform now from its official
  image, not HashiCorp's apt repo), aws-cdk and lstk from
  docker/tools/npm/package-lock.json, SAM CLI and Snowflake CLI from
  hashed pip-compile lockfiles (SAM leaves its installer zip), and
  dockerode from the root yarn.lock instead of an ad-hoc npm install.
- dependabot.yml covers npm (image tools, CDK sample), pip, docker and
  github-actions.
- CI installs with --frozen-lockfile, like the image; the Docker
  workflow also runs on docker/** and data/** changes, and PRs get a
  native arm64 build and smoke test.
- src/core/dependency-pins.test.ts keeps the node major in step across
  the Dockerfile, workflows and esbuild target, and rejects installs
  that bypass a lockfile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- SAM CLI and Snowflake CLI become one uv project each (pyproject.toml +
  uv.lock), replacing the pip-compile requirements files and the
  Docker-based compile script. Both set `exclude-newer = "1 week"`, so
  Snowflake CLI is pinned at 3.33.0 until 3.34.0 is a week old.
- The Dockerfile installs them with `uv sync --locked --no-build` from a
  build-time mount of ghcr.io/astral-sh/uv (pinned in a FROM line), which
  is 6-7x faster than pip and keeps uv out of the image.
- dependabot.yml uses the uv ecosystem for them and a 7-day cooldown on
  every entry, matching exclude-newer as the uv Dependabot guide advises.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lease

Fold the PR-only arm64 job into the smoke job as an amd64/arm64 matrix, so
both legs share the same steps and the release push waits for both. The
integration test stays on amd64. Pin every runner in docker.yml and ci.yml
to ubuntu-26.04 (what ubuntu-latest resolves to today), and drop the unused
CI_LOCALSTACK_AUTH_TOKEN job env. The pin test now checks that all these
runners share one Ubuntu release and that an arm64 runner exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@joe4dev
joe4dev marked this pull request as ready for review November 18, 2026 16:06
@joe4dev
joe4dev merged commit 269e668 into main Nov 18, 2026
5 checks passed
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