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

It is not possible to reproduce docker-build-push-action@v1 behavior #40

Closed
vitalyster opened this issue Jan 20, 2021 · 7 comments
Closed

Comments

@vitalyster
Copy link

vitalyster commented Jan 20, 2021

Behaviour

My configuration in V1 was: tag each commit to default branch as 'latest', and tag each git tag (e.g. 'v1.0.0') with v1.0.0 docker tag.
With V2 and this meta action everything is broken: when I push a git tag 'git push v1.0.0' I got 'v1.0.0' and 'latest' docker tags pointing to the same image. When I build an image on default branch without tag - 'latest' tag overwritten and pointing to some wrong image!

Steps to reproduce this issue

  1. This is my test Github repo with these actions - https://github.com/vitalyster/docker_build_action_hello
  2. This is what was published from master branch - https://hub.docker.com/repository/docker/vitalyster/hello/tags?page=1&ordering=last_updated

Expected behaviour

'latest' tag should point to '1.0.0' or 'master' tag (should be configurable)

Actual behaviour

I'm not sure what is going on with latest tag, it is unusable for me

@crazy-max
Copy link
Member

crazy-max commented Jan 20, 2021

@vitalyster

tag each commit to default branch as 'latest'

Not really a good practice. latest tag should always point to a semver release. But if you really want this you can use:

      - name: Docker meta
        id: docker_meta
        uses: crazy-max/ghaction-docker-meta@v1
        with:
          images: name/app
          tag-semver: |
            {{version}}
          tag-latest: ${{ endsWith(github.ref, github.repository.default_branch) || startsWith(github.ref, 'refs/tags/') }}

@vitalyster
Copy link
Author

vitalyster commented Jan 21, 2021

I pushed these changes to my test repo and behavior still wrong: only master tag is updated correctly, latest tag still broken

@vitalyster
Copy link
Author

vitalyster commented Jan 21, 2021

And I'm OK if latest will point to latest semver release, but now it pointing nowhere

@crazy-max
Copy link
Member

@vitalyster

latest tag still broken

Yes same issue as #41. tag-latest is only handled on tag-semver or tag-match.

@vitalyster
Copy link
Author

vitalyster commented Feb 3, 2021

It is not the same issue, you are discussing about cases when latest tag is not updated, in my case it is updated with some wrong ref(?), please check

@crazy-max
Copy link
Member

crazy-max commented Feb 4, 2021

@vitalyster

From what I see vitalyster/hello:latest has not been pushed through docker-build-push-action@v2 action but rather manually from your computer or somewhere else as it does not contains a manifest list media-type:

$ docker buildx imagetools inspect vitalyster/hello:latest
Name:      docker.io/vitalyster/hello:latest
MediaType: application/vnd.oci.image.index.v1+json
Digest:    sha256:b1c26f9a9d0b782efe32db37eec98316e300e2e879bc9be558f1d226b418ea97

Manifests:
  Name:      docker.io/vitalyster/hello:latest@sha256:30d5333d20a68dd6ea3689e2c5692d7071f2d68e72c06f0b3b4c7e213df454e2
  MediaType: application/vnd.oci.image.layer.v1.tar+gzip

  Name:      docker.io/vitalyster/hello:latest@sha256:596ba82af5aaa3e2fd9d6f955b8b94f0744a2b60710e3c243ba3e4a467f051d1
  MediaType: application/vnd.oci.image.layer.v1.tar+gzip

  Name:      docker.io/vitalyster/hello:latest@sha256:ccd3b904f96b07b58b445111969725befabf7bb670d7bb9a8f0d997ee7c8fab5
  MediaType: application/vnd.oci.image.layer.v1.tar+gzip

  Name:      docker.io/vitalyster/hello:latest@sha256:ccd3b904f96b07b58b445111969725befabf7bb670d7bb9a8f0d997ee7c8fab5
  MediaType: application/vnd.oci.image.layer.v1.tar+gzip

  Name:      docker.io/vitalyster/hello:latest@sha256:6f635f9114444e8eeb6dbc877c0312e09da686da7d9f150d2f38a080776d60ae
  MediaType: application/vnd.buildkit.cacheconfig.v0

But after looking again I see this manifest only contains cache metadata and from what I see from your workflow is not configured properly. cache-to should be replaced with cache-to: type=inline. See https://github.com/docker/build-push-action/#cache-to-registry as an example.

@vitalyster
Copy link
Author

Thank you! Now everything works as expected

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

2 participants