[v14.0/forgejo] fix: cleanup of multi-platform container images #11254

Merged
mfenniak merged 1 commit from bp-v14.0/forgejo-9ea9582 into v14.0/forgejo 2026-02-23 18:49:28 +01:00

Backport: #11246

This change fixes an issue that makes Forgejo clean up too many versions of a container package even though it should keep them according to the rules set for the package.

The issue affects multi-platform container images.
Forgejo adds a package version for each platform (for example linux/amd64, linux/arm64) in addition to the actual tag (for example 0.6.0 or latest).

This results in rows in the table package_version similar to this (unimportant columns omitted for brevity):

lower_version created_unix
latest 1768742887
0.6.0 1768742886
sha256:038e... 1768742886
sha256:fc38... 1768742886
0.5.0 1768742864
sha256:806d... 1768742864
sha256:0a19... 1768742864
0.4.0 1768742848
... ...

The code assumes that the first <keep count> entries can be ignored and considers every entry after <keep count> as eligible for cleanup.
That doesn't work for multi-platform container images because, for <keep count>=5, it considers version 0.4.0 as eligible.

Checklist

The contributor guide contains information that will be helpful to first time contributors. There also are a few conditions for merging Pull Requests in Forgejo repositories. You are also welcome to join the Forgejo development chatroom.

Tests

  • I added test coverage for Go changes...
    • in their respective *_test.go for unit tests.
    • in the tests/integration directory if it involves interactions with a live Forgejo server.
  • I added test coverage for JavaScript changes...

Documentation

  • I created a pull request to the documentation to explain to Forgejo users how to use this change.
  • I did not document these changes and I do not expect someone else to do it.

Release notes

  • This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change.
  • This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change.

The decision if the pull request will be shown in the release notes is up to the mergers / release team.

The content of the release-notes/<pull request number>.md file will serve as the basis for the release notes. If the file does not exist, the title of the pull request will be used instead.

