Skip to content

Commit 925f6c8

Browse files
committed
Split the image build so we don't block the integration tests
Signed-off-by: Radoslav Dimitrov <[email protected]>
1 parent 2cc1f16 commit 925f6c8

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

.github/workflows/image-build.yml

Lines changed: 9 additions & 3 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
@@ -45,21 +49,23 @@ jobs:
4549
run: |
4650
git lfs install
4751
git lfs pull
48-
- name: Test build on arm64 and amd64
52+
- name: Test build - ${{ inputs.platform }}
4953
id: docker_build
5054
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v5
5155
with:
5256
context: .
5357
file: ./Dockerfile
54-
platforms: linux/amd64,linux/arm64
58+
platforms: ${{ inputs.platform }}
5559
push: false # Only attempt to build, to verify the Dockerfile is working
56-
# load: true
60+
load: true
5761
cache-from: type=gha
5862
cache-to: type=gha,mode=max
5963
build-args: |
6064
LATEST_RELEASE=${{ env.LATEST_RELEASE }}
6165
tags: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
6266
- name: Save Docker image as a tarball
67+
# Only save the image if the build was for linux/amd64, as we only need it for the integration tests
68+
if: ${{ inputs.platform == 'linux/amd64' }}
6369
run: |
6470
# List all images
6571
docker images

.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)