skaffold: Jib 'cache checking' is too slow when there's many modules (eg microservices)
Many times ./gradlew … is called - this is overkill even with Gradle daemon!
Much faster is running Jib manually:
custom:
buildCommand: ./gradlew :project:path:jibDockerBuild --image $IMAGE
Single call to ./gradlew should be enough for whole build.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 1
- Comments: 18 (13 by maintainers)
What’s happening here is that Skaffold’s cache mechanism needs to get each module’s list of dependencies in order to compute a digest and compare with what it has already built before. This currently runs gradle for each module, not matter wether it’s a cache hit or miss. This is slow indeed.
When you switch to a custom artifact, you get faster results because it then doesn’t ask gradle about the dependencies. It assumes the whole workspace is a dependency and computes a digest for the files contained in it. That can be much faster.
@GoogleContainerTools/java-tools-build Any idea what we could do to improve that behaviour?
@tejal29 We don’t currently have plans for additional jib API surfaces. It sounds like there was a caching solution proposed in Skaffold that would make starting multiple gradle processes unnecessary. Perhaps Skaffold could also recommend best practices for when Jib will work better vs when buildpacks are appropriate.