Skip to content

ci: sync source mirror statically, without concretizing - #6248

Merged
tgamblin merged 2 commits into
developfrom
sync-src-mirror-static
Aug 27, 2026
Merged

ci: sync source mirror statically, without concretizing#6248
tgamblin merged 2 commits into
developfrom
sync-src-mirror-static

Conversation

@tgamblin

Copy link
Copy Markdown
Member

Re-adds the nightly source mirror sync from #6069 (reverted in #6245).

Nothing about mirroring sources requires concretization: URLs and sha256 checksums for version tarballs, resources, and patches are all known statically from package.py files. The sync-src-mirror.py script here:

  1. finds every sha256-addressed artifact in the builtin repo that is missing from the mirror, by comparing digests against a listing of the content-addressed _source-cache/archive/ prefix:

    • version tarballs
    • resources
    • URL patches (in packages and from dependencies, via the patch index)

    while skipping manual-download and non-redistributable packages;

  2. fetches each missing artifact with Spack's own fetch strategies, which honor per-package fetch_options, fallback URLs, and checksum verification; and

  3. uploads each verified artifact to S3 with aws s3 cp, one at a time, so disk usage stays bounded.

Mirror paths are computed with Spack's own default_mirror_layout(), so uploaded files are found by spack fetch. Individual fetch failures are tolerated and only skip that artifact until the next nightly run.

This behaves like spack mirror create --all, in that all resources and patches are included regardless of their when= conditions -- the mirror should hold artifacts for every possible configuration.

Parts of this should probably be integrated into spack mirror create eventually; it lives in spack-packages for now because spack mirror create --all still concretizes when run from an environment, and it's hard to write an environment that fetches only artifacts for specific package versions without reconcretizing. Once that's fixed, this script can be replaced.

The mirror is currently missing 587 artifacts, which this job will backfill on its first runs -- modulo dead URLs and stale checksums (e.g. abduco@0.4/@0.5, whose autogenerated GitHub tarballs no longer match their declared sha256s). #6247 marks the packages whose sources we can't legally mirror so we don't retry them every night.

tgamblin and others added 2 commits August 26, 2026 22:15
Re-adds the nightly source mirror sync from #6069 (reverted in #6245).

Nothing about mirroring sources requires concretization: URLs and
sha256 checksums for version tarballs, resources, and patches are all
known statically from `package.py` files. The
`find-missing-mirror-artifacts.py` script here:

1. lists every sha256-addressed artifact in the builtin repo:
   - version tarballs
   - resources
   - URL patches (in packages and from dependencies)

   while skipping manual-download and non-redistributable packages;

2. compares digests against a listing of the mirror's content-addressed
   `_source-cache/archive/` prefix; and

3. emits one TSV line per missing artifact with its:
   - `sha256`
   - exact mirror path, computed with Spack's `default_mirror_layout()`
   - its candidate URLs in order of preference.

A GitHub Actions workflow then downloads each artifact with curl,
verifies the sha256, and uploads artifacts to S3 one at a time.
disk usage is bounded and individual fetch failures only skip that
artifact until the next nightly run.

Co-authored-by: Alec Scott <alec@llnl.gov>
Assisted-by: Claude <noreply@anthropic.com>
Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
Merge the download/verify/upload loop into the finder script and fetch
with spack's own fetch strategies via Stage.fetch()/check(). This
honors per-package fetch_options, reuses spack's checksum and redirect
handling, and drops the TSV/bash handoff. Uploads still go through
`aws s3 cp`, one artifact at a time, so disk stays bounded.

Without --upload-to, the script just lists missing artifacts, which
makes it easy to run locally.

Assisted-by: Claude <noreply@anthropic.com>
Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
@spackbot-triage spackbot-triage Bot added the ci Related to CI/CD workflows and pipelines label Aug 27, 2026

@alecbcs alecbcs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me. It took me a while to figure out that not including an upload_to flag also disables downloading and staging the packages as more of a dry run and only prints what's missing.

Overall I like the structure and the ability to upload the files within the stage's lifecycle to save on disk space consumed.

We might need to be careful that this now uses more of the Spack python SDK without being tied into Spack's unit tests so it's possible that we'll modify Spack and accidentally break this script.

Comment thread .github/workflows/bin/sync-src-mirror.py
@tgamblin
tgamblin merged commit a9827af into develop Aug 27, 2026
33 checks passed
@tgamblin
tgamblin deleted the sync-src-mirror-static branch August 27, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Related to CI/CD workflows and pipelines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants