From 04cdbfdda29af965d5d4b3bca3b14ef2729ae030 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Fri, 29 Sep 2023 06:26:29 -0400 Subject: [PATCH 1/7] Longer arm timeout --- .github/workflows/beam_PostCommit_Python_Arm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/beam_PostCommit_Python_Arm.yml b/.github/workflows/beam_PostCommit_Python_Arm.yml index 74eb8e8290d8..f7620a6a3eb0 100644 --- a/.github/workflows/beam_PostCommit_Python_Arm.yml +++ b/.github/workflows/beam_PostCommit_Python_Arm.yml @@ -54,7 +54,7 @@ jobs: beam_PostCommit_Python_Arm: name: ${{matrix.job_name}} (${{matrix.job_phrase}} ${{matrix.python_version}}) runs-on: [self-hosted, ubuntu-20.04, main] - timeout-minutes: 240 + timeout-minutes: 360 strategy: fail-fast: false matrix: From 2d4d955a142ba6f83c80c84cd92c969b1c339cb7 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Fri, 29 Sep 2023 08:25:59 -0400 Subject: [PATCH 2/7] Use custom container --- .github/workflows/beam_PostCommit_Python_Arm.yml | 9 +++++++++ sdks/python/scripts/run_integration_test.sh | 10 ++++++++++ sdks/python/test-suites/dataflow/common.gradle | 3 +++ 3 files changed, 22 insertions(+) diff --git a/.github/workflows/beam_PostCommit_Python_Arm.yml b/.github/workflows/beam_PostCommit_Python_Arm.yml index f7620a6a3eb0..0135f46fb0aa 100644 --- a/.github/workflows/beam_PostCommit_Python_Arm.yml +++ b/.github/workflows/beam_PostCommit_Python_Arm.yml @@ -87,6 +87,9 @@ jobs: PY_VER=${{ matrix.python_version }} PY_VER_CLEAN=${PY_VER//.} echo "py_ver_clean=$PY_VER_CLEAN" >> $GITHUB_OUTPUT + - name: Generate TAG unique variable based on timestamp + id: set_tag + run: echo "TAG=$(date +'%Y%m%d-%H%M%S%N')" >> $GITHUB_OUTPUT - name: run PostCommit Python ${{ matrix.python_version }} script uses: ./.github/actions/gradle-command-self-hosted-action with: @@ -94,8 +97,14 @@ jobs: arguments: | -PuseWheelDistribution \ -PpythonVersion=${{ matrix.python_version }} \ + -Pcontainer-architecture-list=arm64,amd64 \ + -Pdocker-repository-root=us.gcr.io/apache-beam-testing/github-actions \ + -Pdocker-tag=${{ steps.set_tag.outputs.TAG }} \ + -Ppush-containers env: CLOUDSDK_CONFIG: ${{ env.KUBELET_GCLOUD_CONFIG_PATH}} + MULTIARCH_TAG: ${{ steps.set_tag.outputs.TAG }} + USER: github-actions - name: Archive code coverage results uses: actions/upload-artifact@v3 with: diff --git a/sdks/python/scripts/run_integration_test.sh b/sdks/python/scripts/run_integration_test.sh index 6ad592080ae2..7f52a912aaf4 100755 --- a/sdks/python/scripts/run_integration_test.sh +++ b/sdks/python/scripts/run_integration_test.sh @@ -79,6 +79,7 @@ SUITE="" COLLECT_MARKERS= REQUIREMENTS_FILE="" ARCH="" +PY_VERSION="" # Default test (pytest) options. # Run WordCountIT.test_wordcount_it by default if no test options are @@ -169,6 +170,11 @@ case $key in shift # past argument shift # past value ;; + --py_version) + PY_VERSION="$2" + shift # past argument + shift # past value + ;; *) # unknown option echo "Unknown option: $1" exit 1 @@ -242,6 +248,10 @@ if [[ -z $PIPELINE_OPTS ]]; then if [[ "$ARCH" == "ARM" ]]; then opts+=("--machine_type=t2a-standard-1") + + IMAGE_PREFIX="$(grep 'docker_image_default_repo_prefix' gradle.properties | cut -d'=' -f2)" + IMAGE_NAME="${IMAGE_PREFIX}python${PY_VERSION}_sdk" + opts+=("--sdk_container_image=us.gcr.io/$PROJECT/$USER/$IMAGE_NAME:$MULTIARCH_TAG") fi if [[ ! -z "$KMS_KEY_NAME" ]]; then diff --git a/sdks/python/test-suites/dataflow/common.gradle b/sdks/python/test-suites/dataflow/common.gradle index 7766cf3a377c..a713b82400e7 100644 --- a/sdks/python/test-suites/dataflow/common.gradle +++ b/sdks/python/test-suites/dataflow/common.gradle @@ -144,7 +144,9 @@ task postCommitIT { } task postCommitArmIT { + def pyversion = "${project.ext.pythonVersion.replace('.', '')}" dependsOn 'initializeForDataflowJob' + dependsOn ":sdks:python:container:py${pyversion}:docker" doLast { def testOpts = basicPytestOpts + ["--numprocesses=8", "--dist=loadfile"] @@ -153,6 +155,7 @@ task postCommitArmIT { "sdk_location": project.ext.sdkLocation, "suite": "postCommitIT-df${pythonVersionSuffix}", "collect": "it_postcommit", + "py_version": project.ext.pythonVersion, "arch": "ARM" ] def cmdArgs = mapToArgString(argMap) From a2b266b9484c3dc776d48e362d8b25f451baaad3 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Fri, 29 Sep 2023 08:28:48 -0400 Subject: [PATCH 3/7] restore workflow --- .github/workflows/beam_PostCommit_Python_Arm.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/beam_PostCommit_Python_Arm.yml b/.github/workflows/beam_PostCommit_Python_Arm.yml index 0135f46fb0aa..4841c8337de2 100644 --- a/.github/workflows/beam_PostCommit_Python_Arm.yml +++ b/.github/workflows/beam_PostCommit_Python_Arm.yml @@ -18,10 +18,10 @@ name: PostCommit Python Arm on: - # issue_comment: - # types: [created] - # schedule: - # - cron: '0 */6 * * *' + issue_comment: + types: [created] + schedule: + - cron: '0 */6 * * *' workflow_dispatch: # This allows a subsequently queued workflow run to interrupt previous runs @@ -54,7 +54,7 @@ jobs: beam_PostCommit_Python_Arm: name: ${{matrix.job_name}} (${{matrix.job_phrase}} ${{matrix.python_version}}) runs-on: [self-hosted, ubuntu-20.04, main] - timeout-minutes: 360 + timeout-minutes: 240 strategy: fail-fast: false matrix: From 8dd80fc22ac7c05ca50da39ee834960b2910c1b2 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Fri, 29 Sep 2023 08:58:19 -0400 Subject: [PATCH 4/7] Set up buildx --- .github/workflows/beam_PostCommit_Python_Arm.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/beam_PostCommit_Python_Arm.yml b/.github/workflows/beam_PostCommit_Python_Arm.yml index 4841c8337de2..afd0aa609d04 100644 --- a/.github/workflows/beam_PostCommit_Python_Arm.yml +++ b/.github/workflows/beam_PostCommit_Python_Arm.yml @@ -81,6 +81,18 @@ jobs: run: | sudo curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Authenticate on GCP + uses: google-github-actions/setup-gcloud@v0 + with: + service_account_email: ${{ secrets.GCP_SA_EMAIL }} + service_account_key: ${{ secrets.GCP_SA_KEY }} + project_id: ${{ secrets.GCP_PROJECT_ID }} + export_default_credentials: true + - name: GCloud Docker credential helper + run: | + gcloud auth configure-docker us.gcr.io - name: Set PY_VER_CLEAN id: set_py_ver_clean run: | From 991ad99358720d1999c01bf928f1b7fa18ea88da Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Fri, 29 Sep 2023 10:25:22 -0400 Subject: [PATCH 5/7] Fix container formatting --- sdks/python/scripts/run_integration_test.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sdks/python/scripts/run_integration_test.sh b/sdks/python/scripts/run_integration_test.sh index 7f52a912aaf4..5ac3627a0960 100755 --- a/sdks/python/scripts/run_integration_test.sh +++ b/sdks/python/scripts/run_integration_test.sh @@ -249,8 +249,7 @@ if [[ -z $PIPELINE_OPTS ]]; then if [[ "$ARCH" == "ARM" ]]; then opts+=("--machine_type=t2a-standard-1") - IMAGE_PREFIX="$(grep 'docker_image_default_repo_prefix' gradle.properties | cut -d'=' -f2)" - IMAGE_NAME="${IMAGE_PREFIX}python${PY_VERSION}_sdk" + IMAGE_NAME="beam_python${PY_VERSION}_sdk" opts+=("--sdk_container_image=us.gcr.io/$PROJECT/$USER/$IMAGE_NAME:$MULTIARCH_TAG") fi From 61ccb109a4f15fa250ad9df3832bdd0ae3a58db2 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Fri, 29 Sep 2023 13:33:10 -0400 Subject: [PATCH 6/7] Use default creds --- .github/workflows/beam_PostCommit_Python_Arm.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/beam_PostCommit_Python_Arm.yml b/.github/workflows/beam_PostCommit_Python_Arm.yml index afd0aa609d04..e9aa7d223b46 100644 --- a/.github/workflows/beam_PostCommit_Python_Arm.yml +++ b/.github/workflows/beam_PostCommit_Python_Arm.yml @@ -83,13 +83,6 @@ jobs: sudo chmod +x /usr/local/bin/docker-compose - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Authenticate on GCP - uses: google-github-actions/setup-gcloud@v0 - with: - service_account_email: ${{ secrets.GCP_SA_EMAIL }} - service_account_key: ${{ secrets.GCP_SA_KEY }} - project_id: ${{ secrets.GCP_PROJECT_ID }} - export_default_credentials: true - name: GCloud Docker credential helper run: | gcloud auth configure-docker us.gcr.io From 5177fc5d3a34b1a9932856764c0441685d303df4 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Wed, 4 Oct 2023 07:33:42 -0400 Subject: [PATCH 7/7] Finish args with backslash --- .github/workflows/beam_PostCommit_Python_Arm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/beam_PostCommit_Python_Arm.yml b/.github/workflows/beam_PostCommit_Python_Arm.yml index e9aa7d223b46..3634e540787c 100644 --- a/.github/workflows/beam_PostCommit_Python_Arm.yml +++ b/.github/workflows/beam_PostCommit_Python_Arm.yml @@ -105,7 +105,7 @@ jobs: -Pcontainer-architecture-list=arm64,amd64 \ -Pdocker-repository-root=us.gcr.io/apache-beam-testing/github-actions \ -Pdocker-tag=${{ steps.set_tag.outputs.TAG }} \ - -Ppush-containers + -Ppush-containers \ env: CLOUDSDK_CONFIG: ${{ env.KUBELET_GCLOUD_CONFIG_PATH}} MULTIARCH_TAG: ${{ steps.set_tag.outputs.TAG }}