Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from GoogleContainerTools:master #695

Merged
merged 5 commits into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/dropwizard/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<dropwizard-template-config.version>1.5.0</dropwizard-template-config.version>

<jib.container.appRoot>/app</jib.container.appRoot>
<jib-maven-plugin.version>3.4.3</jib-maven-plugin.version>
<jib-maven-plugin.version>3.4.4</jib-maven-plugin.version>
</properties>

<dependencyManagement>
Expand Down
2 changes: 1 addition & 1 deletion examples/helloworld/build.gradle
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/helloworld/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>3.4.3</jib-maven-plugin.version>
<jib-maven-plugin.version>3.4.4</jib-maven-plugin.version>
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
</properties>

Expand Down
2 changes: 1 addition & 1 deletion examples/java-agent/build.gradle
Original file line number Diff line number Diff line change
@@ -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'
}
Expand Down
2 changes: 1 addition & 1 deletion examples/java-agent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>3.4.3</jib-maven-plugin.version>
<jib-maven-plugin.version>3.4.4</jib-maven-plugin.version>
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
<download-maven-plugin.version>1.4.2</download-maven-plugin.version>
<git-commit-id-plugin.version>3.0.1</git-commit-id-plugin.version>
Expand Down
2 changes: 1 addition & 1 deletion examples/ktor/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion examples/micronaut/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion examples/multi-module/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion examples/multi-module/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>3.4.3</version>
<version>3.4.4</version>
</plugin>
</plugins>
</pluginManagement>
Expand Down
2 changes: 1 addition & 1 deletion examples/spring-boot/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion examples/spring-boot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>3.4.3</version>
<version>3.4.4</version>
</plugin>
</plugins>
</build>
Expand Down
2 changes: 1 addition & 1 deletion examples/vertx/build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions jib-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions jib-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ Add Jib Core as a dependency using Maven:
<dependency>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-core</artifactId>
<version>0.27.1</version>
<version>0.27.2</version>
</dependency>
```

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'
}
```

Expand Down
2 changes: 1 addition & 1 deletion jib-core/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = 0.27.2-SNAPSHOT
version = 0.27.3-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -103,6 +109,12 @@ public List<DescriptorDigest> 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.
*
Expand Down Expand Up @@ -188,13 +200,19 @@ public boolean supported(Map<String, String> 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<DockerInfoDetails> 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
Expand Down Expand Up @@ -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);
}
}
4 changes: 4 additions & 0 deletions jib-gradle-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion jib-gradle-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
```

Expand Down
2 changes: 1 addition & 1 deletion jib-gradle-plugin/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = 3.4.4-SNAPSHOT
version = 3.4.5-SNAPSHOT
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 4 additions & 0 deletions jib-maven-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions jib-maven-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ 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=<MY IMAGE>
mvn compile com.google.cloud.tools:jib-maven-plugin:3.4.4:build -Dimage=<MY IMAGE>
```

This builds and pushes a container image for your application to a container registry. *If you encounter authentication issues, see [Authentication Methods](#authentication-methods).*

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.
Expand All @@ -74,7 +74,7 @@ In your Maven Java project, add the plugin to your `pom.xml`:
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>3.4.3</version>
<version>3.4.4</version>
<configuration>
<to>
<image>myimage</image>
Expand Down
2 changes: 1 addition & 1 deletion jib-maven-plugin/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = 3.4.4-SNAPSHOT
version = 3.4.5-SNAPSHOT
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Loading