From 6c30eb0f00ffa6744eba84f40fac41986a385e86 Mon Sep 17 00:00:00 2001 From: Arjun Raja Yogidas Date: Tue, 2 Jul 2024 22:23:48 +0000 Subject: [PATCH 1/3] test if codebuild filters are working Signed-off-by: Arjun --- .github/workflows/build.yml | 48 +++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 054d7f645..755eff3ed 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,11 +20,30 @@ on: - 'scripts/**' env: - GO_VERSION: '1.21.11' + GO_VERSION: '1.21.10' jobs: - test: - runs-on: ubuntu-20.04 + test-on-codebuild: + if: github.repository == 'awslabs/soci-snapshotter' + runs-on: codebuild-soci-snapshotter-build-test-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.os }} + strategy: + matrix: + os: [arm-3.0-large, ubuntu-7.0-xlarge, ubuntu-7.0-small, ubuntu-7.0-medium, ubuntu-7.0-medium] + timeout-minutes: 15 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + - run: make + - run: make test + + test-on-fork: + if: github.repository != 'awslabs/soci-snapshotter' + runs-on: codebuild-soci-snapshotter-build-test-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.os }} + strategy: + matrix: + os: [arm-3.0-large, ubuntu-7.0-xlarge] timeout-minutes: 15 steps: - uses: actions/checkout@v4 @@ -33,8 +52,27 @@ jobs: go-version: ${{ env.GO_VERSION }} - run: make - run: make test - integration: - runs-on: ubuntu-20.04 + + integration-on-codebuild: + if: github.repository == 'awslabs/soci-snapshotter' + runs-on: codebuild-soci-snapshotter-build-test-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-xlarge + timeout-minutes: 40 + strategy: + fail-fast: false + matrix: + containerd: ["1.6.30", "1.7.14"] + env: + DOCKER_BUILD_ARGS: "CONTAINERD_VERSION=${{ matrix.containerd }}" + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + - run: make integration + + integration-on-fork: + if: github.repository != 'awslabs/soci-snapshotter' + runs-on: codebuild-soci-snapshotter-build-test-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-xlarge timeout-minutes: 40 strategy: fail-fast: false From 7de207d14077cb652d995a2b69533597a703715f Mon Sep 17 00:00:00 2001 From: Arjun Raja Yogidas Date: Wed, 3 Jul 2024 21:32:47 +0000 Subject: [PATCH 2/3] test if one hook will be enough Signed-off-by: Arjun Raja Yogidas --- .github/workflows/build.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 755eff3ed..8d730856b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,10 +25,10 @@ env: jobs: test-on-codebuild: if: github.repository == 'awslabs/soci-snapshotter' - runs-on: codebuild-soci-snapshotter-build-test-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.os }} + runs-on: codebuild-soci-snapshotter-instance-dev-new-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.os }} strategy: matrix: - os: [arm-3.0-large, ubuntu-7.0-xlarge, ubuntu-7.0-small, ubuntu-7.0-medium, ubuntu-7.0-medium] + os: [arm-3.0-large] timeout-minutes: 15 steps: - uses: actions/checkout@v4 @@ -40,22 +40,24 @@ jobs: test-on-fork: if: github.repository != 'awslabs/soci-snapshotter' - runs-on: codebuild-soci-snapshotter-build-test-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.os }} + runs-on: codebuild-soci-snapshotter-instance-dev-new-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.os }} strategy: matrix: - os: [arm-3.0-large, ubuntu-7.0-xlarge] + os: [arm-3.0-large] timeout-minutes: 15 steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} + - run: dnf list --installed + - run: dnf install zlib-static.aarch64 -y - run: make - run: make test integration-on-codebuild: if: github.repository == 'awslabs/soci-snapshotter' - runs-on: codebuild-soci-snapshotter-build-test-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-xlarge + runs-on: codebuild-soci-snapshotter-instance-dev-new-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-xlarge timeout-minutes: 40 strategy: fail-fast: false @@ -72,7 +74,7 @@ jobs: integration-on-fork: if: github.repository != 'awslabs/soci-snapshotter' - runs-on: codebuild-soci-snapshotter-build-test-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-xlarge + runs-on: codebuild-soci-snapshotter-instance-dev-new-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-xlarge timeout-minutes: 40 strategy: fail-fast: false From 4e7878e7c8ce330c4b63b682cf33f415fe535516 Mon Sep 17 00:00:00 2001 From: Arjun Raja Yogidas Date: Thu, 11 Jul 2024 23:26:35 +0000 Subject: [PATCH 3/3] clean up build.yml Signed-off-by: Arjun Raja Yogidas --- .github/workflows/build.yml | 81 ++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 38 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8d730856b..fa04ef9fa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,62 +23,64 @@ env: GO_VERSION: '1.21.10' jobs: - test-on-codebuild: - if: github.repository == 'awslabs/soci-snapshotter' - runs-on: codebuild-soci-snapshotter-instance-dev-new-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.os }} + setup: + # This job sets up the runners to be used in the matrix for the build workflow. + # It provides a list of available runners with stable, human-friendly names and a mapping + # from those names to the actual `runs-on` value for each runner type. This allows us to + # use codebuild-hosted runners for awslabs/soci-snapshotter without requiring forks to also + # have codebuild-hosted runners. + # + # If you want to use codebuild runners for your personal fork, follow the instructions to set + # up a codebuild project. https://docs.aws.amazon.com/codebuild/latest/userguide/action-runner.html + # Then, replace 'soci-snapshotter-instance' with the name of the project you created. + name: Setup Build Matrix + runs-on: ubuntu-latest + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'awslabs/soci-snapshotter' strategy: matrix: - os: [arm-3.0-large] - timeout-minutes: 15 + # We're using a matrix with a single entry so that we can define some config as YAML rather than + # having to write escaped json in a string. + include: + - use-codebuild: ${{ github.repository_owner == 'coderbirju' }} + runs-on-names-cb: [ubuntu-x86, al2-arm] + runs-on-names: [ubuntu] + runner-labels: + ubuntu: ubuntu-22.04 + ubuntu-x86: "codebuild-soci-snapshotter-instance-dev-new-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-xlarge" + al2-arm: "codebuild-soci-snapshotter-instance-dev-new-${{ github.run_id }}-${{ github.run_attempt }}-arm-3.0-large" + outputs: + available-runners: ${{ matrix.use-codebuild && toJSON(matrix.runs-on-names-cb) || toJSON(matrix.runs-on-names) }} + runner-labels: ${{ toJSON(matrix.runner-labels) }} steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: ${{ env.GO_VERSION }} - - run: make - - run: make test + - name: Dump Config + run: echo '${{ toJSON(matrix) }}' - test-on-fork: - if: github.repository != 'awslabs/soci-snapshotter' - runs-on: codebuild-soci-snapshotter-instance-dev-new-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.os }} + + test: + needs: setup + runs-on: ${{ fromJSON(needs.setup.outputs.runner-labels)[matrix.os] }} strategy: matrix: - os: [arm-3.0-large] + os: ${{ fromJSON(needs.setup.outputs.available-runners) }} timeout-minutes: 15 steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - - run: dnf list --installed - - run: dnf install zlib-static.aarch64 -y + - name: Install zlib static on AL2 + if: matrix.os == 'al2-arm' + run: dnf install zlib-static.aarch64 -y - run: make - run: make test - integration-on-codebuild: - if: github.repository == 'awslabs/soci-snapshotter' - runs-on: codebuild-soci-snapshotter-instance-dev-new-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-xlarge - timeout-minutes: 40 - strategy: - fail-fast: false - matrix: - containerd: ["1.6.30", "1.7.14"] - env: - DOCKER_BUILD_ARGS: "CONTAINERD_VERSION=${{ matrix.containerd }}" - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: ${{ env.GO_VERSION }} - - run: make integration - - integration-on-fork: - if: github.repository != 'awslabs/soci-snapshotter' - runs-on: codebuild-soci-snapshotter-instance-dev-new-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-xlarge + integration: + needs: setup + runs-on: ${{ fromJSON(needs.setup.outputs.runner-labels)[matrix.os] }} timeout-minutes: 40 strategy: - fail-fast: false matrix: + os: ${{ fromJSON(needs.setup.outputs.available-runners) }} containerd: ["1.6.30", "1.7.14"] env: DOCKER_BUILD_ARGS: "CONTAINERD_VERSION=${{ matrix.containerd }}" @@ -87,4 +89,7 @@ jobs: - uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} + - name: Install zlib static on AL2 + if: matrix.os == 'al2-arm' + run: dnf install zlib-static.aarch64 -y - run: make integration