Skip to content

Conversation

vyavdoshenko
Copy link
Contributor

fixed: #4831

@vyavdoshenko vyavdoshenko marked this pull request as draft April 3, 2025 16:12
@vyavdoshenko
Copy link
Contributor Author

The change was tested with a test trigger on the push for the current branch:
https://github.com/dragonflydb/dragonfly/actions/runs/14247603833/job/39932415327
NOTE: The code from the current change was extracted for separate testing.

This solution was partially tested locally:
https://github.com/nektos/act

@vyavdoshenko vyavdoshenko marked this pull request as ready for review April 3, 2025 16:24
@vyavdoshenko vyavdoshenko changed the title [wip] fix: docker release should be updated latest version using semantic version of latest tag fix: docker release should be updated latest version using semantic version of latest tag Apr 3, 2025
if docker pull ${registry}:latest &>/dev/null; then
echo "Found latest tag, checking its version..."
# Run the container to get its version
latest_full_version=$(docker run --rm --entrypoint /bin/sh ${registry}:latest -c "dragonfly --version | cut -d' ' -f2 | head -n 1")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is unfortunate that the version is not stored in the image itself.
when running docker inspect ubuntu:latest
I see

...
            "Labels": {
                "org.opencontainers.image.ref.name": "ubuntu",
                "org.opencontainers.image.version": "24.04"
            }

meaning we could store the version using labels and then fetch the label instead of running the binary.
this can not be done now but we can specify the right label to simplify this code in the future.
this is what we specify now:

  "org.opencontainers.image.created": "2025-03-30T07:56:05.960Z",
                "org.opencontainers.image.description": "The fastest in-memory store",
                "org.opencontainers.image.licenses": "NOASSERTION",
                "org.opencontainers.image.ref.name": "ubuntu",
                "org.opencontainers.image.revision": "a87fe66d1a7654b8f2ee2b7fe27687d582230888",
                "org.opencontainers.image.source": "https://github.com/dragonflydb/dragonfly",
                "org.opencontainers.image.title": "Dragonfly Production Image",
                "org.opencontainers.image.url": "https://github.com/dragonflydb/dragonfly",
                "org.opencontainers.image.vendor": "DragonflyDB LTD",
                "org.opencontainers.image.version": "ubuntu-1.28.1-amd64"

I suggest changing org.opencontainers.image.version to be version only, i.e. 1.28.1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added processing with docker image inspect for:

  • ubuntu-1.28.1-amd64
  • 1.28.1 (as fallback)

The second chance will be:

  • dragonfly --version

Copy link
Collaborator

@romange romange Apr 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's great but you have not set the org.opencontainers.image.version label.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, I didn't get it. I investigated that the images have the org.opencontainers.image.version somehow.
I thought this was a different process to set up this property.
I added the tag version to the org.opencontainers.image.version property.

Copy link
Collaborator

@romange romange left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@romange romange requested a review from Copilot April 3, 2025 17:05
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the docker release workflow to ensure that the "latest" tag is updated using a semantic versioning check.

  • Added logic to remove a leading "v" from version strings.
  • Implemented a semantic version comparison between the new tag and the current latest tag.
  • Adjusted manifest creation and push steps based on the comparison result.
Comments suppressed due to low confidence (1)

.github/workflows/docker-release2.yml:188

  • Ensure that the 'current_version' variable always contains a valid semantic version (major.minor.patch). Consider adding a validation step to handle unexpected version string formats.
IFS='.' read -ra CURRENT_PARTS <<< "$current_version"

@vyavdoshenko vyavdoshenko requested a review from romange April 4, 2025 08:58
romange
romange previously approved these changes Apr 6, 2025
@vyavdoshenko vyavdoshenko self-assigned this Apr 6, 2025
@vyavdoshenko vyavdoshenko merged commit 3eb8417 into main Apr 6, 2025
10 checks passed
@vyavdoshenko vyavdoshenko deleted the bobik/docker_release_update_latest_tag_by_semantic_version branch April 6, 2025 11:01
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

Successfully merging this pull request may close these issues.

docker release does not update its latest version
2 participants