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

Use full semver for OCI annotation #33697

Closed
arifer612 opened this issue Feb 23, 2025 · 1 comment · Fixed by #33698
Closed

Use full semver for OCI annotation #33697

arifer612 opened this issue Feb 23, 2025 · 1 comment · Fixed by #33698
Labels
topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@arifer612
Copy link
Contributor

Feature Description

The Issue

The OCI annotation org.opencontainers.image.version is always 1, the major version, in all the tagged releases since v1.23.1. This is opposed to it being the full semver, e.g., 1.23.4 for the latest release, which is what one would expect.

This happens because the docker/metadata-action action in .github/workflows/release-tag-version.yml is told to generate tags in the following order:

  1. major version first,
  2. major + minor version next, and
  3. the full semver last.

According to the documentation for the action, such an order (without any priorities set), would mean that first tag generated, i.e., the major version, would be used as the value of the OCI annotation. This is indeed what we observe.

This only affects the version-tagged releases; the nightly releases are not tagged with any version number, so this issue does not exist; the rc-tagged releases only generate a single tag, so the OCI annotation is always correct.

The Feature Request/Suggestion and a Proposed Solution

I would like to suggest that the annotation reflect the full semver, instead of just the major version.

This is a very simple fix to .github/workflows/release-tag-version.yml. All that needs to be done is to either

  1. change the order of tags that the docker/metadata-action action generate, or
  2. increase the priority of the tag that corresponds to the full semver.

If my suggestion and proposed solution is agreeable, I can make the changes and do up the PR right away.

Screenshots

No response

@arifer612 arifer612 added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Feb 23, 2025
@techknowlogick
Copy link
Member

Reordering them seems reasonable, and if it would be a benefit if the labelling of the images then we'd love to have a PR to do this. Thanks for bringing this up:)

@techknowlogick techknowlogick added the topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile label Feb 23, 2025
arifer612 added a commit to arifer612/gitea that referenced this issue Feb 24, 2025
This commit fixes the docker build workflow such that semver-tagged releases use
the full semver for the OCI image.version annotation, instead of using the major
version only.

Resolves go-gitea#33697.
techknowlogick pushed a commit that referenced this issue Feb 24, 2025
)

This commit fixes the docker build workflow such that semver-tagged
releases use the full semver for the OCI
`org.opencontainers.image.version` annotation, instead of using the
major version only.

This is done by changing the order of the tags that the
`docker/metadata-action` action is told to generate. Since the tags that
the action is told to generate are all of the same priority, the first
in the list will be used to set the annotation.

There is no need to fix the other two docker build workflows, i.e., (i)
the nightly releases and (ii) the rc-tagged releases. This is because
(i) the nightly releases do not get tagged with a semver, so the issue
does not exist, and (ii) rc-tagged releases only get built with one tag,
so the issue of needing to set an order of how tags are generated is
irrelevant.

Resolves #33697.
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Feb 24, 2025
…gitea#33698)

This commit fixes the docker build workflow such that semver-tagged
releases use the full semver for the OCI
`org.opencontainers.image.version` annotation, instead of using the
major version only.

This is done by changing the order of the tags that the
`docker/metadata-action` action is told to generate. Since the tags that
the action is told to generate are all of the same priority, the first
in the list will be used to set the annotation.

There is no need to fix the other two docker build workflows, i.e., (i)
the nightly releases and (ii) the rc-tagged releases. This is because
(i) the nightly releases do not get tagged with a semver, so the issue
does not exist, and (ii) rc-tagged releases only get built with one tag,
so the issue of needing to set an order of how tags are generated is
irrelevant.

Resolves go-gitea#33697.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants