7676 const inputName = new RegExp('^dependency-report-inputs-(3\\.[0-9]+)-' +
7777 '(constraints(?:-source-providers|-no-providers)?)-(true|false)-([1-9][0-9]*)$');
7878 const saved = artifacts.map(a => [a, inputName.exec(a.name)]).filter(([, match]) => match);
79+ // Only RunsOn runners can read RunsOn's S3 cache, where a canary on RunsOn keeps its CI image.
80+ const runsOnRunner = `runs-on=${process.env.GITHUB_RUN_ID}/family=m7a+m7i+m6a+m6i` +
81+ '/image=ubuntu22-full-x64/volume=150gb/cpu=8/ram=32';
7982 for (const [input, [, python, mode, useUv, attempt]] of saved) {
8083 if (attempt !== rawAttempt) continue;
8184 const entry = `${python}:${mode}`;
@@ -86,16 +89,21 @@ jobs:
8689 continue;
8790 }
8891 // The stash action names the artifact after the stash key, with '/' as '_', and the branch.
89- const image = artifacts.find(a => a.name === `ci-image-save-v3-linux_amd64-${python}-main`);
92+ // On RunsOn runners the image itself goes to RunsOn's S3 cache and the artifact is only
93+ // its digest, stashed under the key plus '-s3' (see .github/actions/stash-save).
94+ const imageName = `ci-image-save-v3-linux_amd64-${python}-main`;
95+ const image = artifacts.find(a => a.name === imageName) ||
96+ artifacts.find(a => a.name === `ci-image-save-v3-linux_amd64-${python}-s3-main`);
9097 const missing = input.expired ? 'inputs expired' :
9198 !image ? 'CI image missing' : image.expired ? 'CI image expired' : '';
9299 if (missing) {
93100 core.warning(`Skipping ${entry}: original inputs or CI image unavailable (${missing})`);
94101 skipped.push(`${entry} (${missing})`);
95102 continue;
96103 }
97- include.push({ python, mode, 'use-uv': useUv,
98- 'inputs-id': input.id, 'image-id': image.id });
104+ const fromS3 = image.name !== imageName;
105+ include.push({ python, mode, 'use-uv': useUv, 'inputs-id': input.id, 'image-id': image.id,
106+ 'image-source': fromS3 ? 's3' : 'artifact', runner: fromS3 ? runsOnRunner : 'ubuntu-22.04' });
99107 }
100108 core.setOutput('matrix', JSON.stringify({ include }));
101109 core.setOutput('has-reports', include.length > 0 ? 'true' : 'false');
@@ -120,7 +128,7 @@ jobs:
120128 needs : plan
121129 if : needs.plan.outputs.has-reports == 'true'
122130 name : " Explain ${{ matrix.python }}:${{ matrix.mode }}"
123- runs-on : ubuntu-22.04
131+ runs-on : ${{ matrix.runner }}
124132 # Explaining constraints-source-providers took up to 115 minutes in the canary (Oct 2026).
125133 timeout-minutes : 150
126134 strategy :
@@ -139,14 +147,23 @@ jobs:
139147 with :
140148 ref : ${{ needs.plan.outputs.source-sha }}
141149 persist-credentials : false
142- # Docker moves to /mnt as in the image build jobs: the loaded image and uv resolutions outgrow /.
150+ # The disk is prepared as in the image build jobs: the loaded image and uv resolutions outgrow /,
151+ # and the runner scripts come from the workflow's own version, which knows RunsOn's disks.
152+ - name : " Checkout the workflow version for its actions and runner scripts"
153+ uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
154+ with :
155+ persist-credentials : false
156+ path : workflow-version
157+ sparse-checkout : |
158+ .github/actions
159+ scripts/ci
143160 - name : " Free up disk space"
144161 shell : bash
145162 run : ./scripts/tools/free_up_disk_space.sh
146163 - name : " Make /mnt writeable"
147- run : ./scripts/ci/make_mnt_writeable.sh
164+ run : ./workflow-version/ scripts/ci/make_mnt_writeable.sh
148165 - name : " Move docker to /mnt"
149- run : ./scripts/ci/move_docker_to_mnt.sh
166+ run : ./workflow-version/ scripts/ci/move_docker_to_mnt.sh
150167 - name : " Install Breeze"
151168 uses : ./.github/actions/breeze
152169 - name : " Download the original CI image"
@@ -157,6 +174,42 @@ jobs:
157174 github-token : ${{ secrets.GITHUB_TOKEN }}
158175 merge-multiple : true
159176 path : /mnt
177+ if : matrix.image-source == 'artifact'
178+ - name : " Download the digest of the original CI image"
179+ uses : actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
180+ with :
181+ artifact-ids : ${{ matrix.image-id }}
182+ run-id : ${{ needs.plan.outputs.source-run-id }}
183+ github-token : ${{ secrets.GITHUB_TOKEN }}
184+ merge-multiple : true
185+ path : ${{ runner.temp }}/ci-image-digest
186+ if : matrix.image-source == 's3'
187+ # The tarball is the one the canary stashed, addressed by its digest as in
188+ # .github/actions/stash-restore, so a later build on `main` cannot replace it.
189+ - name : " Restore the original CI image from the RunsOn cache"
190+ shell : bash
191+ run : |
192+ set -euo pipefail
193+ digest="$(cat "${RUNNER_TEMP}/ci-image-digest/sha256")"
194+ if [[ ! "${digest}" =~ ^[0-9a-f]{64}$ ]]; then
195+ echo "::error::Malformed digest of the original CI image"
196+ exit 1
197+ fi
198+ export AWS_DEFAULT_REGION="${RUNS_ON_AWS_REGION:?not running on a RunsOn runner}"
199+ bucket="${RUNS_ON_S3_BUCKET_CACHE:?not running on a RunsOn runner}"
200+ object="s3://${bucket}/cache/airflow-stash/sha256/${digest}.tar"
201+ payload="${RUNNER_TEMP}/ci-image-stash.tar"
202+ aws s3 cp --only-show-errors "${object}" "${payload}"
203+ echo "${digest} ${payload}" | sha256sum --check --status
204+ tar -tPf "${payload}" | while IFS= read -r entry; do
205+ if [[ "${entry}" != /mnt/* ]]; then
206+ echo "::error::The original CI image stash holds ${entry} outside /mnt"
207+ exit 1
208+ fi
209+ done
210+ tar -xPf "${payload}"
211+ rm -f "${payload}"
212+ if : matrix.image-source == 's3'
160213 - name : " Load the original CI image"
161214 env :
162215 PYTHON_VERSION : ${{ matrix.python }}
0 commit comments