docker-image-resource icon indicating copy to clipboard operation
docker-image-resource copied to clipboard

Ensure - If does not exist put option

Open ggeorgiev opened this issue 9 years ago • 4 comments

I have a scenario where build of the same docker image can be triggered from many different pipelines. I would like to reduce the time this task will take if the image already exists.

I know that this does not seem to make a lot of sense - if the existing one is not exactly the same as the one that is going to be produced. I am handling this outside, but build if needed option could be also considered for the plugin (it is not as hard if you design the dockerfile with such feature in mind).

Anyways, what I would like to see is if this option is enabled the put command to first check if a docker image at the repo with the tag is already there and simply exit with success.

ggeorgiev avatar Nov 29 '16 22:11 ggeorgiev

Hi there!

We use Pivotal Tracker to provide visibility into what our team is working on. A story for this issue has been automatically created.

The current status is as follows:

  • [ ] #135175651 Ensure - If does not exist put option

This comment, as well as the labels on the issue, will be automatically updated as the status in Tracker changes.

concourse-bot avatar Nov 29 '16 22:11 concourse-bot

I only have one pipeline but I do like this feature. I was looking for something like this.

ls-yann-david avatar Dec 15 '16 14:12 ls-yann-david

Would you guys accept a PR for this feature? It's something my company needs for our use-cases as well.

We're going to be doing a gradual transition to concourse and as such we'll have a mix of developers pushing images directly. Our registry, artifactory, doesn't allow the same tag to be pushed multiple times and causes docker push to throw a cryptic error message (manifest invalid: manifest invalid). This feature would prevent the builds from failing if a particular tag was already present on the registry; effectively making the put a no-op.

I'm thinking this should be a new parameter called prevent_overwrite and it will default to false. I'm open to better names for the parameter. I'm also planning to use docker inspect --type=image ${repository}:${tag_name} to check if the image already exists.

If my proposal is approved, is there a longer process that I'll need to follow to get my changes to flow through into concourse proper?

jondlm avatar May 08 '18 19:05 jondlm

I've since discovered that docker inspect --type=image only checks local tags, so it's not going to work for what I was hoping.

jondlm avatar May 16 '18 22:05 jondlm