From a2dd2f3a9bd14e52f4039646fbad1369ee2e8ca3 Mon Sep 17 00:00:00 2001 From: Arjun Raja Yogidas Date: Fri, 12 Jul 2024 00:11:30 +0000 Subject: [PATCH 1/2] add codebuild integration to build workflow Signed-off-by: Arjun Raja Yogidas --- .github/workflows/build.yml | 56 +++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 42e848a66..5686eaecd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,26 +20,67 @@ on: - 'scripts/**' env: - GO_VERSION: '1.21.12' + GO_VERSION: '1.21.10' jobs: + 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: + # 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 == 'awslabs' }} + runs-on-names-cb: [ubuntu-x86, al2-arm] + runs-on-names: [ubuntu] + runner-labels: + ubuntu: ubuntu-22.04 + ubuntu-x86: "codebuild-soci-snapshotter-instance-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-xlarge" + al2-arm: "codebuild-soci-snapshotter-instance-${{ 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: + - name: Dump Config + run: echo '${{ toJSON(matrix) }}' + test: - runs-on: ubuntu-20.04 + needs: setup + runs-on: ${{ fromJSON(needs.setup.outputs.runner-labels)[matrix.os] }} + strategy: + matrix: + 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 }} + - name: Install zlib static on AL2 ARM instances + if: matrix.os == 'al2-arm' + run: dnf install zlib-static.aarch64 -y - run: make - run: make test + integration: - runs-on: ubuntu-20.04 + needs: setup + runs-on: ${{ fromJSON(needs.setup.outputs.runner-labels)[matrix.os] }} timeout-minutes: 40 strategy: - fail-fast: false matrix: - containerd: ["1.6.33", "1.7.18", "2.0.0-rc.3"] + os: ${{ fromJSON(needs.setup.outputs.available-runners) }} + containerd: ["1.6.30", "1.7.14"] env: DOCKER_BUILD_ARGS: "CONTAINERD_VERSION=${{ matrix.containerd }}" steps: @@ -47,4 +88,7 @@ jobs: - uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - - run: make integration + - name: Install zlib static on AL2 ARM instances + if: matrix.os == 'al2-arm' + run: dnf install zlib-static.aarch64 -y + - run: make integration \ No newline at end of file From 931d5b9a8f2ee006c8b8b1f44d486db2a09d349f Mon Sep 17 00:00:00 2001 From: Arjun Raja Yogidas Date: Fri, 12 Jul 2024 01:08:42 +0000 Subject: [PATCH 2/2] testing Signed-off-by: Arjun Raja Yogidas --- .github/workflows/build.yml | 46 ++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5686eaecd..93a7ac70a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,19 +35,18 @@ jobs: # 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: # 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 == 'awslabs' }} - runs-on-names-cb: [ubuntu-x86, al2-arm] + - use-codebuild: ${{ github.repository_owner == 'coderbirju' }} + runs-on-names-cb: [ al2-arm] runs-on-names: [ubuntu] runner-labels: ubuntu: ubuntu-22.04 - ubuntu-x86: "codebuild-soci-snapshotter-instance-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-xlarge" - al2-arm: "codebuild-soci-snapshotter-instance-${{ github.run_id }}-${{ github.run_attempt }}-arm-3.0-large" + # 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) }} @@ -55,23 +54,23 @@ jobs: - name: Dump Config run: echo '${{ toJSON(matrix) }}' - test: - needs: setup - runs-on: ${{ fromJSON(needs.setup.outputs.runner-labels)[matrix.os] }} - strategy: - matrix: - 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 }} - - name: Install zlib static on AL2 ARM instances - if: matrix.os == 'al2-arm' - run: dnf install zlib-static.aarch64 -y - - run: make - - run: make test + # test: + # needs: setup + # runs-on: ${{ fromJSON(needs.setup.outputs.runner-labels)[matrix.os] }} + # strategy: + # matrix: + # 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 }} + # - name: Install zlib static on AL2 ARM instances + # if: matrix.os == 'al2-arm' + # run: dnf install zlib-static.aarch64 -y + # - run: make + # - run: make test integration: needs: setup @@ -88,7 +87,8 @@ jobs: - uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} + - run: uname -r - name: Install zlib static on AL2 ARM instances if: matrix.os == 'al2-arm' run: dnf install zlib-static.aarch64 -y - - run: make integration \ No newline at end of file + - run: GO_TEST_FLAGS="-run TestFuseOperationFailureMetrics" make integration \ No newline at end of file