Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to pull and push a specific tagged docker image? #299

Open
nischit7 opened this issue Jul 15, 2020 · 2 comments
Open

How to pull and push a specific tagged docker image? #299

nischit7 opened this issue Jul 15, 2020 · 2 comments

Comments

@nischit7
Copy link

I am trying to use this Concourse CI resource to pulling specific "tagged" docker image.
I tried working out a solution using both https://github.com/concourse/registry-image-resource and https://github.com/concourse/docker-image-resource.
From the documentation, I dont see a way to achieve it.

In the below approach, Its declared as a resource and the tag remains same for rest of the execution.

  - name: server-docker-image-artifactory
    type: docker-image
    icon: docker
    source:
      username: username
      password: password
      tag: "mytag"
      repository: repo

  - name: server-docker-image-bintray
    type: docker-image
    icon: docker
    source:
      username: username
      password: password
      tag: "mytag"
      repository: repo

What I would like to achieve is, when declaring multiple steps, I would like to do something as below.

plan:
    # Pull an image with a "tag" that was derived by some step in the pipeline
    - get: server-docker-image-artifactory
       params:
           tag: my-dynamic tag

    # Copy that specific tagged image from artifactory to bintray
    - put: server-docker-image-bintray
       inputs: ["server-docker-image-artifactory", "my-dynamic tag"]
       params:
           load: server-docker-image-artifactory
           tag_file: my-dynamic tag

Right now... i am unable to provide something like above. It always ends up pulling the latest image.
I tried the params such as "load", "load_file", "load_tag". But no luck
Any directions?

@dragonchaser
Copy link

dragonchaser commented Aug 18, 2020

I am having the same issue here with a similar configuration

        - put: docker.myregistry
          params:
            load_repository: "myregistry/myimage"
            load_file: OUTPUTS/image.tar # pulled in from a previous step
            tag_file: OUTPUTS/my-dynamic.tag.txt # also pulled in from a previous step

Concourse always tries to push "myregistry/myimage:latest" even though the tag is specified in the tag_file.
All other experiments failed aswell (providing tag etc.)

UPDATE: It seems the resource is always appending :latest to the load_repository variable. Why is this even needed (though readme states it as optional, you get an error when it is missing)? Registry, repository, image name should be provided by the file being loaded. This should be an optional value if you want to overwrite the data provided by the tarball IMHO. I'd flag this as a bug.

@xtremerui
Copy link
Contributor

When the image pulled in get step, it is based on the image digest here

image_name="${repository}@${digest}"

And when it got saved with the name that with digest only, it loses repo and tag info

docker save -o ${destination}/image "$image_name"

So later when you load this tar in put step, I'd assume the docker image ls show sth like this:

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
<none>              <none>              12344asdf         8 weeks ago        64.5 MB

So there is no way it can know what the repo ad tag are, and thus we have to make load_repository required when using load_file. Also we have to default to latest tag if load_tag is not provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants