gradle-docker-plugin: Image is not re-tagged if tag was removed since last build
When building an image via the DockerBuildImage task with a tag configured, and manually deleting that tag via docker image rm <tag>, re-running the tasks says it’s up-to-date, not re-creating the tag.
Expected Behavior
Given the task (in a Java application sub-project called “cli”)
task dockerBuildBaseImage(type: com.bmuschko.gradle.docker.tasks.image.DockerBuildImage) {
description = 'Builds the base Docker image to run ORT.'
// This uses 'docker/Dockerfile'.
tag = 'ort-base:latest'
}
and running
$ ./gradlew cli:dockerBuildBaseImage $ docker image rm ort-base:latest $ ./gradlew cli:dockerBuildBaseImage
I’d expect the tag to be re-created.
Current Behavior
The tag is not re-created and the task is displayed as “up-to-date”.
Context
I accidentally deleted the tag and wanted to re-create it. As I didn’t know the hash, re-running the task seemed like an easy way to re-create it.
Steps to Reproduce (for bugs)
See expected behavior above.
Your Environment
Ubuntu 18.04.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 25 (13 by maintainers)
@orzeh @cdancy I’d rather leave it to the users to define their up-to-date strategies instead of adding more code to the plugin that has to be maintained and tested. As an end user of the plugin you can achieve pretty much anything you want with
upToDateWhenand additional inputs/outputs.I don’t think I fully grasp the problem yet that would make the up-to-date checking the hairy problem you are describing. I think it would be awesome if you could describe the different scenarios in more detail and why a given approach breaks down. We might also want to add that for the user guide.
@bmuschko I think my previous post demonstrates that: you may want to rebuild and tag image even if project binaries didn’t changed and image with ID that you have saved during previous build exists in Docker engine.
I also not sure what do you mean by “exists in local registry”. Would you check Docker daemon or Docker registry?
I reverted the change and released a new version. Happy to a receive a PR that solve the problem sufficiently!