From 2cb588058ca95e69b7458bc44b59bfe773da3ae8 Mon Sep 17 00:00:00 2001 From: Derrick Williams Date: Wed, 27 May 2026 17:27:44 +0000 Subject: [PATCH 1/9] initial draft bom workflow --- .github/workflows/beam_Upgrade_GCP_BOM.yml | 85 ++++++++++++++++++++++ scripts/tools/gcp_bom_upgrade_check.py | 62 ++++++++++++++++ 2 files changed, 147 insertions(+) create mode 100644 .github/workflows/beam_Upgrade_GCP_BOM.yml create mode 100644 scripts/tools/gcp_bom_upgrade_check.py diff --git a/.github/workflows/beam_Upgrade_GCP_BOM.yml b/.github/workflows/beam_Upgrade_GCP_BOM.yml new file mode 100644 index 000000000000..fb3360824446 --- /dev/null +++ b/.github/workflows/beam_Upgrade_GCP_BOM.yml @@ -0,0 +1,85 @@ +# 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: Upgrade GCP Platform Libraries BOM + +on: + schedule: + - cron: "0 0 * * 0" # Weekly on Sundays at 00:00 UTC + workflow_dispatch: + +permissions: + contents: write + pull-requests: write + checks: read + issues: read + statuses: read + +concurrency: + group: '${{ github.workflow }} @ ${{ github.ref }}' + cancel-in-progress: true + +jobs: + upgrade_gcp_bom: + runs-on: [self-hosted, ubuntu-24.04, main] + name: Upgrade GCP BOM + steps: + - name: Checkout code + uses: actions/checkout@v6 + - name: Setup environment + uses: ./.github/actions/setup-environment-action + with: + python-version: 3.11 + java-version: default + go-version: default + - name: Check if new BOM is available + id: check_bom + run: python3 scripts/tools/gcp_bom_upgrade_check.py + - name: Run bomupgrader + if: steps.check_bom.outputs.should_upgrade == 'true' + run: python3 scripts/tools/bomupgrader.py ${{ steps.check_bom.outputs.latest_version }} + - name: Install gh cli + if: steps.check_bom.outputs.should_upgrade == 'true' + uses: ./.github/actions/setup-gh-cli-linux + - name: Set git config + if: steps.check_bom.outputs.should_upgrade == 'true' + run: | + git config user.name $GITHUB_ACTOR + git config user.email actions@"$RUNNER_NAME".local + - name: Commit Changes and create PR + if: steps.check_bom.outputs.should_upgrade == 'true' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + LATEST_VER: ${{ steps.check_bom.outputs.latest_version }} + CURRENT_VER: ${{ steps.check_bom.outputs.current_version }} + run: | + branchName=upgrade_gcp_bom_${LATEST_VER//./_} + git checkout -b $branchName + git add -A + git diff-index --quiet HEAD || gitdiff=$? || echo $? + if [[ $gitDiff != 0 ]]; then + echo "Changes are ready to commit" + git commit -m "Upgrade GCP Libraries BOM to ${LATEST_VER}" --quiet + git push origin $branchName --quiet + + PR_BODY="This PR was created by automation. It upgrades the Google Cloud Platform Libraries BOM from **${CURRENT_VER}** to **${LATEST_VER}** and updates Netty, gRPC, Arrow, Gax, Protobuf, and OpenTelemetry versions to match. + + Please review the changes and merge if all tests pass." + + GITHUB_PR_URL=$(gh pr create --title "Upgrade GCP Libraries BOM to ${LATEST_VER}" --body "$PR_BODY" --label "dependencies" --base master) + echo "Link of the new PR: $GITHUB_PR_URL" + else + echo "No changes on the files" + fi diff --git a/scripts/tools/gcp_bom_upgrade_check.py b/scripts/tools/gcp_bom_upgrade_check.py new file mode 100644 index 000000000000..7037ba68dbe5 --- /dev/null +++ b/scripts/tools/gcp_bom_upgrade_check.py @@ -0,0 +1,62 @@ +# 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. + +import urllib.request +import re +import os + +def get_latest_bom(): + url = "https://repo1.maven.org/maven2/com/google/cloud/libraries-bom/maven-metadata.xml" + with urllib.request.urlopen(url) as response: + xml = response.read().decode('utf-8') + match = re.search(r'([^<]+)', xml) + if match: + return match.group(1) + raise RuntimeError("Could not find latest release in Maven metadata") + +def get_current_bom(): + path = "buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy" + with open(path) as f: + content = f.read() + match = re.search(r'google_cloud_platform_libraries_bom\s*:\s*[\"\']com\.google\.cloud:libraries-bom:([0-9.]+)[\"\']', content) + if match: + return match.group(1) + raise RuntimeError("Could not find current libraries-bom in BeamModulePlugin.groovy") + +def to_tuple(version_str): + return tuple(map(int, version_str.split('.'))) + +def main(): + latest = get_latest_bom() + current = get_current_bom() + print(f"Latest libraries-bom version: {latest}") + print(f"Current libraries-bom version: {current}") + + should_upgrade = to_tuple(latest) > to_tuple(current) + + github_output = os.getenv('GITHUB_OUTPUT') + if github_output: + with open(github_output, 'a') as f: + f.write(f"should_upgrade={str(should_upgrade).lower()}\n") + f.write(f"latest_version={latest}\n") + f.write(f"current_version={current}\n") + + if should_upgrade: + print("A newer version of libraries-bom is available. Upgrade needed.") + else: + print("libraries-bom is up-to-date.") + +if __name__ == '__main__': + main() From d2a56a59aa402d52b666123299f729f6d00c9628 Mon Sep 17 00:00:00 2001 From: Derrick Williams Date: Wed, 27 May 2026 17:38:54 +0000 Subject: [PATCH 2/9] add temp fix --- .github/workflows/beam_Upgrade_GCP_BOM.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/beam_Upgrade_GCP_BOM.yml b/.github/workflows/beam_Upgrade_GCP_BOM.yml index fb3360824446..4c9ca7d594aa 100644 --- a/.github/workflows/beam_Upgrade_GCP_BOM.yml +++ b/.github/workflows/beam_Upgrade_GCP_BOM.yml @@ -19,6 +19,9 @@ on: schedule: - cron: "0 0 * * 0" # Weekly on Sundays at 00:00 UTC workflow_dispatch: + push: + branches: + - 20260527_createBOMWorkflow permissions: contents: write From 8ff89afe4332f974e9ca32c8d2ef06f5ced82506 Mon Sep 17 00:00:00 2001 From: Derrick Williams Date: Wed, 27 May 2026 17:46:53 +0000 Subject: [PATCH 3/9] Document new GCP BOM upgrade workflow in README --- .github/workflows/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index c6a95b29b4c0..707f3e3fbed8 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -542,3 +542,4 @@ PostCommit Jobs run in a schedule against master branch and generally do not get | [ Infrastructure Policy Enforcer ](https://github.com/apache/beam/actions/workflows/beam_Infrastructure_PolicyEnforcer.yml) | N/A | [![.github/workflows/beam_Infrastructure_PolicyEnforcer.yml](https://github.com/apache/beam/actions/workflows/beam_Infrastructure_PolicyEnforcer.yml/badge.svg?event=schedule)](https://github.com/apache/beam/actions/workflows/beam_Infrastructure_PolicyEnforcer.yml?query=event%3Aschedule) | | [ Modify the GCP User Roles according to the infra/users.yml file ](https://github.com/apache/beam/actions/workflows/beam_Infrastructure_UsersPermissions.yml) | N/A | [![.github/workflows/beam_Infrastructure_UsersPermissions.yml](https://github.com/apache/beam/actions/workflows/beam_Infrastructure_UsersPermissions.yml/badge.svg?event=schedule)](https://github.com/apache/beam/actions/workflows/beam_Infrastructure_UsersPermissions.yml?query=event%3Aschedule) | | [ Service Account Keys Management ](https://github.com/apache/beam/actions/workflows/beam_Infrastructure_ServiceAccountKeys.yml) | N/A | [![.github/workflows/beam_Infrastructure_ServiceAccountKeys.yml](https://github.com/apache/beam/actions/workflows/beam_Infrastructure_ServiceAccountKeys.yml/badge.svg?event=schedule)](https://github.com/apache/beam/actions/workflows/beam_Infrastructure_ServiceAccountKeys.yml?query=event%3Aschedule) | +| [ Upgrade GCP Platform Libraries BOM ](https://github.com/apache/beam/actions/workflows/beam_Upgrade_GCP_BOM.yml) | N/A | [![.github/workflows/beam_Upgrade_GCP_BOM.yml](https://github.com/apache/beam/actions/workflows/beam_Upgrade_GCP_BOM.yml/badge.svg?event=schedule)](https://github.com/apache/beam/actions/workflows/beam_Upgrade_GCP_BOM.yml?query=event%3Aschedule) | From 30a83432dfb1765c9ba9d47844ae227dfe5fd1ed Mon Sep 17 00:00:00 2001 From: Derrick Williams Date: Wed, 27 May 2026 17:53:07 +0000 Subject: [PATCH 4/9] Fix YAML indentation for push branches trigger --- .github/workflows/beam_Upgrade_GCP_BOM.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/beam_Upgrade_GCP_BOM.yml b/.github/workflows/beam_Upgrade_GCP_BOM.yml index 4c9ca7d594aa..229555d74ea8 100644 --- a/.github/workflows/beam_Upgrade_GCP_BOM.yml +++ b/.github/workflows/beam_Upgrade_GCP_BOM.yml @@ -20,8 +20,8 @@ on: - cron: "0 0 * * 0" # Weekly on Sundays at 00:00 UTC workflow_dispatch: push: - branches: - - 20260527_createBOMWorkflow + branches: + - 20260527_createBOMWorkflow permissions: contents: write From 2d9e8747e9c902110b7f277d8e28cf0eb0fedfda Mon Sep 17 00:00:00 2001 From: Derrick Williams Date: Wed, 27 May 2026 17:59:06 +0000 Subject: [PATCH 5/9] remove tmp push --- .github/workflows/beam_Upgrade_GCP_BOM.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/beam_Upgrade_GCP_BOM.yml b/.github/workflows/beam_Upgrade_GCP_BOM.yml index 229555d74ea8..fb3360824446 100644 --- a/.github/workflows/beam_Upgrade_GCP_BOM.yml +++ b/.github/workflows/beam_Upgrade_GCP_BOM.yml @@ -19,9 +19,6 @@ on: schedule: - cron: "0 0 * * 0" # Weekly on Sundays at 00:00 UTC workflow_dispatch: - push: - branches: - - 20260527_createBOMWorkflow permissions: contents: write From d2cdedf7ec08e8d9858867af93b34fdd2b7e9be0 Mon Sep 17 00:00:00 2001 From: Derrick Williams Date: Wed, 27 May 2026 18:01:44 +0000 Subject: [PATCH 6/9] Rename workflow to Upgrade GCP Libraries BOM --- .github/workflows/README.md | 2 +- .github/workflows/beam_Upgrade_GCP_BOM.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 707f3e3fbed8..30225a999411 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -542,4 +542,4 @@ PostCommit Jobs run in a schedule against master branch and generally do not get | [ Infrastructure Policy Enforcer ](https://github.com/apache/beam/actions/workflows/beam_Infrastructure_PolicyEnforcer.yml) | N/A | [![.github/workflows/beam_Infrastructure_PolicyEnforcer.yml](https://github.com/apache/beam/actions/workflows/beam_Infrastructure_PolicyEnforcer.yml/badge.svg?event=schedule)](https://github.com/apache/beam/actions/workflows/beam_Infrastructure_PolicyEnforcer.yml?query=event%3Aschedule) | | [ Modify the GCP User Roles according to the infra/users.yml file ](https://github.com/apache/beam/actions/workflows/beam_Infrastructure_UsersPermissions.yml) | N/A | [![.github/workflows/beam_Infrastructure_UsersPermissions.yml](https://github.com/apache/beam/actions/workflows/beam_Infrastructure_UsersPermissions.yml/badge.svg?event=schedule)](https://github.com/apache/beam/actions/workflows/beam_Infrastructure_UsersPermissions.yml?query=event%3Aschedule) | | [ Service Account Keys Management ](https://github.com/apache/beam/actions/workflows/beam_Infrastructure_ServiceAccountKeys.yml) | N/A | [![.github/workflows/beam_Infrastructure_ServiceAccountKeys.yml](https://github.com/apache/beam/actions/workflows/beam_Infrastructure_ServiceAccountKeys.yml/badge.svg?event=schedule)](https://github.com/apache/beam/actions/workflows/beam_Infrastructure_ServiceAccountKeys.yml?query=event%3Aschedule) | -| [ Upgrade GCP Platform Libraries BOM ](https://github.com/apache/beam/actions/workflows/beam_Upgrade_GCP_BOM.yml) | N/A | [![.github/workflows/beam_Upgrade_GCP_BOM.yml](https://github.com/apache/beam/actions/workflows/beam_Upgrade_GCP_BOM.yml/badge.svg?event=schedule)](https://github.com/apache/beam/actions/workflows/beam_Upgrade_GCP_BOM.yml?query=event%3Aschedule) | +| [ Upgrade GCP Libraries BOM ](https://github.com/apache/beam/actions/workflows/beam_Upgrade_GCP_BOM.yml) | N/A | [![.github/workflows/beam_Upgrade_GCP_BOM.yml](https://github.com/apache/beam/actions/workflows/beam_Upgrade_GCP_BOM.yml/badge.svg?event=schedule)](https://github.com/apache/beam/actions/workflows/beam_Upgrade_GCP_BOM.yml?query=event%3Aschedule) | diff --git a/.github/workflows/beam_Upgrade_GCP_BOM.yml b/.github/workflows/beam_Upgrade_GCP_BOM.yml index fb3360824446..ffa5a5073ee4 100644 --- a/.github/workflows/beam_Upgrade_GCP_BOM.yml +++ b/.github/workflows/beam_Upgrade_GCP_BOM.yml @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: Upgrade GCP Platform Libraries BOM +name: Upgrade GCP Libraries BOM on: schedule: From e490f90607d5ba4d8f030f9c6dece23007f24c0c Mon Sep 17 00:00:00 2001 From: Derrick Williams Date: Wed, 27 May 2026 18:21:46 +0000 Subject: [PATCH 7/9] fix gemini comments --- scripts/tools/gcp_bom_upgrade_check.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/tools/gcp_bom_upgrade_check.py b/scripts/tools/gcp_bom_upgrade_check.py index 7037ba68dbe5..40943dafdf2c 100644 --- a/scripts/tools/gcp_bom_upgrade_check.py +++ b/scripts/tools/gcp_bom_upgrade_check.py @@ -19,7 +19,7 @@ def get_latest_bom(): url = "https://repo1.maven.org/maven2/com/google/cloud/libraries-bom/maven-metadata.xml" - with urllib.request.urlopen(url) as response: + with urllib.request.urlopen(url, timeout=15) as response: xml = response.read().decode('utf-8') match = re.search(r'([^<]+)', xml) if match: @@ -36,7 +36,11 @@ def get_current_bom(): raise RuntimeError("Could not find current libraries-bom in BeamModulePlugin.groovy") def to_tuple(version_str): - return tuple(map(int, version_str.split('.'))) + parts = [] + for part in version_str.split('.'): + match = re.match(r'^(\d+)', part) + parts.append(int(match.group(1)) if match else 0) + return tuple(parts) def main(): latest = get_latest_bom() From f0a34c02130a2f6570ccd4085ef365c4c058fd59 Mon Sep 17 00:00:00 2001 From: Derrick Williams Date: Wed, 17 Jun 2026 14:46:07 +0000 Subject: [PATCH 8/9] move script logic into bomupgrader.py --- .github/workflows/beam_Upgrade_GCP_BOM.yml | 2 +- scripts/tools/bomupgrader.py | 69 +++++++++++++++++++++- scripts/tools/gcp_bom_upgrade_check.py | 66 --------------------- 3 files changed, 67 insertions(+), 70 deletions(-) delete mode 100644 scripts/tools/gcp_bom_upgrade_check.py diff --git a/.github/workflows/beam_Upgrade_GCP_BOM.yml b/.github/workflows/beam_Upgrade_GCP_BOM.yml index ffa5a5073ee4..7dc8d6c9077b 100644 --- a/.github/workflows/beam_Upgrade_GCP_BOM.yml +++ b/.github/workflows/beam_Upgrade_GCP_BOM.yml @@ -46,7 +46,7 @@ jobs: go-version: default - name: Check if new BOM is available id: check_bom - run: python3 scripts/tools/gcp_bom_upgrade_check.py + run: python3 scripts/tools/bomupgrader.py --check - name: Run bomupgrader if: steps.check_bom.outputs.should_upgrade == 'true' run: python3 scripts/tools/bomupgrader.py ${{ steps.check_bom.outputs.latest_version }} diff --git a/scripts/tools/bomupgrader.py b/scripts/tools/bomupgrader.py index bf6e7dfdd31f..7677e93413a0 100644 --- a/scripts/tools/bomupgrader.py +++ b/scripts/tools/bomupgrader.py @@ -20,6 +20,7 @@ import re import subprocess import sys +import urllib.request """ This Python script is used for upgrading the GCP-BOM in BeamModulePlugin. Specifically, it @@ -42,6 +43,59 @@ # To format: yapf --style sdks/python/setup.cfg --in-place scripts/tools/bomupgrader.py +def get_latest_bom(): + url = "https://repo1.maven.org/maven2/com/google/cloud/libraries-bom/maven-metadata.xml" + with urllib.request.urlopen(url, timeout=15) as response: + xml = response.read().decode('utf-8') + match = re.search(r'([^<]+)', xml) + if match: + return match.group(1) + raise RuntimeError("Could not find latest release in Maven metadata") + + +def get_current_bom(): + path = "buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy" + with open(path) as f: + content = f.read() + match = re.search( + r'google_cloud_platform_libraries_bom\s*:\s*[\"\']com\.google\.cloud:libraries-bom:([0-9.]+)[\"\']', + content) + if match: + return match.group(1) + raise RuntimeError( + "Could not find current libraries-bom in BeamModulePlugin.groovy") + + +def to_tuple(version_str): + parts = [] + for part in version_str.split('.'): + match = re.match(r'^(\d+)', part) + parts.append(int(match.group(1)) if match else 0) + return tuple(parts) + + +def check_bom(): + latest = get_latest_bom() + current = get_current_bom() + print(f"Latest libraries-bom version: {latest}") + print(f"Current libraries-bom version: {current}") + + should_upgrade = to_tuple(latest) > to_tuple(current) + + github_output = os.getenv('GITHUB_OUTPUT') + if github_output: + with open(github_output, 'a') as f: + f.write(f"should_upgrade={str(should_upgrade).lower()}\n") + f.write(f"latest_version={latest}\n") + f.write(f"current_version={current}\n") + + if should_upgrade: + print("A newer version of libraries-bom is available. Upgrade needed.") + else: + print("libraries-bom is up-to-date.") + return should_upgrade, latest + + class BeamModulePluginProcessor: # Known dependencies managed by GCP BOM and also used by Beam. # We only need to have one dependency for each project to figure out the target version @@ -278,7 +332,16 @@ def run(self): if __name__ == '__main__': logging.getLogger().setLevel(logging.INFO) if len(sys.argv) < 2: - print("Usage: python scripts/tools/bomupgrader.py target_version") + print("Usage: python scripts/tools/bomupgrader.py [--check | latest | target_version]") exit(1) - processor = BeamModulePluginProcessor(sys.argv[1]) - processor.run() + + arg = sys.argv[1] + if arg in ['--check', '--check-only']: + check_bom() + else: + if arg in ['latest', '--latest']: + _, target_ver = check_bom() + else: + target_ver = arg + processor = BeamModulePluginProcessor(target_ver) + processor.run() diff --git a/scripts/tools/gcp_bom_upgrade_check.py b/scripts/tools/gcp_bom_upgrade_check.py deleted file mode 100644 index 40943dafdf2c..000000000000 --- a/scripts/tools/gcp_bom_upgrade_check.py +++ /dev/null @@ -1,66 +0,0 @@ -# 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. - -import urllib.request -import re -import os - -def get_latest_bom(): - url = "https://repo1.maven.org/maven2/com/google/cloud/libraries-bom/maven-metadata.xml" - with urllib.request.urlopen(url, timeout=15) as response: - xml = response.read().decode('utf-8') - match = re.search(r'([^<]+)', xml) - if match: - return match.group(1) - raise RuntimeError("Could not find latest release in Maven metadata") - -def get_current_bom(): - path = "buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy" - with open(path) as f: - content = f.read() - match = re.search(r'google_cloud_platform_libraries_bom\s*:\s*[\"\']com\.google\.cloud:libraries-bom:([0-9.]+)[\"\']', content) - if match: - return match.group(1) - raise RuntimeError("Could not find current libraries-bom in BeamModulePlugin.groovy") - -def to_tuple(version_str): - parts = [] - for part in version_str.split('.'): - match = re.match(r'^(\d+)', part) - parts.append(int(match.group(1)) if match else 0) - return tuple(parts) - -def main(): - latest = get_latest_bom() - current = get_current_bom() - print(f"Latest libraries-bom version: {latest}") - print(f"Current libraries-bom version: {current}") - - should_upgrade = to_tuple(latest) > to_tuple(current) - - github_output = os.getenv('GITHUB_OUTPUT') - if github_output: - with open(github_output, 'a') as f: - f.write(f"should_upgrade={str(should_upgrade).lower()}\n") - f.write(f"latest_version={latest}\n") - f.write(f"current_version={current}\n") - - if should_upgrade: - print("A newer version of libraries-bom is available. Upgrade needed.") - else: - print("libraries-bom is up-to-date.") - -if __name__ == '__main__': - main() From 2c807358ca333fab9d78a46b654096d3b0b2316e Mon Sep 17 00:00:00 2001 From: Derrick Williams Date: Wed, 24 Jun 2026 15:31:59 +0000 Subject: [PATCH 9/9] update workflow logic to only run within 6 days of a release cut --- .github/workflows/beam_Upgrade_GCP_BOM.yml | 9 +++++++++ contributor-docs/release-guide.md | 12 +++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/beam_Upgrade_GCP_BOM.yml b/.github/workflows/beam_Upgrade_GCP_BOM.yml index 7dc8d6c9077b..ca7489f21b25 100644 --- a/.github/workflows/beam_Upgrade_GCP_BOM.yml +++ b/.github/workflows/beam_Upgrade_GCP_BOM.yml @@ -62,9 +62,18 @@ jobs: if: steps.check_bom.outputs.should_upgrade == 'true' env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_EVENT: ${{ github.event_name }} LATEST_VER: ${{ steps.check_bom.outputs.latest_version }} CURRENT_VER: ${{ steps.check_bom.outputs.current_version }} run: | + # Take the current date, subtract from a release cut date in the past (June 24, 2026), + # then get the num days % 42 (our release cadence is 42 days). + # This will ensure it only runs the week after a release branch has been cut. + days_diff=$(( ($(date +%s) - $(date --date="260624" +%s) )/(60*60*24)%42 )) + if [[ $GH_EVENT != 'workflow_dispatch' && $days_diff -gt 6 ]]; then + echo "Exiting early. We only update dependencies the week after we cut the release" + exit 0 + fi branchName=upgrade_gcp_bom_${LATEST_VER//./_} git checkout -b $branchName git add -A diff --git a/contributor-docs/release-guide.md b/contributor-docs/release-guide.md index 2024f1017975..7c96465c722b 100644 --- a/contributor-docs/release-guide.md +++ b/contributor-docs/release-guide.md @@ -1164,10 +1164,16 @@ At the end of the release, go to the GitHub milestones page and mark the recentl #### Update the Java BOM Google releases a BOM that pins compatible versions of their Java libraries. -After the release, try updating the BOM to the latest version. +After the release, an automated upgrade BOM PR is created or can be triggered manually. -To do so, create a draft PR and run test suites following the instructions at -https://github.com/apache/beam/blob/master/contributor-docs/java-dependency-upgrades.md. +A PR should have already been created (and possibly merged) by github-actions bot, you should verify that this was done correctly +by looking at open PRs from that bot - https://github.com/apache/beam/pulls/app%2Fgithub-actions + +If a PR has not been merged, drive it to completion. +If no PR was created, triage any failures in https://github.com/apache/beam/actions/workflows/beam_Upgrade_GCP_BOM.yml and manually update the BOM, +following https://github.com/apache/beam/blob/master/contributor-docs/java-dependency-upgrades.md or simply trigger the workflow again. + +##### Troubleshooting Triage the test failures and rerun any tests that seem potentially unrelated to the upgrade. If there are no test failures due to the BOM upgrade, request review and merge the PR as normal.