From a4d6487a407d8723e0f1b4c546e3114b51c564d4 Mon Sep 17 00:00:00 2001 From: akashorabek <70029317+akashorabek@users.noreply.github.com> Date: Tue, 4 Feb 2025 23:25:46 +0500 Subject: [PATCH] Fix Postcommit Python Arm workflow (#33849) * Fix Postcommit Python Arm workflow * formatting --- .github/workflows/beam_PostCommit_Python_Arm.yml | 8 +++++++- .../io/gcp/healthcare/dicomio_integration_test.py | 11 +++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/beam_PostCommit_Python_Arm.yml b/.github/workflows/beam_PostCommit_Python_Arm.yml index 83b2d6ca978f..382cce6b5e8b 100644 --- a/.github/workflows/beam_PostCommit_Python_Arm.yml +++ b/.github/workflows/beam_PostCommit_Python_Arm.yml @@ -55,7 +55,7 @@ env: jobs: beam_PostCommit_Python_Arm: name: ${{ matrix.job_name }} (${{ matrix.job_phrase }} ${{ matrix.python_version }}) - runs-on: [self-hosted, ubuntu-20.04, main] + runs-on: ubuntu-22.04 timeout-minutes: 240 strategy: fail-fast: false @@ -84,6 +84,12 @@ 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: 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 }} + export_default_credentials: true - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: GCloud Docker credential helper diff --git a/sdks/python/apache_beam/io/gcp/healthcare/dicomio_integration_test.py b/sdks/python/apache_beam/io/gcp/healthcare/dicomio_integration_test.py index 58b97305f61a..2809bd25e45b 100644 --- a/sdks/python/apache_beam/io/gcp/healthcare/dicomio_integration_test.py +++ b/sdks/python/apache_beam/io/gcp/healthcare/dicomio_integration_test.py @@ -62,6 +62,7 @@ META_DATA_REFINED_NAME = 'Dicom_io_it_test_refined_data.json' NUM_INSTANCE = 18 RAND_LEN = 15 +SCOPES = ['https://www.googleapis.com/auth/cloud-platform'] def random_string_generator(length): @@ -72,7 +73,7 @@ def random_string_generator(length): def create_dicom_store(project_id, dataset_id, region, dicom_store_id): # Create a an empty DICOM store - credential, _ = default() + credential, _ = default(SCOPES) session = requests.AuthorizedSession(credential) api_endpoint = "{}/projects/{}/locations/{}".format( HEALTHCARE_BASE_URL, project_id, region) @@ -88,7 +89,7 @@ def create_dicom_store(project_id, dataset_id, region, dicom_store_id): def delete_dicom_store(project_id, dataset_id, region, dicom_store_id): # Delete an existing DICOM store - credential, _ = default() + credential, _ = default(SCOPES) session = requests.AuthorizedSession(credential) api_endpoint = "{}/projects/{}/locations/{}".format( HEALTHCARE_BASE_URL, project_id, region) @@ -108,7 +109,7 @@ def get_gcs_file_http(file_name): api_endpoint = "{}/b/{}/o/{}?alt=media".format( GCS_BASE_URL, BUCKET_NAME, file_name) - credential, _ = default() + credential, _ = default(SCOPES) session = requests.AuthorizedSession(credential) response = session.get(api_endpoint) @@ -209,8 +210,10 @@ def test_dicom_store_instance_from_gcs(self): results, equal_to(expected_output), label='store first assert') # Check the metadata using client + credential, _ = default(SCOPES) result, status_code = DicomApiHttpClient().qido_search( - self.project, REGION, DATA_SET_ID, self.temp_dicom_store, 'instances' + self.project, REGION, DATA_SET_ID, + self.temp_dicom_store, 'instances', credential=credential ) self.assertEqual(status_code, 200)