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

GH-2282 Add Docker tags for Major and Major.Minor versions #2285

Merged

Conversation

kirbylink
Copy link
Contributor

Purpose
This pull request enhances the Docker image tagging process by adding additional tags for Major and Major.Minor versions alongside the existing latest and full release version tags.

Why this change?
Using only latest or the full version (e.g., 3.5.19) for Docker tags can make managing updates more challenging, especially for users who want to restrict updates to specific major or minor versions. For example:

  • A tag like 3.5 allows users to get updates within the 3.5.x series while avoiding potential changes in version 3.6 without explicit changing the tag.
  • Similarly, a 3 tag ensures updates only within the 3.x series to avoid auto updates with breaking changes.

Adding these tags provides users with more flexibility and control over updates in their environments.

What was changed?

  • The docker job in the GitHub Actions workflow now generates the following tags for Docker images:
    • latest
    • Major.Minor (e.g., 3.5)
    • Major (e.g., 3)
    • Full release version (e.g., 3.5.19)
  • These tags are pushed to both DockerHub and GitHub Container Registry (GHCR).

How does it work?

  • A new step (Generate Docker Tags) extracts the Major and Minor parts of the version from ${{ needs.github.outputs.version }}.
  • The generated tags are passed to the docker/build-push-action, ensuring all tags are applied to the built image and pushed to the registries.

Testing
While testing was limited due to the lack of actual registry credentials, the logic for tag generation was validated independently to ensure correctness.

Fixing #2282

It might be possible to update parts of the documentation, but I wasn't sure if and where it would make sense.

Additional notes:
During my tests with GitHub workflows i saw the following warning:

The set-output command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

I also used set-output because it is already used in the workflow.

Adding new step`Generate Docker Tags` to the `Docker` pipeline to fetch
the major and minor version of the application and use it in the last
step for additional docker tags
@dzikoysk dzikoysk changed the title Feature: Add Docker tags for Major and Major.Minor versions GH-2282 Add Docker tags for Major and Major.Minor versions Nov 23, 2024
@dzikoysk
Copy link
Owner

Looks good to me, I think we can just merge it and see how it goes. In case of any errors, we can address it later in separate PRs :)

@dzikoysk dzikoysk merged commit 849c18d into dzikoysk:main Nov 23, 2024
3 checks passed
tech-6 pushed a commit to tech-6/reposilite that referenced this pull request Dec 1, 2024
…esolve dzikoysk#2282)

Adding new step`Generate Docker Tags` to the `Docker` pipeline to fetch
the major and minor version of the application and use it in the last
step for additional docker tags
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.

2 participants