Open artemptushkin opened 1 year ago
Issue feels a bit all over the place. In my builds, gradle skips over all tasks that it knows it doesn't need to do work on, this includes jib plugin (pass the skip option) to avoid pushing images for things that haven't changed.
Re startup time and differences, I'm going to guess this is Spring boot's plugin adding additional stuff when done via a gradle task (which doesn't execute in the CLI). Things you may want to explore to improve your startup cost:
I want to get back to the topic and say that for one of my projects I have set up jib cli
(jar) without the Gradle plugin and it's amount ~2 times more efficient because we ignore all the gradle scanning and configurations as they are irrelevant.
This plugin only needs the JAR, which can be produced as an artifact of a separate job.
Gradle can also be told to cache configurations too in gradle.properties if you want to see the same effect. Takes some effort to get everything cached correctly however.
I want to get public opinion and know how others see and organize this.
Given:
./gradlew assemble
from scratch, many submodulesbuild-image
job where we run build Docker image withjibDockerBuild
and push itThe reality is that Gradle defines the chain tasks so we always pass redundant configuration steps, and we can easily get into a situation where we recompile something just because the task is not incremental from Gradle's perspective (another story).
What's this for pipeline?
We have to pull and push the Gradle cache for other non-significant tasks (compile) -> for the big project it's time-consuming
Assumption
If we get rid of the plugin and replace it with just Jib CLI
jib jar
the job will be faster keeping the same functionalityPractice
It's faster confirmed:
From 3-5 minutes of running the Gitlab CI/CD job we have now 1-2 minutes
But....
The startup changes from ~25 seconds to ~40 seconds, you can see the Spring log startup degradation on the screenshot
The layers/start difference:
Questions.
Why is Spring start-up time so different between Jib CLI and Jib Gradle plugin build?
Are there any known best practices to optimize the build and startup time?
Is Jib approach documented? I want to know better how and why you build like this