From 4f293c6f79d11b01b570aab0234a35695fd4d84e Mon Sep 17 00:00:00 2001 From: Ava Stancu Date: Fri, 10 Mar 2023 12:16:07 +0100 Subject: [PATCH] Build local image and load to kind cluster (#2378) --- .github/actions/e2e-arc-test/action.yaml | 8 +++++++- .github/workflows/e2e-test-linux-vm.yaml | 21 ++++++++++++++++++++- .github/workflows/update-runners.yaml | 1 + 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/.github/actions/e2e-arc-test/action.yaml b/.github/actions/e2e-arc-test/action.yaml index 13f35861..65739102 100644 --- a/.github/actions/e2e-arc-test/action.yaml +++ b/.github/actions/e2e-arc-test/action.yaml @@ -8,12 +8,18 @@ inputs: config-url: description: "URL of the repo, org or enterprise where the runner scale sets will be registered" required: true + docker-image-repo: + description: "Local docker image repo for testing" + required: true + docker-image-tag: + description: "Tag of ARC Docker image for testing" + required: true runs: using: "composite" steps: - name: Install ARC - run: helm install arc --namespace "arc-systems" --create-namespace ./charts/gha-runner-scale-set-controller + run: helm install arc --namespace "arc-systems" --create-namespace --set image.tag=${{ inputs.docker-image-tag }} --set image.repository=${{ inputs.docker-image-repo }} ./charts/gha-runner-scale-set-controller shell: bash - name: Get datetime # We are using this value further in the runner installation to avoid runner name collision that are a risk with hard coded values. diff --git a/.github/workflows/e2e-test-linux-vm.yaml b/.github/workflows/e2e-test-linux-vm.yaml index 85c282d3..78732bc7 100644 --- a/.github/workflows/e2e-test-linux-vm.yaml +++ b/.github/workflows/e2e-test-linux-vm.yaml @@ -9,16 +9,33 @@ on: env: TARGET_ORG: actions-runner-controller + CLUSTER_NAME: e2e-test + RUNNER_VERSION: 2.302.1 + IMAGE_REPO: "test/test-image" jobs: setup-steps: runs-on: [ubuntu-latest] steps: - uses: actions/checkout@v3 + - name: Add env variables + run: | + TAG=$(echo "0.0.$GITHUB_SHA") + echo "TAG=$TAG" >> $GITHUB_ENV + echo "IMAGE=$(echo "$IMAGE_REPO:$TAG)" >> $GITHUB_ENV + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + with: + version: latest + - name: Docker Build Test Image + run: | + DOCKER_CLI_EXPERIMENTAL=enabled DOCKER_BUILDKIT=1 docker buildx build --build-arg RUNNER_VERSION=$RUNNER_VERSION --build-arg TAG=$TAG -t $IMAGE . --load - name: Create Kind cluster run: | PATH=$(go env GOPATH)/bin:$PATH - kind create cluster --name e2e-test + kind create cluster --name $CLUSTER_NAME + - name: Load Image to Kind Cluster + run: kind load docker-image $IMAGE --name $CLUSTER_NAME - name: Get Token id: get_workflow_token uses: peter-murray/workflow-application-token-action@8e1ba3bf1619726336414f1014e37f17fbadf1db @@ -30,3 +47,5 @@ jobs: with: github-token: ${{ steps.get_workflow_token.outputs.token }} config-url: "https://github.com/actions-runner-controller/arc_e2e_test_dummy" + docker-image-repo: $IMAGE_REPO + docker-image-tag: $IMAGE_TAG diff --git a/.github/workflows/update-runners.yaml b/.github/workflows/update-runners.yaml index d97776c1..3c447d0b 100644 --- a/.github/workflows/update-runners.yaml +++ b/.github/workflows/update-runners.yaml @@ -93,6 +93,7 @@ jobs: sed -i "s/$CURRENT_VERSION/$LATEST_VERSION/g" runner/Makefile sed -i "s/$CURRENT_VERSION/$LATEST_VERSION/g" Makefile sed -i "s/$CURRENT_VERSION/$LATEST_VERSION/g" test/e2e/e2e_test.go + sed -i "s/$CURRENT_VERSION/$LATEST_VERSION/g" .github/workflows/e2e_test_linux_vm.yaml - name: Commit changes run: |