@@ -27,8 +27,9 @@ name: Dependency upgrade report
2727permissions :
2828 contents : read
2929 actions : read
30+ # Every canary attempt fires this workflow and gets its own report of the inputs it saved.
3031concurrency :
31- group : dependency-report-${{ github.event.workflow_run.id }}
32+ group : dependency-report-${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}
3233 cancel-in-progress : false
3334jobs :
3435 plan :
@@ -49,14 +50,19 @@ jobs:
4950 uses : actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
5051 env :
5152 SOURCE_RUN_ID : ${{ github.event.workflow_run.id }}
53+ SOURCE_RUN_ATTEMPT : ${{ github.event.workflow_run.run_attempt }}
5254 with :
5355 script : |
5456 const rawId = process.env.SOURCE_RUN_ID;
5557 if (!/^[1-9][0-9]*$/.test(rawId)) throw new Error('Invalid source run ID');
5658 const run_id = Number(rawId);
5759 if (!Number.isSafeInteger(run_id)) throw new Error('Invalid source run ID');
60+ const rawAttempt = process.env.SOURCE_RUN_ATTEMPT;
61+ if (!/^[1-9][0-9]{0,3}$/.test(rawAttempt)) throw new Error('Invalid source run attempt');
62+ const attempt_number = Number(rawAttempt);
5863 const repo = context.repo;
59- const { data: run } = await github.rest.actions.getWorkflowRun({ ...repo, run_id });
64+ const { data: run } = await github.rest.actions.getWorkflowRunAttempt(
65+ { ...repo, run_id, attempt_number });
6066 if (run.head_repository.full_name !== `${repo.owner}/${repo.repo}` ||
6167 run.head_branch !== 'main' || run.path !== '.github/workflows/ci-amd.yml' ||
6268 !['schedule', 'workflow_dispatch'].includes(run.event) || run.status !== 'completed') {
@@ -65,15 +71,28 @@ jobs:
6571 const artifacts = await github.paginate(github.rest.actions.listWorkflowRunArtifacts,
6672 { ...repo, run_id, per_page: 100 });
6773 const include = [];
74+ const skipped = [];
75+ const explained = [];
6876 const inputName = new RegExp('^dependency-report-inputs-(3\\.[0-9]+)-' +
69- '(constraints(?:-source-providers|-no-providers)?)-(true|false)$');
70- for (const input of artifacts) {
71- const match = inputName.exec(input.name);
72- if (!match) continue;
73- const [, python, mode, useUv] = match;
77+ '(constraints(?:-source-providers|-no-providers)?)-(true|false)-([1-9][0-9]*)$');
78+ const saved = artifacts.map(a => [a, inputName.exec(a.name)]).filter(([, match]) => match);
79+ for (const [input, [, python, mode, useUv, attempt]] of saved) {
80+ if (attempt !== rawAttempt) continue;
81+ const entry = `${python}:${mode}`;
82+ // A re-run canary saves its inputs again; they are explained only for the first attempt.
83+ if (saved.some(([, m]) => m[1] === python && m[2] === mode && m[3] === useUv &&
84+ Number(m[4]) < attempt_number)) {
85+ explained.push(entry);
86+ continue;
87+ }
88+ // The stash action names the artifact after the stash key, with '/' as '_', and the branch.
7489 const image = artifacts.find(a => a.name === `ci-image-save-v3-linux_amd64-${python}-main`);
75- if (input.expired || !image || image.expired) {
76- throw new Error(`Original inputs or CI image unavailable for ${python}:${mode}`);
90+ const missing = input.expired ? 'inputs expired' :
91+ !image ? 'CI image missing' : image.expired ? 'CI image expired' : '';
92+ if (missing) {
93+ core.warning(`Skipping ${entry}: original inputs or CI image unavailable (${missing})`);
94+ skipped.push(`${entry} (${missing})`);
95+ continue;
7796 }
7897 include.push({ python, mode, 'use-uv': useUv,
7998 'inputs-id': input.id, 'image-id': image.id });
@@ -82,15 +101,19 @@ jobs:
82101 core.setOutput('has-reports', include.length > 0 ? 'true' : 'false');
83102 core.setOutput('source-sha', run.head_sha);
84103 core.setOutput('source-run-id', rawId);
85- if (!include.length) {
86- if (Number(process.env.GITHUB_RUN_ATTEMPT) > 1) {
87- throw new Error('Saved report inputs are missing or expired');
88- }
89- core.notice('No saved report inputs: this run did not request independent diagnostics');
104+ if (!include.length && skipped.length && Number(process.env.GITHUB_RUN_ATTEMPT) > 1) {
105+ throw new Error('Saved report inputs are missing or expired');
106+ }
107+ if (!include.length && !skipped.length) {
108+ core.notice(explained.length ?
109+ 'The saved report inputs were already explained for an earlier canary attempt' :
110+ 'No saved report inputs: this run did not request independent diagnostics');
90111 }
91112 await core.summary.addHeading('Dependency upgrade diagnostics')
92- .addLink(' Source canary run' , run.html_url)
113+ .addLink(` Source canary run (attempt ${rawAttempt})` , run.html_url)
93114 .addRaw(`\n\nSource revision: ${run.head_sha}\n\nReports: ${include.length}\n`)
115+ .addRaw(skipped.length ? `\nSkipped: ${skipped.join(', ')}\n` : '')
116+ .addRaw(explained.length ? `\nExplained for an earlier attempt: ${explained.join(', ')}\n` : '')
94117 .write();
95118
96119 explain :
@@ -115,12 +138,18 @@ jobs:
115138 with :
116139 ref : ${{ needs.plan.outputs.source-sha }}
117140 persist-credentials : false
118- - name : " Install Breeze"
119- uses : ./.github/actions/breeze
141+ # Docker moves to /mnt as in the image build jobs: the loaded image and uv resolutions outgrow /.
142+ - name : " Free up disk space"
143+ shell : bash
144+ run : ./scripts/tools/free_up_disk_space.sh
120145 - name : " Make /mnt writeable"
121146 run : ./scripts/ci/make_mnt_writeable.sh
147+ - name : " Move docker to /mnt"
148+ run : ./scripts/ci/move_docker_to_mnt.sh
149+ - name : " Install Breeze"
150+ uses : ./.github/actions/breeze
122151 - name : " Download the original CI image"
123- uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
152+ uses : actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
124153 with :
125154 artifact-ids : ${{ matrix.image-id }}
126155 run-id : ${{ needs.plan.outputs.source-run-id }}
@@ -132,7 +161,7 @@ jobs:
132161 PYTHON_VERSION : ${{ matrix.python }}
133162 run : breeze ci-image load --platform linux/amd64 --python "${PYTHON_VERSION}" --image-file-dir /mnt
134163 - name : " Download the constraints used by the quick summary"
135- uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
164+ uses : actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
136165 with :
137166 artifact-ids : ${{ matrix.inputs-id }}
138167 run-id : ${{ needs.plan.outputs.source-run-id }}
@@ -145,20 +174,24 @@ jobs:
145174 PYTHON_VERSION : ${{ matrix.python }}
146175 CONSTRAINTS_MODE : ${{ matrix.mode }}
147176 SOURCE_RUN_ID : ${{ needs.plan.outputs.source-run-id }}
177+ SOURCE_SHA : ${{ needs.plan.outputs.source-sha }}
148178 run : |
149179 {
150180 echo "## Dependency upgrade explanations"
151- echo "Source canary run: ${SOURCE_RUN_ID}"
181+ echo "Source canary run: ${SOURCE_RUN_ID}; source revision: ${SOURCE_SHA} "
152182 echo "Constraints commit: $(cat files/dependency-report/constraints-commit.txt)"
153183 echo "Python: ${PYTHON_VERSION}; mode: ${CONSTRAINTS_MODE}"
184+ echo "The constraints are the constraints branch the canary's summary checked, not ones built"
185+ echo "from the source revision: dependency bounds changed between the two can show up below as"
186+ echo "conflicts or as stale constraints."
154187 } >> "${GITHUB_STEP_SUMMARY}"
155188 breeze release-management constraints-version-check \
156189 --python "${PYTHON_VERSION}" --airflow-constraints-mode "${CONSTRAINTS_MODE}" \
157190 --constraints-file files/dependency-report/constraints.txt --explain-why \
158191 2>&1 | tee files/dependency-report/explanations.txt
159192 - name : " Save diagnostic output, including partial output on failure"
160193 if : always()
161- uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
194+ uses : actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
162195 with :
163196 name : dependency-explanations-${{ matrix.python }}-${{ matrix.mode }}
164197 path : files/dependency-report/
0 commit comments