Skip to content

Commit 2eeff98

Browse files
authored
[v3-2-test] Replace upgrade-check build failure with scheduled upgrade PR workflow (#64836) (#64915)
Move upgrade checks from basic-tests.yml (where they failed the build) to a scheduled workflow that runs Mon/Wed/Fri for main and Tue/Thu for v3-2-test. The workflow uses `breeze ci upgrade` to run all upgrade steps and create a draft PR. A Slack notification is sent to #internal-airflow-ci-cd when a PR needs review. Changes: - Remove upgrade-check job from basic-tests.yml - Add reusable upgrade-check.yml workflow (workflow_call) - Add scheduled-upgrade-check.yml caller (cron + workflow_dispatch) - Enhance breeze ci upgrade: --draft flag, stable branch naming, existing PR detection, no -w flag for CI compatibility (cherry picked from commit dd0ff5a)
1 parent 4b5b7d0 commit 2eeff98

8 files changed

Lines changed: 311 additions & 133 deletions

File tree

.github/workflows/basic-tests.yml

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -301,89 +301,6 @@ jobs:
301301
fetch-depth: 2
302302
persist-credentials: false
303303

304-
upgrade-check:
305-
timeout-minutes: 45
306-
name: "Upgrade checks"
307-
runs-on: ${{ fromJSON(inputs.runners) }}
308-
env:
309-
PYTHON_MAJOR_MINOR_VERSION: "${{ inputs.default-python-version }}"
310-
if: inputs.canary-run == 'true'
311-
steps:
312-
- name: "Cleanup repo"
313-
shell: bash
314-
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
315-
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
316-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
317-
with:
318-
persist-credentials: false
319-
- name: "Install Breeze"
320-
uses: ./.github/actions/breeze
321-
id: breeze
322-
- name: "Install prek"
323-
uses: ./.github/actions/install-prek
324-
id: prek
325-
with:
326-
python-version: ${{ steps.breeze.outputs.host-python-version }}
327-
platform: ${{ inputs.platform }}
328-
save-cache: false
329-
- name: "Autoupdate all prek hooks"
330-
run: prek autoupdate --cooldown-days 4 --freeze
331-
- name: "Check if there are any changes in prek hooks"
332-
run: |
333-
if ! git diff --exit-code; then
334-
echo -e "\n\033[0;31mThere are changes in prek hooks after upgrade check.\033[0m"
335-
echo -e "\n\033[0;33mHow to fix:\033[0m Run \`breeze ci upgrade\` locally to fix it!.\n"
336-
exit 1
337-
fi
338-
- name: "Run automated upgrade for chart dependencies"
339-
run: >
340-
prek
341-
--all-files --show-diff-on-failure --color always --verbose
342-
--stage manual
343-
update-chart-dependencies
344-
if: always()
345-
# For UV we are not failing the upgrade installers check if it is updated because
346-
# it is upgraded very frequently, so we want to manually upgrade it rather than
347-
# get notified about it - until it stabilizes in 1.* version
348-
- name: "Run automated upgrade for uv, prek (not failing - just informational)"
349-
run: >
350-
prek
351-
--all-files --show-diff-on-failure --color always --verbose
352-
--stage manual upgrade-important-versions || true
353-
if: always()
354-
env:
355-
UPGRADE_FLIT: "false"
356-
UPGRADE_GITPYTHON: "false"
357-
UPGRADE_GOLANG: "false"
358-
UPGRADE_HATCH: "false"
359-
UPGRADE_HATCHLING: "false"
360-
UPGRADE_MYPY: "false"
361-
UPGRADE_NODE_LTS: "false"
362-
UPGRADE_PIP: "false"
363-
UPGRADE_PYTHON: "false"
364-
UPGRADE_PYYAML: "false"
365-
UPGRADE_RICH: "false"
366-
UPGRADE_RUFF: "false"
367-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
368-
- name: "Run automated upgrade for important versions minus uv (failing if needed)"
369-
run: |
370-
if ! prek \
371-
--all-files --show-diff-on-failure --color always --verbose \
372-
--stage manual upgrade-important-versions; then
373-
echo -e "\n\033[0;31mThere are changes in prek hooks after upgrade check.\033[0m"
374-
echo -e "\n\033[0;33mHow to fix:\033[0m Run \`breeze ci upgrade\` locally to fix it!.\n"
375-
exit 1
376-
fi
377-
if: always()
378-
env:
379-
UPGRADE_UV: "false"
380-
UPGRADE_PREK: "false"
381-
UPGRADE_MPROCS: "false"
382-
UPGRADE_PROTOC: "false"
383-
UPGRADE_OPENAPI_GENERATOR: "false"
384-
UPGRADE_COOLDOWN_DAYS: "4"
385-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
386-
387304
test-airflow-release-commands:
388305
timeout-minutes: 80
389306
name: "Test Airflow release commands"
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
---
19+
name: "[main] Scheduled CI upgrade check"
20+
on: # yamllint disable-line rule:truthy
21+
schedule:
22+
# Mon, Wed, Fri at 06:00 UTC
23+
- cron: '0 6 * * 1,3,5'
24+
workflow_dispatch:
25+
permissions:
26+
contents: read
27+
jobs:
28+
upgrade-main:
29+
name: "[main] Upgrade"
30+
uses: ./.github/workflows/upgrade-check.yml
31+
with:
32+
target-branch: main
33+
secrets:
34+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
---
19+
name: "[v3-2-test] Scheduled CI upgrade check"
20+
on: # yamllint disable-line rule:truthy
21+
schedule:
22+
# Tue, Thu at 06:00 UTC
23+
- cron: '0 6 * * 2,4'
24+
workflow_dispatch:
25+
permissions:
26+
contents: read
27+
jobs:
28+
upgrade-v3-2-test:
29+
name: "[v3-2-test] Upgrade"
30+
uses: ./.github/workflows/upgrade-check.yml
31+
with:
32+
target-branch: v3-2-test
33+
secrets:
34+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
---
19+
name: Upgrade check
20+
on: # yamllint disable-line rule:truthy
21+
workflow_call:
22+
inputs:
23+
target-branch:
24+
description: >-
25+
Branch to upgrade (e.g. 'main' or 'v3-2-test')
26+
required: true
27+
type: string
28+
secrets:
29+
SLACK_BOT_TOKEN:
30+
description: "Slack bot token for notifications"
31+
required: true
32+
permissions:
33+
contents: write
34+
pull-requests: write
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
38+
TARGET_BRANCH: ${{ inputs.target-branch }}
39+
jobs:
40+
createupgrade-check:
41+
timeout-minutes: 45
42+
name: >-
43+
[${{ inputs.target-branch }}] Upgrade checks and PR
44+
runs-on: ["ubuntu-22.04"]
45+
steps:
46+
- name: >-
47+
[${{ inputs.target-branch }}] Cleanup repo
48+
shell: bash
49+
run: >
50+
docker run -v "${GITHUB_WORKSPACE}:/workspace"
51+
-u 0:0 bash -c "rm -rf /workspace/*"
52+
- name: >-
53+
[${{ inputs.target-branch }}] Checkout
54+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
55+
with:
56+
ref: ${{ inputs.target-branch }}
57+
fetch-depth: 0
58+
persist-credentials: false
59+
- name: >-
60+
[${{ inputs.target-branch }}] Configure git credentials
61+
run: |
62+
git remote set-url origin \
63+
"https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
64+
git config user.name "github-actions[bot]"
65+
git config user.email \
66+
"41898282+github-actions[bot]@users.noreply.github.com"
67+
- name: >-
68+
[${{ inputs.target-branch }}] Install Breeze
69+
uses: ./.github/actions/breeze
70+
id: breeze
71+
- name: >-
72+
[${{ inputs.target-branch }}] Install prek
73+
uses: ./.github/actions/install-prek
74+
id: prek
75+
with:
76+
python-version: >-
77+
${{ steps.breeze.outputs.host-python-version }}
78+
platform: "linux/amd64"
79+
save-cache: false
80+
- name: >-
81+
[${{ inputs.target-branch }}] Run breeze ci upgrade
82+
run: >
83+
breeze ci upgrade
84+
--target-branch "${TARGET_BRANCH}"
85+
--create-pr
86+
--draft
87+
--switch-to-base
88+
--no-k8s-schema-sync
89+
--answer yes
90+
- name: >-
91+
[${{ inputs.target-branch }}] Find upgrade PR
92+
id: find-pr
93+
run: |
94+
PR_URL=$(gh pr list \
95+
--repo "${GITHUB_REPOSITORY}" \
96+
--head "ci-upgrade-${TARGET_BRANCH}" \
97+
--base "${TARGET_BRANCH}" \
98+
--state open \
99+
--json url \
100+
--jq '.[0].url' 2>/dev/null || true)
101+
echo "pr-url=${PR_URL}" >> "${GITHUB_OUTPUT}"
102+
- name: >-
103+
[${{ inputs.target-branch }}] Notify Slack
104+
if: steps.find-pr.outputs.pr-url != ''
105+
uses: >-
106+
slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95
107+
with:
108+
method: chat.postMessage
109+
token: ${{ env.SLACK_BOT_TOKEN }}
110+
payload: |
111+
channel: "internal-airflow-ci-cd"
112+
text: >-
113+
🔧 [${{ inputs.target-branch }}] CI upgrade PR
114+
ready for review. Please undraft, review and
115+
merge: ${{ steps.find-pr.outputs.pr-url }}
116+
blocks:
117+
- type: section
118+
text:
119+
type: mrkdwn
120+
text: >-
121+
🔧 *[${{ inputs.target-branch }}] CI upgrade
122+
PR ready for review*
123+
124+
Please undraft, review and merge:
125+
<${{ steps.find-pr.outputs.pr-url }}|View PR>

0 commit comments

Comments
 (0)