Cache Azure Linux packages in CI - #8196
Merged
Amaury Chamayou (achamayou) merged 11 commits intoAug 25, 2026
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 47eaba31-fd3f-4ae5-ac22-7786acdbf9f8
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 47eaba31-fd3f-4ae5-ac22-7786acdbf9f8
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 47eaba31-fd3f-4ae5-ac22-7786acdbf9f8
Amaury Chamayou (achamayou)
marked this pull request as ready for review
August 21, 2026 13:27
Copilot started reviewing on behalf of
Amaury Chamayou (achamayou)
August 21, 2026 13:29
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Caches Azure Linux 3 and 4 CI packages and centralizes dependency installation through a shared composite action.
Changes:
- Adds TDNF/DNF5 caching and offline installation.
- Migrates Azure Linux workflows to the shared action.
- Adds snapshot and cache-generation controls.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Change |
|---|---|
scripts/setup-ci.sh |
Adds TDNF cache-only support. |
scripts/setup-ci-al4.sh |
Adds DNF5 cache-only support and compatibility RPM reuse. |
.github/workflows/long-test.yml |
Uses the shared dependency action. |
.github/workflows/doc.yml |
Uses the shared dependency action. |
.github/workflows/coverage.yml |
Uses the shared dependency action. |
.github/workflows/codeql-analysis.yml |
Uses the shared dependency action. |
.github/workflows/ci.yml |
Uses the shared dependency action. |
.github/workflows/ci-verification.yml |
Uses the shared dependency action. |
.github/workflows/ci-al4.yml |
Uses the shared Azure Linux 4 action. |
.github/workflows/bencher.yml |
Uses the shared dependency action. |
.github/workflows/bencher-ab.yml |
Uses the shared dependency action. |
.github/azure-linux-4-cache-version |
Versions the Azure Linux 4 cache. |
.github/azure-linux-3-snapshot |
Pins the Azure Linux 3 snapshot. |
.github/actions/install-ci-dependencies/action.yml |
Configures, restores, installs, and saves package caches. |
Suppressed comments (4)
scripts/setup-ci-al4.sh:61
- This function is called from
retryas the condition of anif, so Bash'serrexitis disabled inside it. If this multi-package install fails, execution continues into the compatibility-RPM install; if that later command succeeds, the function reports success and the composite action saves an incomplete exact cache. Propagate the package-install failure before continuing.
dnf "${DNF_OPTIONS[@]}" install \
scripts/setup-ci-al4.sh:134
- Because this function is evaluated by
retryinside anif, a failed DNF install does not triggererrexit. If Node.js from the base image is already at a supported version, the subsequent version check can succeed and the new cache step can persist a cache that never installednodejs-npm. Return immediately when this DNF command fails.
return 1
scripts/setup-ci-al4.sh:154
- This standalone DNF command is followed by the pip installation, and
retryinvokes the function in anifcondition, so a DNF failure can be masked when pip succeeds. On a cold run the composite action would then save an incomplete package cache, causing later exact-cache/offline runs to fail. Propagate the DNF status before running pip.
return 1
scripts/setup-ci-al4.sh:98
- This install is inside the outer retry, but a failed validation/install leaves the downloaded RPM at
$libbacktrace_path. Subsequent retries therefore skipcurland reuse the same corrupt or truncated file, turning a transient download problem into three guaranteed failures. Remove or revalidate the cached file when the local install fails so the retry can redownload it.
if [[ ! -f "$libbacktrace_path" ]]; then
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 47eaba31-fd3f-4ae5-ac22-7786acdbf9f8
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Rotate the Azure Linux RPM cache key each Sunday while restoring the previous compatible cache as a warm seed. Document the weekly cache lifecycle and automatic post-job save behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Eddy Ashton (eddyashton)
approved these changes
Aug 25, 2026
Amaury Chamayou (achamayou)
deleted the
achamayou-tdnf-cache-experiment
branch
August 25, 2026 12:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SOURCE_DATE_EPOCHfor reproducible buildsMotivation
CI repeatedly downloads roughly 800 MB while installing dependencies from
packages.microsoft.com. Those downloads have produced intermittent timeouts. The cache is an optional reliability layer, not a reproducibility mechanism: normal CI should use current repository metadata and remain able to install online.GitHub Actions caches are immutable, so an unchanged key would never absorb newer RPMs downloaded by later jobs. Including the date of the most recent Sunday in the key creates a refreshed cache once a week without requiring a repository change.
Download impact
The fixed-image Azure Linux 3 experiment measured:
This version deliberately discards restored metadata and downloads current metadata before installing. Conservatively treating the entire 63,956,932-byte on-disk metadata footprint as additional network transfer gives a warm-path upper bound of 95,451,792 B. That avoids at least 706,744,337 B per Azure Linux 3 job, an 88.1% reduction in dependency-install traffic. The actual reduction should be larger because repository metadata is transported compressed.
The Actions cache archive itself is approximately 752 MB, so this is not a claim of a comparable reduction in total runner ingress. It shifts more than 700 MB per warm job away from
packages.microsoft.comto the Actions cache service; if that service is unavailable, CI continues with the normal online installation.Design
The shared action detects Azure Linux 3 or 4 and configures the native package manager to retain RPMs in a persistent directory outside
/github/home/.cache, which CI tests clear later in the job.The primary cache key contains the package manager, runner architecture, dependency-script hash, and the date of the most recent Sunday at midnight UTC. On an exact hit, the immutable weekly cache is reused. At the next weekly rollover, ordered restore prefixes first select the newest cache for the same dependency scripts and then fall back to any cache for the same package manager and architecture. This warm-seeds the new cache, after which the package manager downloads only missing or updated RPMs.
actions/cachesaves the populated directory under the new weekly key in its automatic post-job phase.Before installation, the action removes restored repository metadata and runs the existing setup script online. This ensures dependency resolution uses current repository metadata even when the RPM cache was populated earlier.
scripts/setup-ci.shno longer invents a snapshot timestamp. It adds--snapshottimeonly whenSOURCE_DATE_EPOCHis explicitly set by the release workflow, preserving release reproducibility without pinning ordinary CI.Validation