Skip to content

Commit 57417d5

Browse files
committed
fix: restore multi-platform builds for feature branches
Previously, Phase 1 optimization restricted feature branch pushes to linux/amd64 only for faster builds. This unintentionally prevented arm64 images from being published to Docker Hub. Changes: - Feature branches now build for both linux/amd64 and linux/arm64 - PRs remain single-platform (amd64) for fast feedback - Only PRs create artifacts (multi-platform manifests can't be loaded locally) - Updated comments to reflect new platform behavior Result: feature/beta-release will now publish both amd64 and arm64 images to Docker Hub on every push. Closes: User report - arm64 missing from Docker Hub
1 parent 6219d7a commit 57417d5

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

.github/workflows/docker-build.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ jobs:
204204
io.charon.feature.branch=${{ steps.branch-tags.outputs.feature_branch_tag }}
205205
# Phase 1 Optimization: Build once, test many
206206
# - For PRs: Single-platform (amd64) + immutable tags (pr-{number}-{short-sha})
207-
# - For feature branches: Single-platform + sanitized tags ({branch}-{short-sha})
207+
# - For feature branches: Multi-platform (amd64, arm64) + sanitized tags ({branch}-{short-sha})
208208
# - For main/dev: Multi-platform (amd64, arm64) for production
209209
# - Always push to registry (enables downstream workflow consumption)
210210
# - Retry logic handles transient registry failures (3 attempts, 10s wait)
@@ -223,7 +223,7 @@ jobs:
223223
set -euo pipefail
224224
225225
echo "🔨 Building Docker image with retry logic..."
226-
echo "Platform: ${{ (env.TRIGGER_EVENT == 'pull_request' || steps.skip.outputs.is_feature_push == 'true') && 'linux/amd64' || 'linux/amd64,linux/arm64' }}"
226+
echo "Platform: ${{ env.TRIGGER_EVENT == 'pull_request' && 'linux/amd64' || 'linux/amd64,linux/arm64' }}"
227227
228228
# Build tag arguments array from metadata output (properly quoted)
229229
TAG_ARGS_ARRAY=()
@@ -240,7 +240,7 @@ jobs:
240240
# Build the complete command as an array (handles spaces in label values correctly)
241241
BUILD_CMD=(
242242
docker buildx build
243-
--platform "${{ (env.TRIGGER_EVENT == 'pull_request' || steps.skip.outputs.is_feature_push == 'true') && 'linux/amd64' || 'linux/amd64,linux/arm64' }}"
243+
--platform "${{ env.TRIGGER_EVENT == 'pull_request' && 'linux/amd64' || 'linux/amd64,linux/arm64' }}"
244244
--push
245245
"${TAG_ARGS_ARRAY[@]}"
246246
"${LABEL_ARGS_ARRAY[@]}"
@@ -263,9 +263,10 @@ jobs:
263263
echo "digest=${DIGEST}" >> $GITHUB_OUTPUT
264264
echo "✅ Build complete. Digest: ${DIGEST}"
265265
266-
# For PRs and feature branches, pull the image back locally for artifact creation
266+
# For PRs only, pull the image back locally for artifact creation
267+
# Feature branches now build multi-platform and cannot be loaded locally
267268
# This enables backward compatibility with workflows that use artifacts
268-
if [[ "${{ env.TRIGGER_EVENT }}" == "pull_request" ]] || [[ "${{ steps.skip.outputs.is_feature_push }}" == "true" ]]; then
269+
if [[ "${{ env.TRIGGER_EVENT }}" == "pull_request" ]]; then
269270
echo "📥 Pulling image back for artifact creation..."
270271
FIRST_TAG=$(echo "${{ steps.meta.outputs.tags }}" | head -n1)
271272
docker pull "${FIRST_TAG}"
@@ -288,7 +289,7 @@ jobs:
288289
# 2. Image doesn't exist locally after build
289290
# 3. Artifact creation fails
290291
- name: Save Docker Image as Artifact
291-
if: success() && steps.skip.outputs.skip_build != 'true' && (env.TRIGGER_EVENT == 'pull_request' || steps.skip.outputs.is_feature_push == 'true')
292+
if: success() && steps.skip.outputs.skip_build != 'true' && env.TRIGGER_EVENT == 'pull_request'
292293
run: |
293294
# Extract the first tag from metadata action (PR tag)
294295
IMAGE_TAG=$(echo "${{ steps.meta.outputs.tags }}" | head -n 1)
@@ -319,7 +320,7 @@ jobs:
319320
ls -lh /tmp/charon-pr-image.tar
320321
321322
- name: Upload Image Artifact
322-
if: success() && steps.skip.outputs.skip_build != 'true' && (env.TRIGGER_EVENT == 'pull_request' || steps.skip.outputs.is_feature_push == 'true')
323+
if: success() && steps.skip.outputs.skip_build != 'true' && env.TRIGGER_EVENT == 'pull_request'
323324
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
324325
with:
325326
name: ${{ env.TRIGGER_EVENT == 'pull_request' && format('pr-image-{0}', env.TRIGGER_PR_NUMBER) || 'push-image' }}

0 commit comments

Comments
 (0)