Skip to content

Commit

Permalink
move smoke test to resuable workflows for ARM and multi versions
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Turrado <[email protected]>
  • Loading branch information
JorTurFer committed Aug 24, 2022
1 parent df0af8d commit f93fc6f
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 59 deletions.
32 changes: 4 additions & 28 deletions .github/workflows/main-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 3 additions & 28 deletions .github/workflows/nightly-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 13 additions & 0 deletions .github/workflows/rw-arm64-smoke-tests.yml
Original file line number Diff line number Diff line change
@@ -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
44 changes: 44 additions & 0 deletions .github/workflows/rw-smoke-tests.yml
Original file line number Diff line number Diff line change
@@ -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
29 changes: 29 additions & 0 deletions .github/workflows/rw-versions-smoke-tests.yml
Original file line number Diff line number Diff line change
@@ -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 }}
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 #
Expand Down
1 change: 1 addition & 0 deletions tests/run-arm-smoke-tests.sh → tests/run-smoke-tests.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit f93fc6f

Please sign in to comment.