Release notes

  • Bug fixes
    • PR: cleanup of multi-platform container images
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/11246 This change fixes an issue that makes Forgejo clean up too many versions of a container package even though it should keep them according to the rules set for the package. The issue affects multi-platform container images. Forgejo adds a package version for each platform (for example `linux/amd64`, `linux/arm64`) in addition to the actual tag (for example `0.6.0` or `latest`). This results in rows in the table `package_version` similar to this (unimportant columns omitted for brevity): | **lower_version** | **created_unix** | |---|---| | `latest` | `1768742887`| | `0.6.0` | `1768742886` | | `sha256:038e...` | `1768742886` | | `sha256:fc38...` | `1768742886` | | `0.5.0` | `1768742864` | | `sha256:806d...` | `1768742864` | | `sha256:0a19...` | `1768742864` | | `0.4.0` | `1768742848` | | `...` | `...` | The code assumes that the first `<keep count>` entries can be ignored and considers every entry after `<keep count>` as eligible for cleanup. That doesn't work for multi-platform container images because, for `<keep count>=5`, it considers version `0.4.0` as eligible. ## Checklist The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org). ### Tests - I added test coverage for Go changes... - [x] in their respective `*_test.go` for unit tests. - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server. - I added test coverage for JavaScript changes... - [ ] in `web_src/js/*.test.js` if it can be unit tested. - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)). ### Documentation - [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change. - [x] I did not document these changes and I do not expect someone else to do it. ### Release notes - [x] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change. - [ ] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change. *The decision if the pull request will be shown in the release notes is up to the mergers / release team.* The content of the `release-notes/<pull request number>.md` file will serve as the basis for the release notes. If the file does not exist, the title of the pull request will be used instead. <!--start release-notes-assistant--> ## Release notes <!--URL:https://codeberg.org/forgejo/forgejo--> - Bug fixes - [PR](https://codeberg.org/forgejo/forgejo/pulls/11246): <!--number 11246 --><!--line 0 --><!--description Y2xlYW51cCBvZiBtdWx0aS1wbGF0Zm9ybSBjb250YWluZXIgaW1hZ2Vz-->cleanup of multi-platform container images<!--description--> <!--end release-notes-assistant-->
mfenniak approved these changes 2026-02-23 04:10:15 +01:00
mfenniak force-pushed bp-v14.0/forgejo-9ea9582 from aa0dd328b5
Some checks failed
testing / frontend-checks (pull_request) Successful in 1m38s
testing / backend-checks (pull_request) Successful in 3m37s
testing / test-e2e (pull_request) Successful in 24m51s
testing / test-mysql (pull_request) Successful in 26m15s
testing / test-pgsql (pull_request) Successful in 35m59s
issue-labels / cascade (pull_request_target) Has been skipped
issue-labels / release-notes (pull_request_target) Has been skipped
issue-labels / backporting (pull_request_target) Has been skipped
requirements / merge-conditions (pull_request) Successful in 3s
testing / test-unit (pull_request) Successful in 5m12s
testing / test-remote-cacher (redis) (pull_request) Successful in 1m22s
testing / test-remote-cacher (redict) (pull_request) Successful in 1m47s
testing / test-remote-cacher (garnet) (pull_request) Successful in 1m47s
testing / test-remote-cacher (valkey) (pull_request) Successful in 1m48s
testing / test-sqlite (pull_request) Successful in 27m18s
testing / security-check (pull_request) Failing after 1m11s
to d806b4b076
All checks were successful
issue-labels / release-notes (pull_request_target) Has been skipped
requirements / merge-conditions (pull_request) Successful in 2s
testing / frontend-checks (pull_request) Successful in 50s
testing / backend-checks (pull_request) Successful in 2m32s
testing / test-unit (pull_request) Successful in 6m38s
testing / test-remote-cacher (redict) (pull_request) Successful in 2m26s
testing / test-remote-cacher (valkey) (pull_request) Successful in 2m27s
testing / test-remote-cacher (redis) (pull_request) Successful in 2m27s
testing / test-remote-cacher (garnet) (pull_request) Successful in 2m28s
testing / test-e2e (pull_request) Successful in 19m12s
testing / test-mysql (pull_request) Successful in 21m42s
testing / test-sqlite (pull_request) Successful in 26m48s
testing / test-pgsql (pull_request) Successful in 32m28s
testing / security-check (pull_request) Successful in 59s
issue-labels / backporting (pull_request_target) Has been skipped
milestone / set (pull_request_target) Successful in 4s
2026-02-23 17:22:37 +01:00
Compare
mfenniak merged commit dbdbd0f5e6 into v14.0/forgejo 2026-02-23 18:49:28 +01:00
mfenniak deleted branch bp-v14.0/forgejo-9ea9582 2026-02-23 18:49:30 +01:00
Sign in to join this conversation.
No reviewers
No labels
arch
riscv64
backport/v1.19
backport/v1.20
backport/v1.21/forgejo
backport/v10.0/forgejo
backport/v11.0/forgejo
backport/v12.0/forgejo
backport/v13.0/forgejo
backport/v14.0/forgejo
backport/v15.0/forgejo
backport/v7.0/forgejo
backport/v8.0/forgejo
backport/v9.0/forgejo
breaking
bug
bug
confirmed
bug
duplicate
bug
needs-more-info
bug
new-report
bug
reported-upstream
code/actions
code/api
code/auth
code/auth/faidp
code/auth/farp
code/email
code/federation
code/git
code/migrations
code/packages
code/wiki
database
MySQL
database
PostgreSQL
database
SQLite
dependency-upgrade
dependency
Chi
dependency
Chroma
dependency
F3
dependency
ForgeFed
dependency
garage
dependency
Gitea
dependency
Golang
Discussion
duplicate
enhancement/feature
forgejo/accessibility
forgejo/branding
forgejo/ci
forgejo/commit-graph
forgejo/documentation
forgejo/furnace cleanup
forgejo/i18n
forgejo/interop
forgejo/moderation
forgejo/privacy
forgejo/release
forgejo/scaling
forgejo/security
forgejo/ui
Gain
High
Gain
Nice to have
Gain
Undefined
Gain
Very High
good first issue
i18n/backport-stable
impact
large
impact
medium
impact
small
impact
unknown
Incompatible license
issue
closed
issue
do-not-exist-yet
issue
open
manual test
Manually tested during feature freeze
OS
FreeBSD
OS
Linux
OS
macOS
OS
Windows
problem
QA
regression
release blocker
Release Cycle
Feature Freeze
release-blocker
v7.0
release-blocker
v7.0.1
release-blocker
v7.0.2
release-blocker
v7.0.3
release-blocker
v7.0.4
release-blocker
v8.0.0
release-blocker/v9.0.0
run-all-playwright-tests
run-end-to-end-tests
stage
2-research
stage
3-design
stage
4-implementation
test
manual
test
needed
test
needs-help
test
not-needed
test
present
untested
User research - time-tracker
valuable code
worth a release-note
User research - Accessibility
User research - Blocked
User research - Community
User research - Config (instance)
User research - Errors
User research - Filters
User research - Future backlog
User research - Git workflow
User research - Labels
User research - Moderation
User research - Needs input
User research - Notifications/Dashboard
User research - Rendering
User research - Repo creation
User research - Repo units
User research - Security
User research - Settings (in-app)
No milestone
No project
No assignees
2 participants
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
forgejo/forgejo!11254
No description provided.