fix: delete existing manifest before push (Gitea #31964 workaround)
CI / validate (pull_request) Failing after 50s
CI / auto-merge (pull_request) Skipped

Gitea 1.27 fails with HTTP 500 when pushing a tag that already exists.
Add delete_remote_manifest() to delete the existing manifest via the
Docker registry v2 API before each push.

Implements: REQ-1, REQ-2, REQ-3, REQ-4, REQ-5

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
emil
2026-08-25 19:22:01 +02:00
co-authored by Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent 92a14c8e68
commit 84fc223327
3 changed files with 250 additions and 7 deletions
+38
View File
@@ -0,0 +1,38 @@
# DEVX-158: Fix build-images workflow: delete existing manifest before push
## Problem
Gitea 1.27 has a known bug (#31964) where pushing a Docker image tag that
already exists in the container registry fails with HTTP 500 "package version
already exists". The build-images workflow has been failing for weeks because
every push to `ci-base:latest`, `ci-quality:latest`, and `ci-full:latest`
hits this error.
## Approach
Add a `delete_remote_manifest` function that deletes the existing manifest
via the Docker registry v2 API before pushing. This works around the Gitea
bug by ensuring the tag doesn't exist when the push starts.
REQ-1: Add `delete_remote_manifest` function using Docker registry v2 API
REQ-2: Call `delete_remote_manifest` before each `docker push` in `push_image`
REQ-3: Pass registry credentials from `main` to `push_image`
REQ-4: Handle errors gracefully — never block the push if delete fails
REQ-5: 100% test coverage for new code
## Test Plan
- Unit tests for `delete_remote_manifest` (success, 404, 500, network error)
- Unit tests for `push_image` with and without credentials
- Verify existing tests still pass
## Deploy Plan
- Merge to master, auto-release new devx version
- The build-images workflow will use the new code on the next run
## Rollback Plan
- Revert the merge commit
## Acceptance Criteria
- [x] REQ-1: `delete_remote_manifest` function added
- [x] REQ-2: Called before each push in `push_image`
- [x] REQ-3: Credentials passed from `main` to `push_image`
- [x] REQ-4: Errors don't block the push (returns True on failure)
- [x] REQ-5: 100% test coverage