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

Commit d8a2789

Browse files
authored
Test build the CodeGate image for arm64 too (#1048)
1 parent bc2d7a3 commit d8a2789

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

.github/workflows/image-build.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
description: 'The name of the artifact to upload'
99
required: true
1010
type: string
11+
platform:
12+
description: 'The platform to build the image for'
13+
required: true
14+
type: string
1115

1216
permissions:
1317
contents: read
@@ -22,6 +26,10 @@ jobs:
2226
steps:
2327
- name: Checkout
2428
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
29+
- name: Set up QEMU for cross-platform builds
30+
# Only set up QEMU if the platform is not linux/amd64
31+
if: ${{ inputs.platform != 'linux/amd64' }}
32+
uses: docker/setup-qemu-action@4574d27a4764455b42196d70a065bc6853246a25 # v3
2533
- name: Set up Docker Buildx
2634
uses: docker/setup-buildx-action@f7ce87c1d6bead3e36075b2ce75da1f6cc28aaca # v3
2735
- name: Download artifact
@@ -43,13 +51,13 @@ jobs:
4351
run: |
4452
git lfs install
4553
git lfs pull
46-
- name: Test build on x86
54+
- name: Test build - ${{ inputs.platform }}
4755
id: docker_build
4856
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v5
4957
with:
5058
context: .
5159
file: ./Dockerfile
52-
platforms: linux/amd64
60+
platforms: ${{ inputs.platform }}
5361
push: false # Only attempt to build, to verify the Dockerfile is working
5462
load: true
5563
cache-from: type=gha
@@ -58,12 +66,16 @@ jobs:
5866
LATEST_RELEASE=${{ env.LATEST_RELEASE }}
5967
tags: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
6068
- name: Save Docker image as a tarball
69+
# Only save the image if the build was for linux/amd64, as we only need it for the integration tests
70+
if: ${{ inputs.platform == 'linux/amd64' }}
6171
run: |
6272
# List all images
6373
docker images
6474
# Save the image as a tarball
6575
docker save -o image.tar ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
6676
- name: Upload Docker image artifact
77+
# Only upload the image if the build was for linux/amd64, as we only need it for the integration tests
78+
if: ${{ inputs.platform == 'linux/amd64' }}
6779
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
6880
with:
6981
name: ${{ inputs.artifact-name }}

.github/workflows/run-on-pr.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,17 @@ jobs:
1414
name: Build, Test & Lint
1515
uses: ./.github/workflows/ci.yml
1616
image-build:
17-
name: OCI Image - Build
17+
name: OCI Image - Build x86
1818
uses: ./.github/workflows/image-build.yml
1919
with:
2020
artifact-name: "codegate-image"
21+
platform: "linux/amd64"
22+
image-build-arm64:
23+
name: OCI Image - Build ARM64
24+
uses: ./.github/workflows/image-build.yml
25+
with:
26+
artifact-name: "codegate-image"
27+
platform: "linux/arm64"
2128
integration-tests:
2229
if: github.event.pull_request.head.repo.full_name == 'stacklok/codegate'
2330
name: Integration Tests

.github/workflows/run-on-push.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,17 @@ jobs:
1414
name: Build, Test & Lint
1515
uses: ./.github/workflows/ci.yml
1616
image-build:
17-
name: OCI Image - Build
17+
name: OCI Image - Build x86
1818
uses: ./.github/workflows/image-build.yml
1919
with:
2020
artifact-name: "codegate-image"
21+
platform: "linux/amd64"
22+
image-build-arm64:
23+
name: OCI Image - Build ARM64
24+
uses: ./.github/workflows/image-build.yml
25+
with:
26+
artifact-name: "codegate-image"
27+
platform: "linux/arm64"
2128
integration-tests:
2229
name: Integration Tests
2330
needs: [ci, image-build] # We need the image available in order to run the integration tests

0 commit comments

Comments
 (0)