GoogleContainerTools / GoogleContainerTools/jib

jibDockerBuild build randomly fails in multi-project setup with parrallel flag

Open
#3,347 28 comments 8 reactions 0 assignees View on GitHub
area/jib-gradle-plugin priority:p3
Dominant language
Java
Stars
14.5k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

**Environment:**

*Jib version: 3.1.2
*Build tool: Gradle v7.0.2
*OS: Ubuntu-18.04
*JDK 14,
*Java source/target compatibility 12

**Description of the issue:**

In a multi-project gradle project with the flag org.gradle.parallel=true, the execution of the top level jibDockerBuild target randomly fails for one of the projects.
This seems to be due to the parrallel nature of the build.

**Steps to reproduce:**

1. Multi-project with at least 7 services built as docker containers
2. gradle.properties set with parrallel execution
org.gradle.parallel=true
3. build target jibDockerBuild or the root project
4. Extract of the build log
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':project4:jibDockerBuild'.
> com.google.cloud.tools.jib.plugins.common.BuildStepsExecutionException: (null exception message)

**Expected behavior:**
Images for all projects created

**Mitigation:**
This workaround prevent the jibDockerBuild task from each individual project to run in parrallel using the jib.lock file

For each project enabling jib plugin:

// Make sure only one image is created at a time
// as it may cause to overload the socket and fail the build.
// This is done by identifying a common output file
jibDockerBuild.configure {
outputs.file "$rootDir/jib.lock"
}

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.