Closed JoarSvartholm closed 1 month ago
This is intentional, because the purpose of jibDockerBuild
is to push an image to a Docker engine. Suppose that your Docker daemon doesn't have an image yet, while there exist jib-image.digest
, etc. (which can be created by other tasks) whose presence makes Gradle skip jibDockerBuild
. Then you'll have to clean them to be able to push an image to your Docker daemon. (Worse, there is no way to check whether the exact same image already exists in a Docker engine, which is the limitation of the Docker Engine API. Even if it were possible, jibDockerBuild
would have to run every time to do the check anyway.)
But at least Jib caches all the necessary assets including image layers, so subsequent jibDockerBuild
runs don't rebuild assets already built and are fast. It's just that it has to push an image to Docker every time (which could have been even faster if the Docker Engine API had better support).
This is intentional, because the purpose of
jibDockerBuild
is to push an image to a Docker engine. Suppose that your Docker daemon doesn't have an image yet, while there existjib-image.digest
, etc. (which can be created by other tasks) whose presence makes Gradle skipjibDockerBuild
. Then you'll have to clean them to be able to push an image to your Docker daemon. (Worse, there is no way to check whether the exact same image already exists in a Docker engine, which is the limitation of the Docker Engine API. Even if it were possible,jibDockerBuild
would have to run every time to do the check anyway.)But at least Jib caches all the necessary assets including image layers, so subsequent
jibDockerBuild
runs don't rebuild assets already built and are fast. It's just that it has to push an image to Docker every time (which could have been even faster if the Docker Engine API had better support).
Ah I see, that actually makes sense. Unless theres a way for gradle to do the up-to-date check towards the docker engine (like checking with docker inspect <image>
), it has to be kept like this. Thanks for the well-explained reply 👍
Environment:
Description of the issue: Gradles build cache seem to be unsupported causing the build to always create a new image, even if no sources are changed. This can be seen in the logs when running
gradlew jibDockerBuild --info
Expected behavior: Running the same command twice should not create a new image the second time Eg, this should be in the logs:
Steps to reproduce:
jibDockerBuild
)Log output:
Additional Information: Up-to-date checks in gradle are typically done by specifying a field on the task marked with one of the
@Output
annotations, see this page: https://docs.gradle.org/current/userguide/implementing_custom_tasks.html#sec:task_groupsIt looks like the following properties should be marked as outputs: