-
Couldn't load subscription status.
- Fork 9
Fix latest container tag publishing #41
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
base: main
Are you sure you want to change the base?
Conversation
Check the current tag against the list of all tags to make sure that it is the actual latest tag before attempting to publish the container `latest` tag. This avoids updating the `latest` tag when pushing bug fixes to older release branchs. Fixes: prometheus/prometheus#16238 Signed-off-by: SuperQ <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this, we'll end up tweaking the CI after all :)
left some comments
| shell: bash | ||
| - run: | | ||
| current_tag=${GITHUB_REF#refs/*/} | ||
| latest_tag=$(git tag --sort=v:refname | tail -n 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe we could log this and current_tag for better visibility.
| make docker-manifest DOCKER_IMAGE_TAG="latest" DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }} | ||
| make docker-publish DOCKER_IMAGE_TAG="$current_tag" DOCKER_REPO="${reg_repo}" | ||
| make docker-manifest DOCKER_IMAGE_TAG="$current_tag" DOCKER_REPO="${reg_repo}" | ||
| if [[ "${current_tag}" == "${latest_tag}" ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trying this out:
$ git tag --sort=v:refname | tail -n 3
v3.2.1
v3.3.0-rc.0
v3.3.0-rc.1
so if we ship v3.2.2 now, latest will not get applied because of the 3.3 RCs
I'll try to sell it again, how about using docker/metadata-actio to take care of that?
I'm not too familiar with the action, but AI suggested:
# Use docker/metadata-action to extract version metadata and generate tags
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: yourdockerhubusername/yourimage
tags: |
type=semver,pattern={{major}}.{{minor}}.{{patch}},default=true
type=semver,pattern=latest,default=true,when=!pre
type=semver,pattern=v{{ major }},when=!pre
type=semver,pattern=v{{ major }}.{{ minor }},when=!pre
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, let me look at docker/metadata-action.
|
This bit me again today. @SuperQ are you still able to look at |
|
Hi, this came up in the Prometheus bug-scrub; @dpw13 are you able to pick this up, maybe make a new PR? |
I will try to dedicate some time to this this week! I'll open a separate PR once I have an idea what needs to happen. |
Check the current tag against the list of all tags to make sure that it is the actual latest tag before attempting to publish the container
latesttag. This avoids updating thelatesttag when pushing bug fixes to older release branchs.Fixes: prometheus/prometheus#16238