Skip to content

Commit a2dd2f3

Browse files
committed
add codebuild integration to build workflow
Signed-off-by: Arjun Raja Yogidas <[email protected]>
1 parent 7025601 commit a2dd2f3

File tree

1 file changed

+50
-6
lines changed

1 file changed

+50
-6
lines changed

Diff for: .github/workflows/build.yml

+50-6
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,75 @@ on:
2020
- 'scripts/**'
2121

2222
env:
23-
GO_VERSION: '1.21.12'
23+
GO_VERSION: '1.21.10'
2424

2525
jobs:
26+
setup:
27+
# This job sets up the runners to be used in the matrix for the build workflow.
28+
# It provides a list of available runners with stable, human-friendly names and a mapping
29+
# from those names to the actual `runs-on` value for each runner type. This allows us to
30+
# use codebuild-hosted runners for awslabs/soci-snapshotter without requiring forks to also
31+
# have codebuild-hosted runners.
32+
#
33+
# If you want to use codebuild runners for your personal fork, follow the instructions to set
34+
# up a codebuild project. https://docs.aws.amazon.com/codebuild/latest/userguide/action-runner.html
35+
# Then, replace 'soci-snapshotter-instance' with the name of the project you created.
36+
name: Setup Build Matrix
37+
runs-on: ubuntu-latest
38+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'awslabs/soci-snapshotter'
39+
strategy:
40+
matrix:
41+
# We're using a matrix with a single entry so that we can define some config as YAML rather than
42+
# having to write escaped json in a string.
43+
include:
44+
- use-codebuild: ${{ github.repository_owner == 'awslabs' }}
45+
runs-on-names-cb: [ubuntu-x86, al2-arm]
46+
runs-on-names: [ubuntu]
47+
runner-labels:
48+
ubuntu: ubuntu-22.04
49+
ubuntu-x86: "codebuild-soci-snapshotter-instance-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-xlarge"
50+
al2-arm: "codebuild-soci-snapshotter-instance-${{ github.run_id }}-${{ github.run_attempt }}-arm-3.0-large"
51+
outputs:
52+
available-runners: ${{ matrix.use-codebuild && toJSON(matrix.runs-on-names-cb) || toJSON(matrix.runs-on-names) }}
53+
runner-labels: ${{ toJSON(matrix.runner-labels) }}
54+
steps:
55+
- name: Dump Config
56+
run: echo '${{ toJSON(matrix) }}'
57+
2658
test:
27-
runs-on: ubuntu-20.04
59+
needs: setup
60+
runs-on: ${{ fromJSON(needs.setup.outputs.runner-labels)[matrix.os] }}
61+
strategy:
62+
matrix:
63+
os: ${{ fromJSON(needs.setup.outputs.available-runners) }}
2864
timeout-minutes: 15
2965
steps:
3066
- uses: actions/checkout@v4
3167
- uses: actions/setup-go@v5
3268
with:
3369
go-version: ${{ env.GO_VERSION }}
70+
- name: Install zlib static on AL2 ARM instances
71+
if: matrix.os == 'al2-arm'
72+
run: dnf install zlib-static.aarch64 -y
3473
- run: make
3574
- run: make test
75+
3676
integration:
37-
runs-on: ubuntu-20.04
77+
needs: setup
78+
runs-on: ${{ fromJSON(needs.setup.outputs.runner-labels)[matrix.os] }}
3879
timeout-minutes: 40
3980
strategy:
40-
fail-fast: false
4181
matrix:
42-
containerd: ["1.6.33", "1.7.18", "2.0.0-rc.3"]
82+
os: ${{ fromJSON(needs.setup.outputs.available-runners) }}
83+
containerd: ["1.6.30", "1.7.14"]
4384
env:
4485
DOCKER_BUILD_ARGS: "CONTAINERD_VERSION=${{ matrix.containerd }}"
4586
steps:
4687
- uses: actions/checkout@v4
4788
- uses: actions/setup-go@v5
4889
with:
4990
go-version: ${{ env.GO_VERSION }}
50-
- run: make integration
91+
- name: Install zlib static on AL2 ARM instances
92+
if: matrix.os == 'al2-arm'
93+
run: dnf install zlib-static.aarch64 -y
94+
- run: make integration

0 commit comments

Comments
 (0)