Skip to content

feat(docker): prune builder installations using buildcache check - #460

Merged
wdconinc merged 3 commits into
masterfrom
feature/docker-buildcache-check
Oct 18, 2026
Merged

wdconinc merged 3 commits into
masterfrom
feature/docker-buildcache-check

Conversation

@wdconinc

@wdconinc wdconinc commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR applies the buildcache pre-check optimization to the Docker container build in containers/eic/Dockerfile.

Changes

  • Adds containers/eic/check-buildcache.py which queries concrete non-external specs against configured OCI binary mirrors (auto-detecting mirrors from Spack configuration) using Spack's internal OCI API.
  • In containers/eic/Dockerfile:
    • Copies check-buildcache.py into /usr/local/bin/ in builder_concretization_default (accessible to all builder stages, absent from runtime images).
    • In builder_installation_default and builder_installation_custom, checks the buildcache for existing packages:
      • If 100% cached: skips spack install completely, saving significant build time and disk I/O in builder layers.
      • If partially cached: installs only the missing spec DAG hashes, which Spack then compiles and autopushes to the buildcache.

Invariant Maintained

The runtime stages rely on --use-buildcache only. The builder stages guarantee that any missing packages are compiled and pushed before runtime stages execute.

Upstreaming

This functionality is under consideration for upstreaming, but no PR is available for linking yet.

Add containers/eic/check-buildcache.py to check concrete specs against
configured OCI binary buildcaches and output missing spec DAG hashes.
In builder_installation_default and builder_installation_custom stages of
containers/eic/Dockerfile, check if all packages already exist in the
buildcache. If so, skip spack install; if only a subset of packages are
missing, install only those specs (which Spack then builds and autopushes
to the buildcache).

This speeds up container builds by avoiding redundant package downloads
and compilation in the builder track, while preserving the invariant
that the buildcache is fully populated for the runtime track.
Copilot AI balanced review requested due to automatic review settings October 16, 2026 22:47

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.

🔵 Needs a closer look

It changes the core multi-stage build pipeline in ways whose correctness depends on registry auth, autopush timing, and concurrency that can only be validated by passing both the GitHub Actions and GitLab CI builds.

2 open issues
What changed in this PR

This PR adds a buildcache pre-check optimization to the multi-stage EIC container build (containers/eic/Dockerfile). A new helper script queries each concrete, non-external spec of a Spack environment against the configured OCI binary mirrors (preferring autopush mirrors), and the builder installation stages use its output to skip spack install entirely when everything is cached, install only the missing spec hashes when partially cached, or fall back to a full environment install if the check fails. This reduces build time and disk I/O in the builder layers while keeping the runtime stages' --use-buildcache only invariant intact (missing specs are compiled and autopushed before runtime stages run).

Changes:

  • New containers/eic/check-buildcache.py that auto-detects OCI mirrors and reports missing spec DAG hashes using Spack's internal OCI API, with graceful exits.
  • builder_installation_default and builder_installation_custom gate spack install on the check result via /tmp/rebuild.txt, with a full-install fallback.
  • The script is copied once into builder_concretization_default so it is available to all builder stages but absent from runtime images.
File Description
containers/​eic/​check-buildcache.py New script that checks environment specs against OCI buildcaches and emits missing DAG hashes; uses Spack internal OCI helpers.
containers/​eic/​Dockerfile Copies the script into builder stages and wraps spack install in both builder installation stages with a buildcache pre-check and fallback.

Review effort: Balanced

Comment thread containers/eic/check-buildcache.py
Comment thread containers/eic/Dockerfile
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Capybara summary for PR 460

Copilot AI balanced review requested due to automatic review settings October 17, 2026 00:34

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.

🔵 Needs a closer look

It changes the critical dual-CI container build path, depends on unverifiable private Spack OCI internals, and contains a fallback path that hard-fails instead of falling back as described, so it warrants human review.

1 open issue
2 resolved since last review

Review effort: Balanced

Comment thread containers/eic/Dockerfile
Copilot AI balanced review requested due to automatic review settings October 17, 2026 00:43

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.

🔵 Needs a closer look

It reworks the core multi-stage builder install flow (which must pass both GitHub and GitLab CI) and relies on private Spack OCI internals that can't be verified here, and it contains a set -e/fallback logic gap that should be resolved by a human reviewer.

1 open issue

Review effort: Balanced

@wdconinc
wdconinc merged commit b192d71 into master Oct 18, 2026
94 checks passed
@wdconinc
wdconinc deleted the feature/docker-buildcache-check branch October 18, 2026 20:18

This branch was successfully deployed

1 active deployment
github-pages — 3ac927bc Deployed Oct 17, 2026 by wdconinc via deploy-artifacts-page #4373
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.

3 participants