From 2a5ac1125324dc4e79ce6b496400d0750f895cea Mon Sep 17 00:00:00 2001 From: David Cavazos Date: Wed, 7 Jun 2023 13:20:20 -0700 Subject: [PATCH] Disable kaniko cache compression when prebuilding images (#27023) --- CHANGES.md | 1 + .../runners/portability/sdk_container_builder.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 6ab0852f2b216..5c7733950aeba 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -62,6 +62,7 @@ ## New Features / Improvements +* Allow prebuilding large images when using `--prebuild_sdk_container_engine=cloud_build`, like images depending on `tensorflow` or `torch` ([#27023](https://github.com/apache/beam/pull/27023)) * X feature added (Java/Python) ([#X](https://github.com/apache/beam/issues/X)). ## Breaking Changes 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 f81e015ea591b..19becd3e123f1 100644 --- a/sdks/python/apache_beam/runners/portability/sdk_container_builder.py +++ b/sdks/python/apache_beam/runners/portability/sdk_container_builder.py @@ -252,7 +252,13 @@ def _invoke_docker_build_and_push(self, container_image_name): build.steps = [] step = cloudbuild.BuildStep() step.name = 'gcr.io/kaniko-project/executor:latest' - step.args = ['--destination=' + container_image_name, '--cache=true'] + # Disable compression caching to allow for large images to be cached. + # See: https://github.com/GoogleContainerTools/kaniko/issues/1669 + step.args = [ + '--destination=' + container_image_name, + '--cache=true', + '--compressed-caching=false', + ] step.dir = SOURCE_FOLDER build.steps.append(step)