zozo123 commented on code in PR #74311:
URL: https://github.com/apache/airflow/pull/74311#discussion_r4308440465


##########
.github/workflows/dependency-upgrade-report.yml:
##########
@@ -0,0 +1,167 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+---
+name: Dependency upgrade report
+# Both the job gate and the API validation reject PRs and foreign 
repositories. Only
+# completed main schedule/dispatch runs are executed, with a read-only token 
and no secrets.
+"on":  # zizmor: ignore[dangerous-triggers]
+  workflow_run:
+    workflows: ["Tests (AMD)"]
+    types: [completed]
+    branches: [main]
+permissions:
+  contents: read
+  actions: read
+concurrency:
+  group: dependency-report-${{ github.event.workflow_run.id }}
+  cancel-in-progress: false
+jobs:
+  plan:
+    runs-on: ubuntu-slim
+    timeout-minutes: 5
+    if: >-
+      github.event.workflow_run.head_repository.full_name == github.repository 
&&
+      (github.event.workflow_run.event == 'schedule' ||
+       github.event.workflow_run.event == 'workflow_dispatch')
+    outputs:
+      matrix: ${{ steps.plan.outputs.matrix }}
+      has-reports: ${{ steps.plan.outputs.has-reports }}
+      source-sha: ${{ steps.plan.outputs.source-sha }}
+      source-run-id: ${{ steps.plan.outputs.source-run-id }}
+    steps:
+      - name: "Select inputs from the original canary run"
+        id: plan
+        uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3  
# v9.0.0
+        env:
+          SOURCE_RUN_ID: ${{ github.event.workflow_run.id }}
+        with:
+          script: |
+            const rawId = process.env.SOURCE_RUN_ID;
+            if (!/^[1-9][0-9]*$/.test(rawId)) throw new Error('Invalid source 
run ID');
+            const run_id = Number(rawId);
+            if (!Number.isSafeInteger(run_id)) throw new Error('Invalid source 
run ID');
+            const repo = context.repo;
+            const { data: run } = await github.rest.actions.getWorkflowRun({ 
...repo, run_id });
+            if (run.head_repository.full_name !== `${repo.owner}/${repo.repo}` 
||
+                run.head_branch !== 'main' || run.path !== 
'.github/workflows/ci-amd.yml' ||
+                !['schedule', 'workflow_dispatch'].includes(run.event) || 
run.status !== 'completed') {
+              throw new Error('Only completed main AMD canary runs are 
supported');
+            }
+            const artifacts = await 
github.paginate(github.rest.actions.listWorkflowRunArtifacts,
+              { ...repo, run_id, per_page: 100 });
+            const include = [];
+            const inputName = new 
RegExp('^dependency-report-inputs-(3\\.[0-9]+)-' +
+              
'(constraints(?:-source-providers|-no-providers)?)-(true|false)$');
+            for (const input of artifacts) {
+              const match = inputName.exec(input.name);
+              if (!match) continue;
+              const [, python, mode, useUv] = match;
+              const image = artifacts.find(a => a.name === 
`ci-image-save-v3-linux_amd64-${python}-main`);
+              if (input.expired || !image || image.expired) {
+                throw new Error(`Original inputs or CI image unavailable for 
${python}:${mode}`);
+              }

Review Comment:
   Done as you suggested:
   - An unavailable entry gets a `core.warning` and is listed under "Skipped" 
in the summary. The other entries are still planned.
   - `test_plan_does_not_substitute_newer_artifacts` now asserts that the entry 
is skipped.
   
   I'd keep the dedicated image artifact for a follow-up, since it adds a 
multi-GB upload to every canary.



##########
.github/workflows/dependency-upgrade-report.yml:
##########
@@ -0,0 +1,167 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+---
+name: Dependency upgrade report
+# Both the job gate and the API validation reject PRs and foreign 
repositories. Only
+# completed main schedule/dispatch runs are executed, with a read-only token 
and no secrets.
+"on":  # zizmor: ignore[dangerous-triggers]
+  workflow_run:
+    workflows: ["Tests (AMD)"]
+    types: [completed]
+    branches: [main]
+permissions:
+  contents: read
+  actions: read
+concurrency:
+  group: dependency-report-${{ github.event.workflow_run.id }}
+  cancel-in-progress: false
+jobs:
+  plan:
+    runs-on: ubuntu-slim
+    timeout-minutes: 5
+    if: >-
+      github.event.workflow_run.head_repository.full_name == github.repository 
&&
+      (github.event.workflow_run.event == 'schedule' ||
+       github.event.workflow_run.event == 'workflow_dispatch')
+    outputs:
+      matrix: ${{ steps.plan.outputs.matrix }}
+      has-reports: ${{ steps.plan.outputs.has-reports }}
+      source-sha: ${{ steps.plan.outputs.source-sha }}
+      source-run-id: ${{ steps.plan.outputs.source-run-id }}
+    steps:
+      - name: "Select inputs from the original canary run"
+        id: plan
+        uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3  
# v9.0.0
+        env:
+          SOURCE_RUN_ID: ${{ github.event.workflow_run.id }}
+        with:
+          script: |
+            const rawId = process.env.SOURCE_RUN_ID;
+            if (!/^[1-9][0-9]*$/.test(rawId)) throw new Error('Invalid source 
run ID');
+            const run_id = Number(rawId);
+            if (!Number.isSafeInteger(run_id)) throw new Error('Invalid source 
run ID');
+            const repo = context.repo;
+            const { data: run } = await github.rest.actions.getWorkflowRun({ 
...repo, run_id });
+            if (run.head_repository.full_name !== `${repo.owner}/${repo.repo}` 
||
+                run.head_branch !== 'main' || run.path !== 
'.github/workflows/ci-amd.yml' ||
+                !['schedule', 'workflow_dispatch'].includes(run.event) || 
run.status !== 'completed') {
+              throw new Error('Only completed main AMD canary runs are 
supported');
+            }
+            const artifacts = await 
github.paginate(github.rest.actions.listWorkflowRunArtifacts,
+              { ...repo, run_id, per_page: 100 });
+            const include = [];
+            const inputName = new 
RegExp('^dependency-report-inputs-(3\\.[0-9]+)-' +
+              
'(constraints(?:-source-providers|-no-providers)?)-(true|false)$');
+            for (const input of artifacts) {
+              const match = inputName.exec(input.name);
+              if (!match) continue;
+              const [, python, mode, useUv] = match;
+              const image = artifacts.find(a => a.name === 
`ci-image-save-v3-linux_amd64-${python}-main`);

Review Comment:
   Agreed that nothing guaranteed it. A new test reads the stash key from 
`ci-image-build.yml` and applies the stash action's naming rule 
(`stash/shared/mung.py` at the pinned SHA). It then checks that the plan finds 
the image under that name. A rename on either side now fails a test instead of 
silently skipping every report.



##########
.github/workflows/dependency-upgrade-report.yml:
##########
@@ -0,0 +1,167 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+---
+name: Dependency upgrade report
+# Both the job gate and the API validation reject PRs and foreign 
repositories. Only
+# completed main schedule/dispatch runs are executed, with a read-only token 
and no secrets.
+"on":  # zizmor: ignore[dangerous-triggers]
+  workflow_run:
+    workflows: ["Tests (AMD)"]
+    types: [completed]
+    branches: [main]
+permissions:
+  contents: read
+  actions: read
+concurrency:
+  group: dependency-report-${{ github.event.workflow_run.id }}
+  cancel-in-progress: false
+jobs:
+  plan:
+    runs-on: ubuntu-slim
+    timeout-minutes: 5
+    if: >-
+      github.event.workflow_run.head_repository.full_name == github.repository 
&&
+      (github.event.workflow_run.event == 'schedule' ||
+       github.event.workflow_run.event == 'workflow_dispatch')
+    outputs:
+      matrix: ${{ steps.plan.outputs.matrix }}
+      has-reports: ${{ steps.plan.outputs.has-reports }}
+      source-sha: ${{ steps.plan.outputs.source-sha }}
+      source-run-id: ${{ steps.plan.outputs.source-run-id }}
+    steps:
+      - name: "Select inputs from the original canary run"
+        id: plan
+        uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3  
# v9.0.0
+        env:
+          SOURCE_RUN_ID: ${{ github.event.workflow_run.id }}
+        with:
+          script: |
+            const rawId = process.env.SOURCE_RUN_ID;
+            if (!/^[1-9][0-9]*$/.test(rawId)) throw new Error('Invalid source 
run ID');
+            const run_id = Number(rawId);
+            if (!Number.isSafeInteger(run_id)) throw new Error('Invalid source 
run ID');
+            const repo = context.repo;
+            const { data: run } = await github.rest.actions.getWorkflowRun({ 
...repo, run_id });
+            if (run.head_repository.full_name !== `${repo.owner}/${repo.repo}` 
||
+                run.head_branch !== 'main' || run.path !== 
'.github/workflows/ci-amd.yml' ||
+                !['schedule', 'workflow_dispatch'].includes(run.event) || 
run.status !== 'completed') {
+              throw new Error('Only completed main AMD canary runs are 
supported');
+            }
+            const artifacts = await 
github.paginate(github.rest.actions.listWorkflowRunArtifacts,
+              { ...repo, run_id, per_page: 100 });
+            const include = [];
+            const inputName = new 
RegExp('^dependency-report-inputs-(3\\.[0-9]+)-' +
+              
'(constraints(?:-source-providers|-no-providers)?)-(true|false)$');
+            for (const input of artifacts) {
+              const match = inputName.exec(input.name);
+              if (!match) continue;
+              const [, python, mode, useUv] = match;
+              const image = artifacts.find(a => a.name === 
`ci-image-save-v3-linux_amd64-${python}-main`);
+              if (input.expired || !image || image.expired) {
+                throw new Error(`Original inputs or CI image unavailable for 
${python}:${mode}`);
+              }
+              include.push({ python, mode, 'use-uv': useUv,
+                'inputs-id': input.id, 'image-id': image.id });
+            }
+            core.setOutput('matrix', JSON.stringify({ include }));
+            core.setOutput('has-reports', include.length > 0 ? 'true' : 
'false');
+            core.setOutput('source-sha', run.head_sha);
+            core.setOutput('source-run-id', rawId);
+            if (!include.length) {
+              if (Number(process.env.GITHUB_RUN_ATTEMPT) > 1) {

Review Comment:
   Fixed: a report whose canary saved no inputs now posts the same notice on 
every attempt. A re-run still fails in one case only: inputs were saved, but 
none of them can be explained any more. That is the case the error message 
describes.



##########
.github/workflows/dependency-upgrade-report.yml:
##########
@@ -0,0 +1,167 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+---
+name: Dependency upgrade report
+# Both the job gate and the API validation reject PRs and foreign 
repositories. Only
+# completed main schedule/dispatch runs are executed, with a read-only token 
and no secrets.
+"on":  # zizmor: ignore[dangerous-triggers]
+  workflow_run:
+    workflows: ["Tests (AMD)"]
+    types: [completed]
+    branches: [main]
+permissions:
+  contents: read
+  actions: read
+concurrency:
+  group: dependency-report-${{ github.event.workflow_run.id }}
+  cancel-in-progress: false

Review Comment:
   - Report inputs now carry the canary attempt in their name.
   - The plan reads the triggering attempt with `getWorkflowRunAttempt`.
   - Inputs that an earlier attempt already saved are not explained again, and 
the summary says so.
   - The concurrency group is per run id and attempt, so one attempt's queued 
report can't cancel another's.



##########
.github/workflows/dependency-upgrade-report.yml:
##########
@@ -0,0 +1,167 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+---
+name: Dependency upgrade report
+# Both the job gate and the API validation reject PRs and foreign 
repositories. Only
+# completed main schedule/dispatch runs are executed, with a read-only token 
and no secrets.
+"on":  # zizmor: ignore[dangerous-triggers]
+  workflow_run:
+    workflows: ["Tests (AMD)"]
+    types: [completed]
+    branches: [main]
+permissions:
+  contents: read
+  actions: read
+concurrency:
+  group: dependency-report-${{ github.event.workflow_run.id }}
+  cancel-in-progress: false
+jobs:
+  plan:
+    runs-on: ubuntu-slim
+    timeout-minutes: 5
+    if: >-
+      github.event.workflow_run.head_repository.full_name == github.repository 
&&
+      (github.event.workflow_run.event == 'schedule' ||
+       github.event.workflow_run.event == 'workflow_dispatch')
+    outputs:
+      matrix: ${{ steps.plan.outputs.matrix }}
+      has-reports: ${{ steps.plan.outputs.has-reports }}
+      source-sha: ${{ steps.plan.outputs.source-sha }}
+      source-run-id: ${{ steps.plan.outputs.source-run-id }}
+    steps:
+      - name: "Select inputs from the original canary run"
+        id: plan
+        uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3  
# v9.0.0
+        env:
+          SOURCE_RUN_ID: ${{ github.event.workflow_run.id }}
+        with:
+          script: |
+            const rawId = process.env.SOURCE_RUN_ID;
+            if (!/^[1-9][0-9]*$/.test(rawId)) throw new Error('Invalid source 
run ID');
+            const run_id = Number(rawId);
+            if (!Number.isSafeInteger(run_id)) throw new Error('Invalid source 
run ID');
+            const repo = context.repo;
+            const { data: run } = await github.rest.actions.getWorkflowRun({ 
...repo, run_id });
+            if (run.head_repository.full_name !== `${repo.owner}/${repo.repo}` 
||
+                run.head_branch !== 'main' || run.path !== 
'.github/workflows/ci-amd.yml' ||
+                !['schedule', 'workflow_dispatch'].includes(run.event) || 
run.status !== 'completed') {
+              throw new Error('Only completed main AMD canary runs are 
supported');
+            }
+            const artifacts = await 
github.paginate(github.rest.actions.listWorkflowRunArtifacts,
+              { ...repo, run_id, per_page: 100 });
+            const include = [];
+            const inputName = new 
RegExp('^dependency-report-inputs-(3\\.[0-9]+)-' +
+              
'(constraints(?:-source-providers|-no-providers)?)-(true|false)$');
+            for (const input of artifacts) {
+              const match = inputName.exec(input.name);
+              if (!match) continue;
+              const [, python, mode, useUv] = match;
+              const image = artifacts.find(a => a.name === 
`ci-image-save-v3-linux_amd64-${python}-main`);
+              if (input.expired || !image || image.expired) {
+                throw new Error(`Original inputs or CI image unavailable for 
${python}:${mode}`);
+              }
+              include.push({ python, mode, 'use-uv': useUv,
+                'inputs-id': input.id, 'image-id': image.id });
+            }
+            core.setOutput('matrix', JSON.stringify({ include }));
+            core.setOutput('has-reports', include.length > 0 ? 'true' : 
'false');
+            core.setOutput('source-sha', run.head_sha);
+            core.setOutput('source-run-id', rawId);
+            if (!include.length) {
+              if (Number(process.env.GITHUB_RUN_ATTEMPT) > 1) {
+                throw new Error('Saved report inputs are missing or expired');
+              }
+              core.notice('No saved report inputs: this run did not request 
independent diagnostics');
+            }
+            await core.summary.addHeading('Dependency upgrade diagnostics')
+              .addLink('Source canary run', run.html_url)
+              .addRaw(`\n\nSource revision: ${run.head_sha}\n\nReports: 
${include.length}\n`)
+              .write();
+
+  explain:
+    needs: plan
+    if: needs.plan.outputs.has-reports == 'true'
+    name: "Explain ${{ matrix.python }}:${{ matrix.mode }}"
+    runs-on: ubuntu-22.04
+    timeout-minutes: 90
+    strategy:
+      fail-fast: false
+      max-parallel: 3
+      matrix: ${{ fromJSON(needs.plan.outputs.matrix) }}
+    env:
+      GITHUB_REPOSITORY: ${{ github.repository }}
+      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+      GITHUB_USERNAME: ${{ github.actor }}
+      VERBOSE: "false"
+      USE_UV: ${{ matrix.use-uv }}
+    steps:
+      - name: "Checkout the tested revision"
+        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1  # 
v7.0.1
+        with:
+          ref: ${{ needs.plan.outputs.source-sha }}
+          persist-credentials: false
+      - name: "Install Breeze"
+        uses: ./.github/actions/breeze
+      - name: "Make /mnt writeable"
+        run: ./scripts/ci/make_mnt_writeable.sh

Review Comment:
   Added `free_up_disk_space.sh`, `make_mnt_writeable.sh` and 
`move_docker_to_mnt.sh` before installing breeze, the same as the image build 
job. A test checks that they match.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to