Skip to content

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

@gbesancon

Description

@gbesancon

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"
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions