Automate image versioning #337

Closed
opened 2026-01-12 14:33:47 +00:00 by lenkaseg · 4 comments
Member

For now, the image build workflow is following:
push to a branch (forge-staging, forge-production, src-staging, src-production) => generates an empty commit to oci-image-definition repo, which now does not serve for much because => the version must be manually increased on oci-image-definition repo => push to oci-image-definition triggers image build (isolated only to the pipeline defined in the on-cel-expression)

The desired automated workflow would be:
push to one of the branches we build the image from => this triggers an action that does the following steps and the result is a fresh and tagged image on quay without any manual action:

The action:

  1. Gets the current forgejo upstream tag
    I'd suggest taking the forgejo version from a tag that forgejo upstream is using: git describe --tags --abbrev=0, which as an example now equals to v13.0.4 or git describe --tags which in current state of things gives v13.0.4-17-ge1a1ab4ddf (latest upstream version - number of our commits on top - git hash of the last upstream tagged commit).

  2. Modifies to our versioning
    Currently the versioning we use is for example 13.0.4-1 (forgejo upstream version - our version of it. Goes up to 13.0.4-2 and more until there is new minor release, from which we start the count from 1 again: 13.0.5-1)
    I see three options:

    2.1. We could keep it as it is, but automate it. That means make a script that gets the latest forgejo upstream version and bumps the second number +1. If the minor version increased, start from 1. This is possible, but I find it a bit cumbersome.
    2.2. We could change it to 13.0.4-5cc0f00ae3 (latest forgejo upstream - our last git commit sha). We would know immediately from which exact commit each of the builds is.
    2.3. We could use the v13.0.4-17-ge1a1ab4ddf format, the direct result of git describe --tags. The simplest option, no additional script needed, and we know exactly the latest forgejo version, latest forgejo upstream commit + the number of our commits on top. My personal favorite solution.

  3. Modifies the VERSION file in the oci-image-definition repo with that version and pushes it to oci-image-definition

  4. This starts a build of the respective image(s)

For now, the image build workflow is following: push to a branch (forge-staging, forge-production, src-staging, src-production) => generates an empty commit to oci-image-definition repo, which now does not serve for much because => the version must be manually increased on oci-image-definition repo => push to oci-image-definition triggers image build (isolated only to the pipeline defined in the [on-cel-expression](https://codeberg.org/fedora/oci-image-definitions/src/branch/main/.tekton/forgejo-oci-images-prod-stable-push.yaml#L10)) The desired automated workflow would be: push to one of the branches we build the image from => this triggers **an action** that does the following steps and the result is a fresh and tagged image on quay without any manual action: **The action**: 1. **Gets the current forgejo upstream tag** I'd suggest taking the forgejo version from a tag that forgejo upstream is using: `git describe --tags --abbrev=0`, which as an example now equals to `v13.0.4` or `git describe --tags` which in current state of things gives `v13.0.4-17-ge1a1ab4ddf` (latest upstream version - number of our commits on top - git hash of the last upstream tagged commit). 2. **Modifies to our versioning** Currently the versioning we use is for example **13.0.4-1** (forgejo upstream version - our version of it. Goes up to 13.0.4-2 and more until there is new minor release, from which we start the count from 1 again: 13.0.5-1) I see three options: 2.1. We could keep it as it is, but automate it. That means make a script that gets the latest forgejo upstream version and bumps the second number +1. If the minor version increased, start from 1. This is possible, but I find it a bit cumbersome. 2.2. We could change it to **13.0.4-5cc0f00ae3** (latest forgejo upstream - our last git commit sha). We would know immediately from which exact commit each of the builds is. 2.3. We could use the **v13.0.4-17-ge1a1ab4ddf** format, the direct result of `git describe --tags`. The simplest option, no additional script needed, and we know exactly the latest forgejo version, latest forgejo upstream commit + the number of our commits on top. My personal favorite solution. 3. **Modifies the VERSION file in the oci-image-definition repo with that version and pushes it to oci-image-definition** 4. This **starts a build** of the respective image(s)
lenkaseg added this to the Backlog project 2026-01-12 14:34:33 +00:00
Author
Member

After discussion on a team standup, it was decided to go with the option 2.2: forgejo upstream tag-our branch last commit

After discussion on a team standup, it was decided to go with the option 2.2: `forgejo upstream tag`-`our branch last commit`
lenkaseg modified the project from Backlog to Sprint 13 2026-01-26 10:20:25 +00:00
Author
Member
Related PR here: https://codeberg.org/fedora/forgejo/pulls/82
Author
Member

Tagging now looks like this:
quay.io/konflux-fedora/fedora-infra-tenant/forgejo-oci-images-src-staging-stable:vv14.0.2-3dcf904db1

Two things:

  1. fix the second 'v' in the forgejo upstream version
  2. in case we make another build from the same fedora/forgejo commit, but different oci-image-definition commit, the tag should reflect that. For that I see two options:

Option 1: follow "rpm packing style" adding a +1 number: v14.0.2-3dcf904db1-1, v14.0.2-3dcf904db1-2, ... Maybe cleaner, but might be difficult to see which commit the -1, -2 are build from.
Option 2: v14.0.2-3dcf904db1-2f146b5f9a, which is forgejo_upstream_tag - fedora/forgejo_last_git_sha - fedora/oci-image-definition_last_git_sha. Advantage: we know which commits exactly the image is built from. Disadvantage - might be a bit less esthetic?

Tagging now looks like this: `quay.io/konflux-fedora/fedora-infra-tenant/forgejo-oci-images-src-staging-stable:vv14.0.2-3dcf904db1` Two things: 1. fix the second 'v' in the forgejo upstream version 2. in case we make another build from the same fedora/forgejo commit, but different oci-image-definition commit, the tag should reflect that. For that I see two options: Option 1: follow "rpm packing style" adding a +1 number: v14.0.2-3dcf904db1-1, v14.0.2-3dcf904db1-2, ... Maybe cleaner, but might be difficult to see which commit the -1, -2 are build from. Option 2: v14.0.2-3dcf904db1-2f146b5f9a, which is forgejo_upstream_tag - fedora/forgejo_last_git_sha - fedora/oci-image-definition_last_git_sha. Advantage: we know which commits exactly the image is built from. Disadvantage - might be a bit less esthetic?
Author
Member

Example of a new image tag: quay.io/konflux-fedora/fedora-infra-tenant/forgejo-oci-images-src-staging-stable:v14.0.2-1de02-210cb

'v14.0.2-1de02-210cb' => latest forgejo upstream tag - fedora/forgejo last commit git sha (depends on branch, 5 char) - oci-image-definition last commit git sha (5char).

Example of a new image tag: quay.io/konflux-fedora/fedora-infra-tenant/forgejo-oci-images-src-staging-stable:v14.0.2-1de02-210cb 'v14.0.2-1de02-210cb' => latest forgejo upstream tag - [fedora/forgejo last commit git sha](https://codeberg.org/fedora/forgejo/commits/branch/main) (depends on branch, 5 char) - [oci-image-definition last commit git sha](https://github.com/fedora-infra/forgejo-oci-images/commits/main/) (5char).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forge/forge#337
No description provided.