From f93fc6fed0dcf832080ea6da206da653a800e43c Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Wed, 24 Aug 2022 15:18:08 +0200 Subject: [PATCH] move smoke test to resuable workflows for ARM and multi versions Signed-off-by: Jorge Turrado --- .github/workflows/main-build.yml | 32 ++------------ .github/workflows/nightly-e2e.yml | 31 ++----------- .github/workflows/rw-arm64-smoke-tests.yml | 13 ++++++ .github/workflows/rw-smoke-tests.yml | 44 +++++++++++++++++++ .github/workflows/rw-versions-smoke-tests.yml | 29 ++++++++++++ Makefile | 6 +-- ...-arm-smoke-tests.sh => run-smoke-tests.sh} | 1 + 7 files changed, 97 insertions(+), 59 deletions(-) create mode 100644 .github/workflows/rw-arm64-smoke-tests.yml create mode 100644 .github/workflows/rw-smoke-tests.yml create mode 100644 .github/workflows/rw-versions-smoke-tests.yml rename tests/{run-arm-smoke-tests.sh => run-smoke-tests.sh} (98%) mode change 100755 => 100644 diff --git a/.github/workflows/main-build.yml b/.github/workflows/main-build.yml index 8e5ede8726a..a406c5e11ac 100644 --- a/.github/workflows/main-build.yml +++ b/.github/workflows/main-build.yml @@ -147,35 +147,11 @@ jobs: validate-arm64: needs: build - name: validate-arm64 - runs-on: ARM64 - concurrency: arm-smoke-tests - steps: - - name: Setup Go - uses: actions/setup-go@v3 - with: - go-version: 1.17 + uses: kedacore/keda/.github/workflows/rw-arm64-smoke-tests.yml@main - - name: Install prerequisites - run: | - apt update - apt install curl make ca-certificates gcc libc-dev -y - env: - DEBIAN_FRONTEND: noninteractive - - - name: Check out code - uses: actions/checkout@v3 - with: - fetch-depth: 1 - - - name: Create k8s v1.23 Kind Cluster - uses: helm/kind-action@main - with: - node_image: kindest/node:v1.23.0@sha256:49824ab1727c04e56a21a5d8372a402fcd32ea51ac96a2706a12af38934f81ac - cluster_name: smoke-tests-cluster - - - name: Run smoke test - run: make arm-smoke-test + validate-k8s-versions: + needs: build + uses: kedacore/keda/.github/workflows/rw-versions-smoke-tests.yml@main trivy-scan: name: Trivy scan code diff --git a/.github/workflows/nightly-e2e.yml b/.github/workflows/nightly-e2e.yml index e582f3e550c..f4376b41666 100644 --- a/.github/workflows/nightly-e2e.yml +++ b/.github/workflows/nightly-e2e.yml @@ -75,32 +75,7 @@ jobs: AZURE_SUBSCRIPTION: ${{ secrets.AZURE_SUBSCRIPTION }} validate-arm64: - name: validate-arm64 - runs-on: ARM64 - concurrency: arm-smoke-tests - steps: - - name: Setup Go - uses: actions/setup-go@v3 - with: - go-version: 1.17 - - - name: Install prerequisites - run: | - apt update - apt install curl make ca-certificates gcc libc-dev -y - env: - DEBIAN_FRONTEND: noninteractive - - - name: Check out code - uses: actions/checkout@v3 - with: - fetch-depth: 1 - - - name: Create k8s v1.23 Kind Cluster - uses: helm/kind-action@main - with: - node_image: kindest/node:v1.23.0@sha256:49824ab1727c04e56a21a5d8372a402fcd32ea51ac96a2706a12af38934f81ac - cluster_name: smoke-tests-cluster + uses: kedacore/keda/.github/workflows/rw-arm64-smoke-tests.yml@main - - name: Run smoke test - run: make arm-smoke-test + validate-k8s-versions: + uses: kedacore/keda/.github/workflows/rw-versions-smoke-tests.yml@main diff --git a/.github/workflows/rw-arm64-smoke-tests.yml b/.github/workflows/rw-arm64-smoke-tests.yml new file mode 100644 index 00000000000..f9e83c66f81 --- /dev/null +++ b/.github/workflows/rw-arm64-smoke-tests.yml @@ -0,0 +1,13 @@ +name: Reusable workflow to run smoke tests on ARM64 + +on: + workflow_call: + +jobs: + smoke-tests-ARM64: + name: ARM64 + uses: kedacore/keda/.github/workflows/rw-smoke-tests.yml@reusable-workflows + with: + runs-on: ARM64 + kubernetesVersion: v1.24 + kindImage: kindest/node:v1.24.0@sha256:406fd86d48eaf4c04c7280cd1d2ca1d61e7d0d61ddef0125cb097bc7b82ed6a1 \ No newline at end of file diff --git a/.github/workflows/rw-smoke-tests.yml b/.github/workflows/rw-smoke-tests.yml new file mode 100644 index 00000000000..fc912c50b46 --- /dev/null +++ b/.github/workflows/rw-smoke-tests.yml @@ -0,0 +1,44 @@ +name: Reusable workflow to run smoke tests + +on: + workflow_call: + inputs: + runs-on: + required: true + type: string + kubernetesVersion: + required: true + type: string + kindImage: + required: true + type: string +jobs: + smoke-tests: + name: Validate k8s-${{ inputs.kubernetesVersion }} + runs-on: ${{ inputs.runs-on }} + steps: + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: 1.17 + + - name: Install prerequisites + run: | + sudo apt update + sudo apt install curl make ca-certificates gcc libc-dev -y + env: + DEBIAN_FRONTEND: noninteractive + + - name: Check out code + uses: actions/checkout@v3 + with: + fetch-depth: 1 + + - name: Create k8s ${{ inputs.kubernetesVersion }} Kind Cluster + uses: helm/kind-action@main + with: + node_image: ${{ inputs.kindImage }} + cluster_name: smoke-tests-cluster-${{ inputs.kubernetesVersion }} + + - name: Run smoke test + run: make smoke-test \ No newline at end of file diff --git a/.github/workflows/rw-versions-smoke-tests.yml b/.github/workflows/rw-versions-smoke-tests.yml new file mode 100644 index 00000000000..e6993941085 --- /dev/null +++ b/.github/workflows/rw-versions-smoke-tests.yml @@ -0,0 +1,29 @@ +name: Reusable workflow to run smoke tests on different k8s versions + +on: + workflow_call: + +jobs: + smoke-tests: + name: ubuntu-latest + strategy: + fail-fast: false + matrix: + kubernetesVersion: [v1.24, v1.23, v1.22, v1.21, v1.20] + include: + - kubernetesVersion: v1.24 + kindImage: kindest/node:v1.24.0@sha256:406fd86d48eaf4c04c7280cd1d2ca1d61e7d0d61ddef0125cb097bc7b82ed6a1 + - kubernetesVersion: v1.23 + kindImage: kindest/node:v1.23.6@sha256:1af0f1bee4c3c0fe9b07de5e5d3fafeb2eec7b4e1b268ae89fcab96ec67e8355 + - kubernetesVersion: v1.22 + kindImage: kindest/node:v1.22.9@sha256:6e57a6b0c493c7d7183a1151acff0bfa44bf37eb668826bf00da5637c55b6d5e + - kubernetesVersion: v1.21 + kindImage: kindest/node:v1.21.12@sha256:ae05d44cc636ee961068399ea5123ae421790f472c309900c151a44ee35c3e3e + - kubernetesVersion: v1.20 + kindImage: kindest/node:v1.20.15@sha256:a6ce604504db064c5e25921c6c0fffea64507109a1f2a512b1b562ac37d652f3 + + uses: kedacore/keda/.github/workflows/rw-smoke-tests.yml@reusable-workflows + with: + runs-on: ubuntu-latest + kubernetesVersion: ${{ matrix.kubernetesVersion }} + kindImage: ${{ matrix.kindImage }} \ No newline at end of file diff --git a/Makefile b/Makefile index aa146a3b63d..ee7cf1785a5 100644 --- a/Makefile +++ b/Makefile @@ -103,9 +103,9 @@ e2e-test-clean-crds: ## Delete all scaled objects and jobs across all namespaces e2e-test-clean: get-cluster-context ## Delete all namespaces labeled with type=e2e kubectl delete ns -l type=e2e -.PHONY: arm-smoke-test -arm-smoke-test: ## Run e2e tests against Kubernetes cluster configured in ~/.kube/config. - ./tests/run-arm-smoke-tests.sh +.PHONY: smoke-test +smoke-test: ## Run e2e tests against Kubernetes cluster configured in ~/.kube/config. + ./tests/run-smoke-tests.sh ################################################## # Development # diff --git a/tests/run-arm-smoke-tests.sh b/tests/run-smoke-tests.sh old mode 100755 new mode 100644 similarity index 98% rename from tests/run-arm-smoke-tests.sh rename to tests/run-smoke-tests.sh index c4516e62764..e31e9af3ae8 --- a/tests/run-arm-smoke-tests.sh +++ b/tests/run-smoke-tests.sh @@ -4,6 +4,7 @@ set -u DIR=$(dirname "$0") cd $DIR +# use only e2e test which support running on ARM test_files=( "scalers/kubernetes_workload/kubernetes_workload_test.go" "scalers/activemq/activemq_test.go"