From 6c2194cb317c4d682d91090d9a5988ff3bc12928 Mon Sep 17 00:00:00 2001 From: Mridula <66699525+mpeddada1@users.noreply.github.com> Date: Fri, 25 Oct 2024 09:58:13 -0400 Subject: [PATCH 1/5] chore: update docs and examples for 3.4.4 and 0.27.2 releases (#4329) --- examples/dropwizard/pom.xml | 2 +- examples/helloworld/build.gradle | 2 +- examples/helloworld/pom.xml | 2 +- examples/java-agent/build.gradle | 2 +- examples/java-agent/pom.xml | 2 +- examples/ktor/build.gradle.kts | 2 +- examples/micronaut/build.gradle | 2 +- examples/multi-module/build.gradle | 2 +- examples/multi-module/pom.xml | 2 +- examples/spring-boot/build.gradle | 2 +- examples/spring-boot/pom.xml | 2 +- examples/vertx/build.gradle | 2 +- jib-core/CHANGELOG.md | 4 ++++ jib-core/README.md | 4 ++-- jib-gradle-plugin/CHANGELOG.md | 4 ++++ jib-gradle-plugin/README.md | 2 +- jib-maven-plugin/CHANGELOG.md | 4 ++++ jib-maven-plugin/README.md | 6 +++--- 18 files changed, 30 insertions(+), 18 deletions(-) diff --git a/examples/dropwizard/pom.xml b/examples/dropwizard/pom.xml index 1a0780ecde..ba520eec2d 100644 --- a/examples/dropwizard/pom.xml +++ b/examples/dropwizard/pom.xml @@ -26,7 +26,7 @@ 1.5.0 /app - 3.4.3 + 3.4.4 diff --git a/examples/helloworld/build.gradle b/examples/helloworld/build.gradle index 5ffb87042c..6de1c83cd2 100644 --- a/examples/helloworld/build.gradle +++ b/examples/helloworld/build.gradle @@ -1,6 +1,6 @@ plugins { id 'java' - id 'com.google.cloud.tools.jib' version '3.4.3' + id 'com.google.cloud.tools.jib' version '3.4.4' } sourceCompatibility = 1.8 diff --git a/examples/helloworld/pom.xml b/examples/helloworld/pom.xml index b5a5bf3479..5f0a3ceb1c 100644 --- a/examples/helloworld/pom.xml +++ b/examples/helloworld/pom.xml @@ -9,7 +9,7 @@ UTF-8 - 3.4.3 + 3.4.4 3.8.0 diff --git a/examples/java-agent/build.gradle b/examples/java-agent/build.gradle index 1f24cc3458..87157b9b4f 100644 --- a/examples/java-agent/build.gradle +++ b/examples/java-agent/build.gradle @@ -1,6 +1,6 @@ plugins { id 'java' - id 'com.google.cloud.tools.jib' version '3.4.3' + id 'com.google.cloud.tools.jib' version '3.4.4' id 'de.undercouch.download' version '4.0.0' id 'com.gorylenko.gradle-git-properties' version '2.2.0' } diff --git a/examples/java-agent/pom.xml b/examples/java-agent/pom.xml index a4d476488b..8a12ede648 100644 --- a/examples/java-agent/pom.xml +++ b/examples/java-agent/pom.xml @@ -9,7 +9,7 @@ UTF-8 - 3.4.3 + 3.4.4 3.8.0 1.4.2 3.0.1 diff --git a/examples/ktor/build.gradle.kts b/examples/ktor/build.gradle.kts index 128daeab3c..7ff8375c0a 100644 --- a/examples/ktor/build.gradle.kts +++ b/examples/ktor/build.gradle.kts @@ -1,7 +1,7 @@ plugins { application kotlin("jvm") version "1.3.10" - id("com.google.cloud.tools.jib") version "3.4.3" + id("com.google.cloud.tools.jib") version "3.4.4" } group = "example" diff --git a/examples/micronaut/build.gradle b/examples/micronaut/build.gradle index fe153ba0a9..689734851d 100644 --- a/examples/micronaut/build.gradle +++ b/examples/micronaut/build.gradle @@ -2,7 +2,7 @@ plugins { id "groovy" id "com.github.johnrengelman.shadow" version "5.2.0" id "application" - id 'com.google.cloud.tools.jib' version '3.4.3' + id 'com.google.cloud.tools.jib' version '3.4.4' } version "0.1" diff --git a/examples/multi-module/build.gradle b/examples/multi-module/build.gradle index f79edd7987..0684767f76 100644 --- a/examples/multi-module/build.gradle +++ b/examples/multi-module/build.gradle @@ -2,5 +2,5 @@ plugins { id 'org.springframework.boot' version '2.0.3.RELEASE' apply false id 'io.spring.dependency-management' version '1.0.6.RELEASE' apply false - id 'com.google.cloud.tools.jib' version '3.4.3' apply false + id 'com.google.cloud.tools.jib' version '3.4.4' apply false } diff --git a/examples/multi-module/pom.xml b/examples/multi-module/pom.xml index 38351f0b50..3a3b444285 100644 --- a/examples/multi-module/pom.xml +++ b/examples/multi-module/pom.xml @@ -41,7 +41,7 @@ com.google.cloud.tools jib-maven-plugin - 3.4.3 + 3.4.4 diff --git a/examples/spring-boot/build.gradle b/examples/spring-boot/build.gradle index fbd2a775c9..709dc8cd16 100644 --- a/examples/spring-boot/build.gradle +++ b/examples/spring-boot/build.gradle @@ -4,7 +4,7 @@ plugins { id 'idea' id 'org.springframework.boot' version '2.1.6.RELEASE' id 'io.spring.dependency-management' version '1.0.6.RELEASE' - id 'com.google.cloud.tools.jib' version '3.4.3' + id 'com.google.cloud.tools.jib' version '3.4.4' } repositories { diff --git a/examples/spring-boot/pom.xml b/examples/spring-boot/pom.xml index e59baa8377..5f289994a7 100644 --- a/examples/spring-boot/pom.xml +++ b/examples/spring-boot/pom.xml @@ -29,7 +29,7 @@ com.google.cloud.tools jib-maven-plugin - 3.4.3 + 3.4.4 diff --git a/examples/vertx/build.gradle b/examples/vertx/build.gradle index 02717a203b..0e0108958b 100644 --- a/examples/vertx/build.gradle +++ b/examples/vertx/build.gradle @@ -1,6 +1,6 @@ plugins { id 'io.vertx.vertx-plugin' version '0.1.0' - id 'com.google.cloud.tools.jib' version '3.4.3' + id 'com.google.cloud.tools.jib' version '3.4.4' } repositories { diff --git a/jib-core/CHANGELOG.md b/jib-core/CHANGELOG.md index ab9f84acfd..aa2a13f7cf 100644 --- a/jib-core/CHANGELOG.md +++ b/jib-core/CHANGELOG.md @@ -9,6 +9,10 @@ All notable changes to this project will be documented in this file. ### Fixed +## 0.27.2 +- fix: allow pushing images with different arch/os to docker daemon [#4265](https://github.com/GoogleContainerTools/jib/issues/4265) +- fix: address windows deadlock issue when determining docker environment info [#4267](https://github.com/GoogleContainerTools/jib/issues/4265) + ## 0.27.1 ### Fixed diff --git a/jib-core/README.md b/jib-core/README.md index 82637ecd91..223aa6a4bd 100644 --- a/jib-core/README.md +++ b/jib-core/README.md @@ -22,7 +22,7 @@ Add Jib Core as a dependency using Maven: com.google.cloud.tools jib-core - 0.27.1 + 0.27.2 ``` @@ -30,7 +30,7 @@ Add Jib Core as a dependency using Gradle: ```groovy dependencies { - compile 'com.google.cloud.tools:jib-core:0.27.1' + compile 'com.google.cloud.tools:jib-core:0.27.2' } ``` diff --git a/jib-gradle-plugin/CHANGELOG.md b/jib-gradle-plugin/CHANGELOG.md index 1d51986581..c2364cd7a4 100644 --- a/jib-gradle-plugin/CHANGELOG.md +++ b/jib-gradle-plugin/CHANGELOG.md @@ -9,6 +9,10 @@ All notable changes to this project will be documented in this file. ### Fixed +## 3.4.4 +- fix: allow pushing images with different arch/os to docker daemon [#4265](https://github.com/GoogleContainerTools/jib/issues/4265) +- fix: address windows deadlock issue when determining docker environment info [#4267](https://github.com/GoogleContainerTools/jib/issues/4265) + ## 3.4.3 ### Fixed diff --git a/jib-gradle-plugin/README.md b/jib-gradle-plugin/README.md index 5c4001018d..b18fba66e1 100644 --- a/jib-gradle-plugin/README.md +++ b/jib-gradle-plugin/README.md @@ -53,7 +53,7 @@ In your Gradle Java project, add the plugin to your `build.gradle`: ```groovy plugins { - id 'com.google.cloud.tools.jib' version '3.4.3' + id 'com.google.cloud.tools.jib' version '3.4.4' } ``` diff --git a/jib-maven-plugin/CHANGELOG.md b/jib-maven-plugin/CHANGELOG.md index 2f4ca92c14..9aca1d9f0d 100644 --- a/jib-maven-plugin/CHANGELOG.md +++ b/jib-maven-plugin/CHANGELOG.md @@ -9,6 +9,10 @@ All notable changes to this project will be documented in this file. ### Fixed +## 3.4.4 +- fix: allow pushing images with different arch/os to docker daemon [#4265](https://github.com/GoogleContainerTools/jib/issues/4265) +- fix: address windows deadlock issue when determining docker environment info [#4267](https://github.com/GoogleContainerTools/jib/issues/4265) + ## 3.4.3 ### Fixed diff --git a/jib-maven-plugin/README.md b/jib-maven-plugin/README.md index 11046482ff..622d6bfc75 100644 --- a/jib-maven-plugin/README.md +++ b/jib-maven-plugin/README.md @@ -48,7 +48,7 @@ For information about the project, see the [Jib project README](../README.md). You can containerize your application easily with one command: ```shell -mvn compile com.google.cloud.tools:jib-maven-plugin:3.4.3:build -Dimage= +mvn compile com.google.cloud.tools:jib-maven-plugin:3.4.4:build -Dimage= ``` This builds and pushes a container image for your application to a container registry. *If you encounter authentication issues, see [Authentication Methods](#authentication-methods).* @@ -56,7 +56,7 @@ This builds and pushes a container image for your application to a container reg To build to a Docker daemon, use: ```shell -mvn compile com.google.cloud.tools:jib-maven-plugin:3.4.3:dockerBuild +mvn compile com.google.cloud.tools:jib-maven-plugin:3.4.4:dockerBuild ``` If you would like to set up Jib as part of your Maven build, follow the guide below. @@ -74,7 +74,7 @@ In your Maven Java project, add the plugin to your `pom.xml`: com.google.cloud.tools jib-maven-plugin - 3.4.3 + 3.4.4 myimage From dff4ced161e7eab87b23a703ff62a3f068488a0d Mon Sep 17 00:00:00 2001 From: cloud-java-bot <122572305+cloud-java-bot@users.noreply.github.com> Date: Fri, 25 Oct 2024 10:02:12 -0400 Subject: [PATCH 2/5] maven release v3.4.4 (#4325) * [Gradle Release Plugin] - pre tag commit: 'v3.4.4-maven'. * [Gradle Release Plugin] - new version commit: 'v3.4.5-SNAPSHOT-maven'. --------- Co-authored-by: mpeddada1 --- jib-maven-plugin/gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jib-maven-plugin/gradle.properties b/jib-maven-plugin/gradle.properties index 882261a1db..f78665a194 100644 --- a/jib-maven-plugin/gradle.properties +++ b/jib-maven-plugin/gradle.properties @@ -1 +1 @@ -version = 3.4.4-SNAPSHOT +version = 3.4.5-SNAPSHOT From 2f0d0315555272dd74012c1f43b6fb0e74fbe1df Mon Sep 17 00:00:00 2001 From: cloud-java-bot <122572305+cloud-java-bot@users.noreply.github.com> Date: Fri, 25 Oct 2024 10:02:23 -0400 Subject: [PATCH 3/5] gradle release v3.4.4 (#4323) * [Gradle Release Plugin] - pre tag commit: 'v3.4.4-gradle'. * [Gradle Release Plugin] - new version commit: 'v3.4.5-SNAPSHOT-gradle'. --------- Co-authored-by: mpeddada1 --- jib-gradle-plugin/gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jib-gradle-plugin/gradle.properties b/jib-gradle-plugin/gradle.properties index 882261a1db..f78665a194 100644 --- a/jib-gradle-plugin/gradle.properties +++ b/jib-gradle-plugin/gradle.properties @@ -1 +1 @@ -version = 3.4.4-SNAPSHOT +version = 3.4.5-SNAPSHOT From 68f89477c2b67c1c3d0714c1b1597f4db355444d Mon Sep 17 00:00:00 2001 From: cloud-java-bot <122572305+cloud-java-bot@users.noreply.github.com> Date: Fri, 25 Oct 2024 10:02:33 -0400 Subject: [PATCH 4/5] core release v0.27.2 (#4321) * [Gradle Release Plugin] - pre tag commit: 'v0.27.2-core'. * [Gradle Release Plugin] - new version commit: 'v0.27.3-SNAPSHOT-core'. --------- Co-authored-by: mpeddada1 --- jib-core/gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jib-core/gradle.properties b/jib-core/gradle.properties index 67f1f13bde..1d352d7234 100644 --- a/jib-core/gradle.properties +++ b/jib-core/gradle.properties @@ -1 +1 @@ -version = 0.27.2-SNAPSHOT +version = 0.27.3-SNAPSHOT From aac44d35da214e55cc2b98ed138b84737e061005 Mon Sep 17 00:00:00 2001 From: Mridula <66699525+mpeddada1@users.noreply.github.com> Date: Fri, 25 Oct 2024 18:30:31 -0400 Subject: [PATCH 5/5] fix: add timeout for docker info read to prevent Jib from getting stuck indefinitely (#4319) * fix: address nightly build failure with dockerBuild; add timeout for docker info read --- .../tools/jib/docker/CliDockerClient.java | 40 ++++++++++++++++--- .../gradle/projects/simple/mock-docker.sh | 6 +++ .../maven/projects/simple/mock-docker.sh | 6 +++ 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/jib-core/src/main/java/com/google/cloud/tools/jib/docker/CliDockerClient.java b/jib-core/src/main/java/com/google/cloud/tools/jib/docker/CliDockerClient.java index d3dcecd883..035c9316f3 100644 --- a/jib-core/src/main/java/com/google/cloud/tools/jib/docker/CliDockerClient.java +++ b/jib-core/src/main/java/com/google/cloud/tools/jib/docker/CliDockerClient.java @@ -47,6 +47,12 @@ import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import java.util.function.Consumer; import java.util.function.Function; @@ -103,6 +109,12 @@ public List getDiffIds() throws DigestException { /** Default path to the docker executable. */ public static final Path DEFAULT_DOCKER_CLIENT = Paths.get("docker"); + /** + * 10 minute timeout to ensure that Jib doesn't get stuck indefinitely when expecting a docker + * output. + */ + public static final Long DOCKER_OUTPUT_TIMEOUT = (long) 10 * 60 * 1000; + /** * Checks if Docker is installed on the user's system by running the `docker` command. * @@ -188,13 +200,19 @@ public boolean supported(Map parameters) { @Override public DockerInfoDetails info() throws IOException, InterruptedException { // Runs 'docker info'. - Process infoProcess = docker("info", "-f", "{{json .}}"); - InputStream inputStream = infoProcess.getInputStream(); - if (infoProcess.waitFor() != 0) { - throw new IOException( - "'docker info' command failed with error: " + getStderrOutput(infoProcess)); + ExecutorService executor = Executors.newSingleThreadExecutor(); + Future readerFuture = executor.submit(this::fetchInfoDetails); + try { + DockerInfoDetails details = readerFuture.get(DOCKER_OUTPUT_TIMEOUT, TimeUnit.MILLISECONDS); + return details; + } catch (TimeoutException e) { + readerFuture.cancel(true); // Interrupt the reader thread + throw new IOException("Timeout reached while waiting for 'docker info' output"); + } catch (ExecutionException e) { + throw new IOException("Failed to read output of 'docker info': " + e.getMessage()); + } finally { + executor.shutdownNow(); } - return JsonTemplateMapper.readJson(inputStream, DockerInfoDetails.class); } @Override @@ -270,4 +288,14 @@ public DockerImageDetails inspect(ImageReference imageReference) private Process docker(String... subCommand) throws IOException { return processBuilderFactory.apply(Arrays.asList(subCommand)).start(); } + + private DockerInfoDetails fetchInfoDetails() throws IOException, InterruptedException { + Process infoProcess = docker("info", "-f", "{{json .}}"); + InputStream inputStream = infoProcess.getInputStream(); + if (infoProcess.waitFor() != 0) { + throw new IOException( + "'docker info' command failed with error: " + getStderrOutput(infoProcess)); + } + return JsonTemplateMapper.readJson(inputStream, DockerInfoDetails.class); + } } diff --git a/jib-gradle-plugin/src/integration-test/resources/gradle/projects/simple/mock-docker.sh b/jib-gradle-plugin/src/integration-test/resources/gradle/projects/simple/mock-docker.sh index e4b78a0f4c..84eafa19a8 100755 --- a/jib-gradle-plugin/src/integration-test/resources/gradle/projects/simple/mock-docker.sh +++ b/jib-gradle-plugin/src/integration-test/resources/gradle/projects/simple/mock-docker.sh @@ -1,5 +1,11 @@ #!/bin/bash +if [[ "$1" == "info" ]]; then + # Output the JSON string + echo "{\"OSType\":\"linux\",\"Architecture\":\"x86_64\"}" + exit 0 +fi + # Read stdin to avoid broken pipe cat > /dev/null diff --git a/jib-maven-plugin/src/test/resources/maven/projects/simple/mock-docker.sh b/jib-maven-plugin/src/test/resources/maven/projects/simple/mock-docker.sh index e4b78a0f4c..84eafa19a8 100755 --- a/jib-maven-plugin/src/test/resources/maven/projects/simple/mock-docker.sh +++ b/jib-maven-plugin/src/test/resources/maven/projects/simple/mock-docker.sh @@ -1,5 +1,11 @@ #!/bin/bash +if [[ "$1" == "info" ]]; then + # Output the JSON string + echo "{\"OSType\":\"linux\",\"Architecture\":\"x86_64\"}" + exit 0 +fi + # Read stdin to avoid broken pipe cat > /dev/null