Skip to content

Commit 14909d7

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

File tree

1 file changed

+47
-3
lines changed

1 file changed

+47
-3
lines changed

.github/workflows/build.yml

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,72 @@ env:
2323
GO_VERSION: '1.21.12'
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+
strategy:
39+
matrix:
40+
# We're using a matrix with a single entry so that we can define some config as YAML rather than
41+
# having to write escaped json in a string.
42+
include:
43+
- use-codebuild: ${{ github.repository_owner == 'awslabs' }}
44+
runs-on-names-cb: [ubuntu-x86, al2-arm]
45+
runs-on-names-gh: [ubuntu]
46+
runner-labels:
47+
ubuntu: ubuntu-22.04
48+
ubuntu-x86: "codebuild-soci-snapshotter-instance-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-large"
49+
al2-arm: "codebuild-soci-snapshotter-instance-${{ github.run_id }}-${{ github.run_attempt }}-arm-3.0-large"
50+
outputs:
51+
available-runners: ${{ matrix.use-codebuild && toJSON(matrix.runs-on-names-cb) || toJSON(matrix.runs-on-names-gh) }}
52+
runner-labels: ${{ toJSON(matrix.runner-labels) }}
53+
steps:
54+
- name: Dump Config
55+
run: echo '${{ toJSON(matrix) }}'
56+
2657
test:
27-
runs-on: ubuntu-20.04
58+
needs: setup
59+
runs-on: ${{ fromJSON(needs.setup.outputs.runner-labels)[matrix.os] }}
60+
strategy:
61+
matrix:
62+
os: ${{ fromJSON(needs.setup.outputs.available-runners) }}
2863
timeout-minutes: 15
2964
steps:
3065
- uses: actions/checkout@v4
3166
- uses: actions/setup-go@v5
3267
with:
3368
go-version: ${{ env.GO_VERSION }}
69+
- name: Install zlib static on AL2 ARM instances
70+
if: matrix.os == 'al2-arm'
71+
run: dnf install zlib-static.aarch64 -y
3472
- run: make
3573
- run: make test
74+
3675
integration:
37-
runs-on: ubuntu-20.04
76+
needs: setup
77+
runs-on: ${{ fromJSON(needs.setup.outputs.runner-labels)[matrix.os] }}
3878
timeout-minutes: 40
3979
strategy:
4080
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.33", "1.7.18"]
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 }}
91+
- name: Install zlib static on AL2 ARM instances
92+
if: matrix.os == 'al2-arm'
93+
run: dnf install zlib-static.aarch64 -y
5094
- run: make integration

0 commit comments

Comments
 (0)