Skip to content

Commit cb7329c

Browse files
authored
Use prebuilt Snapshots SDK images for PostCommit Python Arm (#39498)
1 parent d6ab992 commit cb7329c

4 files changed

Lines changed: 26 additions & 18 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"comment": "Modify this file in a trivial way to cause this test suite to run",
3+
"modification": 1
4+
}

.github/workflows/beam_PostCommit_Python_Arm.yml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ jobs:
5454
beam_PostCommit_Python_Arm:
5555
name: ${{ matrix.job_name }} ${{ matrix.python_version }}
5656
runs-on: [self-hosted, ubuntu-24.04, main]
57-
# Python 3.14 multiarch container builds take much longer than other versions.
58-
timeout-minutes: ${{ matrix.python_version == '3.14' && 600 || 480 }}
57+
# Python ARM PostCommit uses prebuilt Snapshots SDK images, so it no longer
58+
# spends hours on multiarch container builds. Keep headroom for the IT suite.
59+
timeout-minutes: 180
5960
strategy:
6061
fail-fast: false
6162
matrix:
@@ -93,33 +94,23 @@ jobs:
9394
credentials_json: ${{ secrets.GCP_SA_KEY }}
9495
- name: Set up Cloud SDK
9596
uses: google-github-actions/setup-gcloud@aa5489c8933f4cc7a4f7d45035b3b1440c9c10db
96-
- name: Set up Docker Buildx
97-
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c
98-
- name: GCloud Docker credential helper
99-
run: |
100-
gcloud auth configure-docker us.gcr.io
10197
- name: Set PY_VER_CLEAN
10298
id: set_py_ver_clean
10399
run: |
104100
PY_VER=${{ matrix.python_version }}
105101
PY_VER_CLEAN=${PY_VER//.}
106102
echo "py_ver_clean=$PY_VER_CLEAN" >> $GITHUB_OUTPUT
107-
- name: Generate TAG unique variable based on timestamp
108-
id: set_tag
109-
run: echo "TAG=$(date +'%Y%m%d-%H%M%S%N')" >> $GITHUB_OUTPUT
110103
- name: run PostCommit Python ${{ matrix.python_version }} script
111104
uses: ./.github/actions/gradle-command-self-hosted-action
112105
with:
113106
gradle-command: :sdks:python:test-suites:dataflow:py${{steps.set_py_ver_clean.outputs.py_ver_clean}}:postCommitArmIT
114107
arguments: |
115108
-PuseWheelDistribution \
116109
-PpythonVersion=${{ matrix.python_version }} \
117-
-Pcontainer-architecture-list=arm64,amd64 \
118-
-Pdocker-repository-root=us.gcr.io/apache-beam-testing/github-actions \
119-
-Pdocker-tag=${{ steps.set_tag.outputs.TAG }} \
120-
-Ppush-containers \
110+
-PusePrebuiltSdkContainer \
121111
env:
122-
MULTIARCH_TAG: ${{ steps.set_tag.outputs.TAG }}
112+
# Use multiarch images published by Publish Beam SDK Snapshots.
113+
SDK_CONTAINER_IMAGE: gcr.io/apache-beam-testing/beam-sdk/beam_python${{ matrix.python_version }}_sdk:latest
123114
USER: github-actions
124115
- name: Archive Python Test Results
125116
uses: actions/upload-artifact@v7

sdks/python/scripts/run_integration_test.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,15 @@ if [[ -z $PIPELINE_OPTS ]]; then
248248
if [[ "$ARCH" == "ARM" ]]; then
249249
opts+=("--machine_type=t2a-standard-1")
250250

251-
IMAGE_NAME="beam_python${PY_VERSION}_sdk"
252-
opts+=("--sdk_container_image=us.gcr.io/$PROJECT/$USER/$IMAGE_NAME:$MULTIARCH_TAG")
251+
# Prefer an explicit image (e.g. Snapshots latest) when provided so CI can
252+
# skip rebuilding multiarch SDK containers. Otherwise use the image built
253+
# and pushed by the caller under MULTIARCH_TAG.
254+
if [[ -n "${SDK_CONTAINER_IMAGE:-}" ]]; then
255+
opts+=("--sdk_container_image=$SDK_CONTAINER_IMAGE")
256+
else
257+
IMAGE_NAME="beam_python${PY_VERSION}_sdk"
258+
opts+=("--sdk_container_image=us.gcr.io/$PROJECT/$USER/$IMAGE_NAME:$MULTIARCH_TAG")
259+
fi
253260
fi
254261

255262
if [[ ! -z "$KMS_KEY_NAME" ]]; then

sdks/python/test-suites/dataflow/common.gradle

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,13 @@ task postCommitIT {
146146
task postCommitArmIT {
147147
def pyversion = "${project.ext.pythonVersion.replace('.', '')}"
148148
dependsOn 'initializeForDataflowJob'
149-
dependsOn ":sdks:python:container:py${pyversion}:docker"
149+
// When -PusePrebuiltSdkContainer is set, skip building/pushing a multiarch
150+
// SDK image and use SDK_CONTAINER_IMAGE from the environment instead (e.g.
151+
// gcr.io/apache-beam-testing/beam-sdk/beam_python3.x_sdk:latest from Snapshots).
152+
def usePrebuiltSdkContainer = project.rootProject.hasProperty(['usePrebuiltSdkContainer'])
153+
if (!usePrebuiltSdkContainer) {
154+
dependsOn ":sdks:python:container:py${pyversion}:docker"
155+
}
150156

151157
doLast {
152158
def testOpts = basicPytestOpts + ["--numprocesses=8", "--dist=loadfile"]

0 commit comments

Comments
 (0)