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

tag_as_latest doesn't work

Open nsitbon opened this issue 6 years ago • 7 comments

Hi

Using Concourse 3.3.3 I can't make tag_as_latest working as expected. Even with previous version it doesn't tag the image as latest.

Nothing special in my configuration file:

- put: prod-image
  params:
      load: prod-image
       tag: prod-helm/version
       tag_as_latest: true

I tried to rebuild the docker image of your resource but it's not easy as it's supposed to be integrated into your pipeline.

Any ideas?

nsitbon avatar Aug 28 '17 08:08 nsitbon

Please specify how it is not working.

  • Did any image get pushed up?
  • What tags were pushed?
  • etc.

jtarchie avatar Aug 30 '17 20:08 jtarchie

Sorry only the tag specified in the file prod-helm/version has been pushed but I never get the latest tag. I tried multiple conbination with and without the tag directive. I also tried different way to get the true value like tag_as_latest: TRUE or 1 etc.

nsitbon avatar Aug 31 '17 07:08 nsitbon

I'm running into this issue as well.

simondiep avatar Sep 06 '18 17:09 simondiep

Same problem here, using Concourse 4.2.2, having:

resources:
  - name: web-image
    type: docker-image
    source:
      repository: 12345.dkr.ecr.eu-west-1.amazonaws.com/myapp
      <<: *aws-credentials
# ...
jobs:
- name: build-main
  plan:
  # ...
  - aggregate:
  - put: web-image
      resource: web-image
      params:
        build: build/docker
        skip_download: false
        tag_file: version/number
        tag_prefix: next_
        tag_as_latest: true
      get_params: { skip_download: true }  

The image is only tagged with something like next_0.0.5. Log from the relevant part of the build:

waiting for docker to come up...
Sending build context to Docker daemon  210.7MB
Step 1/10 : FROM openjdk:8-jre-alpine
8-jre-alpine: Pulling from library/openjdk
...
Successfully built d184095cdaa1
Successfully tagged 12345.dkr.ecr.eu-west-1.amazonaws.com/myapp:next_0.0.5
The push refers to repository [12345.dkr.ecr.eu-west-1.amazonaws.com/myapp]
...
510f10602166: Pushed
next_0.0.5: digest: sha256:f6877b9770544d61f19b8d6548127a0100a278bdc6b4c1b299b980551628f381 size: 2415

Workaround

FYI, I have managed to work around the problem by creating a file with the string latest in my build task:

echo "latest" > build/extra-tags

and then using it as extra tags in the image production:

  - put: web-image
      resource: web-image
      params:
        ...
        additional_tags: build/extra-tags

holyjak avatar Jan 04 '19 09:01 holyjak

Are folks still facing this issue? I can't reproduce this with a following test in out_test.go

	Context("When passing tag and tag_as_latest", func() {
		It("should pull tag from file and also tag it latest", func() {
			session := put(map[string]interface{}{
				"source": map[string]interface{}{
					"repository": "test",
				},
				"params": map[string]interface{}{
					"build":         "/docker-image-resource/tests/fixtures/build",
					"tag_file":      "/docker-image-resource/tests/fixtures/tag",
					"tag_as_latest": true,
				},
			},
			)
			Expect(session.Err).To(gbytes.Say(docker(`push test:foo`)))
			Expect(session.Err).To(gbytes.Say(docker(`push test:latest`)))
		})
	})

The test passes also with "tag_as_latest": "true"

xtremerui avatar May 08 '20 15:05 xtremerui

I'm here because i currently have the INVERSE of this problem. Explicitly passing tag_as_latest: false results in the latest tag being pushed to. In fact the latest tag appears to always be pushed to no matter what I set.

crouth-redge avatar Feb 08 '24 16:02 crouth-redge

I'm here because i currently have the INVERSE of this problem. Explicitly passing tag_as_latest: false results in the latest tag being pushed to. In fact the latest tag appears to always be pushed to no matter what I set.

for anyone coming across this, it was resolved by ensuring tag_file: version/version was defined. by default docker builds without a tag defined get latest. by ensuring a tag is defined, and tag_as_latest: false is set, latest is not applied

paulroche avatar Mar 13 '24 18:03 paulroche