This is an automated email from the ASF dual-hosted git repository.

jrmccluskey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new aaad9b4b8e6 [Experimental] Use zstd compression in Docker builds 
(#39409)
aaad9b4b8e6 is described below

commit aaad9b4b8e69a272b6e6a6fa4df516b93bdd1506
Author: Jack McCluskey <[email protected]>
AuthorDate: Wed Jul 22 09:08:37 2026 -0400

    [Experimental] Use zstd compression in Docker builds (#39409)
    
    * [Experimental] Use zstd compression in Docker builds
    
    * fix load errors
---
 ...tCommit_Python_ValidatesContainer_Dataflow.json |  2 +-
 .../beam_PreCommit_Flink_Container.json            |  2 +-
 .../org/apache/beam/gradle/BeamDockerPlugin.groovy | 24 +++++++++++++++++-----
 3 files changed, 21 insertions(+), 7 deletions(-)

diff --git 
a/.github/trigger_files/beam_PostCommit_Python_ValidatesContainer_Dataflow.json 
b/.github/trigger_files/beam_PostCommit_Python_ValidatesContainer_Dataflow.json
index 60eb7272a93..327fe1987c5 100644
--- 
a/.github/trigger_files/beam_PostCommit_Python_ValidatesContainer_Dataflow.json
+++ 
b/.github/trigger_files/beam_PostCommit_Python_ValidatesContainer_Dataflow.json
@@ -1,4 +1,4 @@
 {
     "comment": "Modify this file in a trivial way to cause this test suite to 
run",
-    "modification": 4
+    "modification": 5
 }
\ No newline at end of file
diff --git a/.github/trigger_files/beam_PreCommit_Flink_Container.json 
b/.github/trigger_files/beam_PreCommit_Flink_Container.json
index bbdc3a3910e..62ae7886c57 100644
--- a/.github/trigger_files/beam_PreCommit_Flink_Container.json
+++ b/.github/trigger_files/beam_PreCommit_Flink_Container.json
@@ -1,4 +1,4 @@
 {
     "comment": "Modify this file in a trivial way to cause this test suite to 
run",
-    "modification": 3
+    "modification": 4
 }
diff --git 
a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamDockerPlugin.groovy 
b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamDockerPlugin.groovy
index 6963f96d731..574e3411890 100644
--- a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamDockerPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamDockerPlugin.groovy
@@ -61,6 +61,7 @@ class BeamDockerPlugin implements Plugin<Project> {
     boolean push = false
     String builder = null
     String target = null
+    String compression = 'zstd'
 
     File resolvedDockerfile = null
     File resolvedDockerComposeTemplate = null
@@ -72,6 +73,9 @@ class BeamDockerPlugin implements Plugin<Project> {
     DockerExtension(Project project) {
       this.project = project
       this.copySpec = project.copySpec()
+      if (project.hasProperty('docker-compression')) {
+        this.compression = project.property('docker-compression')
+      }
     }
 
     void resolvePathsAndValidate() {
@@ -235,13 +239,23 @@ class BeamDockerPlugin implements Plugin<Project> {
       if (!ext.platform.isEmpty()) {
         buildCommandLine.addAll('--platform', String.join(',', ext.platform))
       }
-      if (ext.load) {
-        buildCommandLine.add '--load'
+      if (ext.load && ext.push) {
+        throw new Exception("cannot combine 'push' and 'load' options")
       }
-      if (ext.push) {
-        buildCommandLine.add '--push'
+      if (ext.compression != null && !ext.compression.isEmpty()) {
+        if (ext.push) {
+          buildCommandLine.add 
"--output=type=registry,compression=${ext.compression},force-compression=true,oci-mediatypes=true"
+        } else if (ext.load) {
+          buildCommandLine.add '--load'
+        } else {
+          buildCommandLine.add 
"--output=type=image,compression=${ext.compression},force-compression=true,oci-mediatypes=true"
+        }
+      } else {
         if (ext.load) {
-          throw new Exception("cannot combine 'push' and 'load' options")
+          buildCommandLine.add '--load'
+        }
+        if (ext.push) {
+          buildCommandLine.add '--push'
         }
       }
       if (ext.builder != null) {

Reply via email to