Skip to content
This repository was archived by the owner on Nov 14, 2025. It is now read-only.

Commit 08ef441

Browse files
sapientpantsclaude
andauthored
fix: use oci-layout scheme for Docker multi-platform push (#318)
* fix: add retry logic to artifact search to handle race conditions Added exponential backoff retry logic to the determine-artifact.sh script to handle race conditions where the Publish workflow starts before GitHub's API has indexed the completed Main workflow run. Changes: - Retry up to 5 times with increasing delays (5s, 10s, 15s, 20s, 25s) - Total retry window of ~75 seconds - Clear logging of retry attempts This fixes the issue where releases fail because: 1. Main workflow creates GitHub release 2. Release event triggers Publish workflow immediately 3. Publish workflow queries for Main workflow run 4. GitHub API hasn't yet indexed the just-completed workflow 5. Query returns empty results even though workflow succeeded 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: use oci-layout scheme for Docker multi-platform push - Extract OCI layout from tar archive - Use docker buildx imagetools create with oci-layout:// scheme - Properly handles multi-platform manifest lists - Fixes "unknown flag: --tag" error from buildx imagetools import 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 27488eb commit 08ef441

File tree

3 files changed

+32
-8
lines changed

3 files changed

+32
-8
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'sonarqube-mcp-server': patch
3+
---
4+
5+
Fix race condition in artifact determination script
6+
7+
- Add retry logic with exponential backoff to determine-artifact.sh
8+
- Wait up to 5 attempts with increasing delays (5s, 10s, 15s, 20s, 25s)
9+
- Fixes race condition where Publish workflow starts before Main workflow is indexed by GitHub API
10+
- Total retry window: ~75 seconds, giving GitHub's API time to index completed workflow runs
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'sonarqube-mcp-server': patch
3+
---
4+
5+
Fix Docker Hub publishing for multi-platform OCI images
6+
7+
- Extract OCI layout from tar archive
8+
- Use `docker buildx imagetools create` with `oci-layout://` scheme
9+
- Properly handles multi-platform manifest lists for linux/amd64 and linux/arm64
10+
- Fixes "unknown flag: --tag" error from incorrect buildx imagetools import syntax

.github/workflows/publish.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -358,32 +358,36 @@ jobs:
358358
password: ${{ secrets.DOCKERHUB_TOKEN }}
359359

360360
- name: Push Docker image
361-
# Push the pre-built OCI image directly to Docker Hub using buildx imagetools
361+
# Push the pre-built OCI multi-platform image to Docker Hub
362362
if: steps.check-docker.outputs.has_credentials == 'true'
363363
run: |
364-
echo "📥 Decompressing Docker image..."
364+
echo "📥 Decompressing and extracting OCI image..."
365365
gunzip ./docker-artifact/${{ steps.artifact.outputs.artifact_name }}.tar.gz
366366
367+
# Extract OCI layout from tar
368+
mkdir -p oci-layout
369+
tar -xf ./docker-artifact/${{ steps.artifact.outputs.artifact_name }}.tar -C oci-layout
370+
367371
TARGET_REPO="${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}"
368372
VERSION="${{ steps.version.outputs.version }}"
369373
370-
echo "📤 Importing and pushing OCI image to Docker Hub..."
371-
# Use docker buildx imagetools to import from OCI archive and push to Docker Hub
374+
echo "📤 Pushing multi-platform OCI image to Docker Hub..."
375+
# Use docker buildx imagetools create to push from OCI layout
372376
# This properly handles multi-platform manifest lists
373-
docker buildx imagetools import \
377+
docker buildx imagetools create \
374378
--tag $TARGET_REPO:$VERSION \
375-
./docker-artifact/${{ steps.artifact.outputs.artifact_name }}.tar
379+
oci-layout://oci-layout
376380
377381
echo "🏷️ Creating additional tags..."
378-
# Also add latest, major, and major.minor tags by creating aliases
382+
# Create alias tags for latest, major, and major.minor versions
379383
MAJOR=$(echo "$VERSION" | cut -d. -f1)
380384
MINOR=$(echo "$VERSION" | cut -d. -f2)
381385
382386
docker buildx imagetools create --tag $TARGET_REPO:latest $TARGET_REPO:$VERSION
383387
docker buildx imagetools create --tag $TARGET_REPO:$MAJOR $TARGET_REPO:$VERSION
384388
docker buildx imagetools create --tag $TARGET_REPO:$MAJOR.$MINOR $TARGET_REPO:$VERSION
385389
386-
echo "✅ Docker image published successfully"
390+
echo "✅ Docker image published successfully to Docker Hub"
387391
388392
# =============================================================================
389393
# NOTIFICATION

0 commit comments

Comments
 (0)