From 91418fd69a056d3da3177e3717314318c541a22b Mon Sep 17 00:00:00 2001 From: aIbrahiim Date: Tue, 3 Feb 2026 10:49:08 +0200 Subject: [PATCH 1/3] Fix ValidatesContainer Cloud Build test --- .../runners/portability/sdk_container_builder.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdks/python/apache_beam/runners/portability/sdk_container_builder.py b/sdks/python/apache_beam/runners/portability/sdk_container_builder.py index bb5bfd48949d..6043d55e6b70 100644 --- a/sdks/python/apache_beam/runners/portability/sdk_container_builder.py +++ b/sdks/python/apache_beam/runners/portability/sdk_container_builder.py @@ -262,10 +262,10 @@ def _invoke_docker_build_and_push(self, container_image_name): build.steps.append(step) source = cloud_build_types.Source() - source.storageSource = cloud_build_types.StorageSource() + source.storage_source = cloud_build_types.StorageSource() gcs_bucket, gcs_object = self._get_gcs_bucket_and_name(gcs_location) - source.storageSource.bucket = os.path.join(gcs_bucket) - source.storageSource.object = gcs_object + source.storage_source.bucket = os.path.join(gcs_bucket) + source.storage_source.object = gcs_object build.source = source # TODO(zyichi): make timeout configurable build.timeout = '7200s' From 425d82704b8d91fb40976c55c210bdddd6bd888a Mon Sep 17 00:00:00 2001 From: aIbrahiim Date: Tue, 3 Feb 2026 13:55:51 +0200 Subject: [PATCH 2/3] Update sdk_container_builder for google-cloud-build 3.35 API --- .../portability/sdk_container_builder.py | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/sdks/python/apache_beam/runners/portability/sdk_container_builder.py b/sdks/python/apache_beam/runners/portability/sdk_container_builder.py index 6043d55e6b70..fc480d631abd 100644 --- a/sdks/python/apache_beam/runners/portability/sdk_container_builder.py +++ b/sdks/python/apache_beam/runners/portability/sdk_container_builder.py @@ -262,10 +262,11 @@ def _invoke_docker_build_and_push(self, container_image_name): build.steps.append(step) source = cloud_build_types.Source() - source.storage_source = cloud_build_types.StorageSource() + storage_source = cloud_build_types.StorageSource() gcs_bucket, gcs_object = self._get_gcs_bucket_and_name(gcs_location) - source.storage_source.bucket = os.path.join(gcs_bucket) - source.storage_source.object = gcs_object + storage_source.bucket = os.path.join(gcs_bucket) + storage_source.object_ = gcs_object + source.storage_source = storage_source build.source = source # TODO(zyichi): make timeout configurable build.timeout = '7200s' @@ -325,16 +326,8 @@ def _upload_to_gcs(self, local_file_path, gcs_location): _LOGGER.info('Completed GCS upload to %s.', gcs_location) def _get_cloud_build_id_and_log_url(self, metadata): - id = None - log_url = None - for item in metadata.additionalProperties: - if item.key == 'build': - for field in item.value.object_value.properties: - if field.key == 'logUrl': - log_url = field.value.string_value - if field.key == 'id': - id = field.value.string_value - return id, log_url + build = metadata.build + return (build.id, build.log_url) @staticmethod def _get_gcs_bucket_and_name(gcs_location): From 98cdbc70a59356f5c854f1eedf5c2aaf1e68240c Mon Sep 17 00:00:00 2001 From: aIbrahiim Date: Tue, 3 Feb 2026 22:29:50 +0200 Subject: [PATCH 3/3] Added fall back to additionalProperties for older clients --- .../portability/sdk_container_builder.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/sdks/python/apache_beam/runners/portability/sdk_container_builder.py b/sdks/python/apache_beam/runners/portability/sdk_container_builder.py index fc480d631abd..b958995373d7 100644 --- a/sdks/python/apache_beam/runners/portability/sdk_container_builder.py +++ b/sdks/python/apache_beam/runners/portability/sdk_container_builder.py @@ -326,8 +326,23 @@ def _upload_to_gcs(self, local_file_path, gcs_location): _LOGGER.info('Completed GCS upload to %s.', gcs_location) def _get_cloud_build_id_and_log_url(self, metadata): - build = metadata.build - return (build.id, build.log_url) + # google-cloud-build 3.35+ + if getattr(metadata, 'build', None): + build = metadata.build + return (build.id, build.log_url) + # Fallback for older clients that use additionalProperties. + id = None + log_url = None + additional_props = getattr(metadata, 'additionalProperties', None) + if additional_props: + for item in additional_props: + if item.key == 'build': + for field in item.value.object_value.properties: + if field.key == 'logUrl': + log_url = field.value.string_value + if field.key == 'id': + id = field.value.string_value + return id, log_url @staticmethod def _get_gcs_bucket_and_name(gcs_location):