From 6d91255e8d3b53234b725065f16e70c61f070b9e Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Mon, 7 Mar 2022 19:26:54 +0100 Subject: [PATCH 1/9] Cleanup some tests Signed-off-by: Jorge Turrado --- tests/scalers/artemis.test.ts | 4 ---- tests/scalers/mysql.test.ts | 1 - tests/scalers/postgresql.test.ts | 1 - tests/scalers/rabbitmq-queue-amqp.test.ts | 3 --- tests/scalers/rabbitmq-queue-http-regex-vhost.test.ts | 3 --- tests/scalers/rabbitmq-queue-http-regex.test.ts | 3 --- tests/scalers/rabbitmq-queue-http.test.ts | 5 +---- tests/scalers/rabbitmq-queue-trigger-auth.test.ts | 3 --- 8 files changed, 1 insertion(+), 22 deletions(-) diff --git a/tests/scalers/artemis.test.ts b/tests/scalers/artemis.test.ts index 4b1a9036084..e8892d99f5e 100644 --- a/tests/scalers/artemis.test.ts +++ b/tests/scalers/artemis.test.ts @@ -1,4 +1,3 @@ -import * as async from 'async' import * as fs from 'fs' import * as sh from 'shelljs' import * as tmp from 'tmp' @@ -8,9 +7,6 @@ import { createNamespace } from './helpers' const testNamespace = 'kedartemis' const artemisNamespace = 'artemis' -const queueName = 'test' -const username = "artemis" -const password = "artemis" test.before(t => { sh.config.silent = true diff --git a/tests/scalers/mysql.test.ts b/tests/scalers/mysql.test.ts index f355e81fa7b..2ac28049dba 100644 --- a/tests/scalers/mysql.test.ts +++ b/tests/scalers/mysql.test.ts @@ -1,4 +1,3 @@ -import * as async from 'async' import * as fs from 'fs' import * as sh from 'shelljs' import * as tmp from 'tmp' diff --git a/tests/scalers/postgresql.test.ts b/tests/scalers/postgresql.test.ts index c599bbbb464..15cf120ba7f 100644 --- a/tests/scalers/postgresql.test.ts +++ b/tests/scalers/postgresql.test.ts @@ -1,4 +1,3 @@ -import * as async from 'async' import * as fs from 'fs' import * as sh from 'shelljs' import * as tmp from 'tmp' diff --git a/tests/scalers/rabbitmq-queue-amqp.test.ts b/tests/scalers/rabbitmq-queue-amqp.test.ts index 43c306081a4..f34b937d6d0 100644 --- a/tests/scalers/rabbitmq-queue-amqp.test.ts +++ b/tests/scalers/rabbitmq-queue-amqp.test.ts @@ -1,7 +1,4 @@ -import * as async from 'async' -import * as fs from 'fs' import * as sh from 'shelljs' -import * as tmp from 'tmp' import test from 'ava' import { RabbitMQHelper } from './rabbitmq-helpers' import {waitForDeploymentReplicaCount} from "./helpers"; diff --git a/tests/scalers/rabbitmq-queue-http-regex-vhost.test.ts b/tests/scalers/rabbitmq-queue-http-regex-vhost.test.ts index c67d090759f..35c2e24a7de 100644 --- a/tests/scalers/rabbitmq-queue-http-regex-vhost.test.ts +++ b/tests/scalers/rabbitmq-queue-http-regex-vhost.test.ts @@ -1,7 +1,4 @@ -import * as async from 'async' -import * as fs from 'fs' import * as sh from 'shelljs' -import * as tmp from 'tmp' import test from 'ava' import { RabbitMQHelper } from './rabbitmq-helpers' import {waitForDeploymentReplicaCount} from "./helpers"; diff --git a/tests/scalers/rabbitmq-queue-http-regex.test.ts b/tests/scalers/rabbitmq-queue-http-regex.test.ts index c7535efc54f..a70dd66bb2a 100644 --- a/tests/scalers/rabbitmq-queue-http-regex.test.ts +++ b/tests/scalers/rabbitmq-queue-http-regex.test.ts @@ -1,7 +1,4 @@ -import * as async from 'async' -import * as fs from 'fs' import * as sh from 'shelljs' -import * as tmp from 'tmp' import test from 'ava' import { RabbitMQHelper } from './rabbitmq-helpers' import {waitForDeploymentReplicaCount} from "./helpers"; diff --git a/tests/scalers/rabbitmq-queue-http.test.ts b/tests/scalers/rabbitmq-queue-http.test.ts index 6046a8c2639..cf9f5998ccd 100644 --- a/tests/scalers/rabbitmq-queue-http.test.ts +++ b/tests/scalers/rabbitmq-queue-http.test.ts @@ -1,10 +1,7 @@ -import * as async from 'async' -import * as fs from 'fs' import * as sh from 'shelljs' -import * as tmp from 'tmp' import test from 'ava' import { RabbitMQHelper } from './rabbitmq-helpers' -import {sleep, waitForDeploymentReplicaCount} from "./helpers"; +import { waitForDeploymentReplicaCount} from "./helpers"; const testNamespace = 'rabbitmq-queue-http-test' const rabbitmqNamespace = 'rabbitmq-http-test' diff --git a/tests/scalers/rabbitmq-queue-trigger-auth.test.ts b/tests/scalers/rabbitmq-queue-trigger-auth.test.ts index b0b21cb503e..736cb253619 100644 --- a/tests/scalers/rabbitmq-queue-trigger-auth.test.ts +++ b/tests/scalers/rabbitmq-queue-trigger-auth.test.ts @@ -1,7 +1,4 @@ -import * as async from 'async' -import * as fs from 'fs' import * as sh from 'shelljs' -import * as tmp from 'tmp' import test from 'ava' import { RabbitMQHelper } from './rabbitmq-helpers' From dc78c8f433617317d07f51f84ea6696a30f60c63 Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Mon, 7 Mar 2022 19:27:05 +0100 Subject: [PATCH 2/9] Update arm smoke tests script Signed-off-by: Jorge Turrado --- tests/run-arm-smoke-tests.sh | 43 ++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/tests/run-arm-smoke-tests.sh b/tests/run-arm-smoke-tests.sh index 87e99fa137c..93ae663e117 100644 --- a/tests/run-arm-smoke-tests.sh +++ b/tests/run-arm-smoke-tests.sh @@ -5,8 +5,9 @@ DIR=$(dirname "$0") cd $DIR test_files=( - "influxdb.test.ts" #ScaledObject - "mongodb.test.ts" #ScaledJob + "kubernetes-workload.test.ts" + "activemq.test.ts" + "cron.test.ts" ) concurrent_tests_limit=5 @@ -27,18 +28,52 @@ function run_tests { do test_case="scalers/${scaler}" counter=$((counter+1)) - ./node_modules/.bin/ava $test_case > "${test_case}.log" 2>&1 & + ./node_modules/.bin/ava $test_case > "${test_case}.1.log" 2>&1 & pid=$! echo "Running $test_case with pid: $pid" pids+=($pid) lookup[$pid]=$test_case # limit concurrent runs - if [[ "$counter" -gt "$concurrent_tests_limit" ]]; then + if [[ "$counter" -ge "$concurrent_tests_limit" ]]; then wait_for_jobs counter=0 pids=() fi done + + wait_for_jobs + + # Retry failing tests + if [ ${#failed_lookup[@]} -ne 0 ]; then + + printf "\n\n##############################################\n" + printf "##############################################\n\n" + printf "FINISHED FIRST EXECUTION, RETRYING FAILING TESTS" + printf "\n\n##############################################\n" + printf "##############################################\n\n" + + retry_lookup=("${failed_lookup[@]}") + counter=0 + pids=() + failed_count=0 + failed_lookup=() + + for test_case in "${retry_lookup[@]}" + do + counter=$((counter+1)) + ./node_modules/.bin/ava $test_case > "${test_case}.2.log" 2>&1 & + pid=$! + echo "Rerunning $test_case with pid: $pid" + pids+=($pid) + lookup[$pid]=$test_case + # limit concurrent runs + if [[ "$counter" -ge "$concurrent_tests_limit" ]]; then + wait_for_jobs + counter=0 + pids=() + fi + done + fi } function mark_failed { From b420268574a2842779a9fa0b4c48adceca2f790a Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Mon, 7 Mar 2022 19:27:36 +0100 Subject: [PATCH 3/9] Tmp change for testing Signed-off-by: Jorge Turrado --- .github/workflows/pr-validation.yml | 373 +++++++++++++++------------- 1 file changed, 202 insertions(+), 171 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 900d81d6aea..f05a7820e27 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -2,188 +2,219 @@ name: CI on: - pull_request jobs: - validate: - name: Validate PR - runs-on: ubuntu-latest - container: ubuntu:focal + 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 necessary packages - run: apt update && apt install -y make ca-certificates gcc - - name: Check out code uses: actions/checkout@v3 with: fetch-depth: 1 - - name: Set Go paths - id: go-paths - run: | - echo ::set-output name=mod_cache::$(go env GOMODCACHE) - echo ::set-output name=build_cache::$(go env GOCACHE) - - - name: Go modules cache - uses: actions/cache@v2.1.7 - with: - path: ${{ steps.go-paths.outputs.mod_cache }} - key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} - - - name: Go build cache - uses: actions/cache@v2.1.7 - with: - path: ${{ steps.go-paths.outputs.build_cache }} - key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }} - - - name: Go modules sync - run: go mod tidy - - - name: Verify Generated clientset is up to date - run: make clientset-verify - - - name: Build - run: make build - - - name: Test - run: make test - - validate-arm64: - name: Validate PR on ARM64 - runs-on: ARM64 - container: arm64v8/ubuntu:focal - env: - ARCH: arm64 - steps: - name: Setup Go uses: actions/setup-go@v3 with: go-version: 1.17 - - name: Install necessary packages - run: apt update && apt install -y make ca-certificates gcc - - - name: Check out code - uses: actions/checkout@v3 - with: - fetch-depth: 1 - - - name: Set Go paths - id: go-paths + - name: Install prerequisites run: | - echo ::set-output name=mod_cache::$(go env GOMODCACHE) - echo ::set-output name=build_cache::$(go env GOCACHE) + apt update + apt install curl npm make ca-certificates gcc libc-dev -y + env: + DEBIAN_FRONTEND: noninteractive - - name: Go modules cache - uses: actions/cache@v2.1.7 + - name: Create k8s v1.23 Kind Cluster + uses: JorTurFer/kind-action@main with: - path: ${{ steps.go-paths.outputs.mod_cache }} - key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} - - - name: Go build cache - uses: actions/cache@v2.1.7 - with: - path: ${{ steps.go-paths.outputs.build_cache }} - key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }} - - - name: Go modules sync - run: go mod tidy - - - name: Verify Generated clientset is up to date - run: make clientset-verify - - - name: Build - run: make build - - - name: Test - run: make test - - validate-dockerfiles: - name: Validate Dockerfiles - runs-on: ubuntu-latest - container: ghcr.io/kedacore/build-tools:main - steps: - - name: Check out code - uses: actions/checkout@v3 - with: - fetch-depth: 1 - - - uses: dorny/paths-filter@v2 - id: filter - with: - filters: | - dockerfiles: - - 'Dockerfile*' - - - name: Build images - if: steps.filter.outputs.dockerfiles == 'true' - run: make docker-build - - validate-build-tools: - name: Validate build-tools - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - uses: dorny/paths-filter@v2 - id: filter - with: - filters: | - tools: - - 'tools/**' - - - name: Build tools - if: steps.filter.outputs.tools == 'true' - run: make docker-build-tools - - statics: - name: Static Checks - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3.0.0 - - uses: actions/setup-go@v3 - with: - go-version: 1.17 - - name: Get golangci - run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.42.0 - - uses: pre-commit/action@v2.0.3 - - codeScanning: - name: Code Scanning - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - language: ['go'] - # Learn more... https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - # We must fetch at least the immediate parents so that if this is - # a pull request then we can checkout the head. - fetch-depth: 2 - - # If this run was triggered by a pull request event, then checkout - # the head of the pull request instead of the merge commit. - - run: git checkout HEAD^2 - if: ${{ github.event_name == 'pull_request' }} - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + node_image: kindest/node:v1.23.0@sha256:49824ab1727c04e56a21a5d8372a402fcd32ea51ac96a2706a12af38934f81ac + cluster_name: smoke-tests-cluster + + - name: Run smoke test + run: make arm-smoke-test + + # validate: + # name: Validate PR + # runs-on: ubuntu-latest + # container: ubuntu:focal + # steps: + # - name: Setup Go + # uses: actions/setup-go@v3 + # with: + # go-version: 1.17 + + # - name: Install necessary packages + # run: apt update && apt install -y make ca-certificates gcc + + # - name: Check out code + # uses: actions/checkout@v3 + # with: + # fetch-depth: 1 + + # - name: Set Go paths + # id: go-paths + # run: | + # echo ::set-output name=mod_cache::$(go env GOMODCACHE) + # echo ::set-output name=build_cache::$(go env GOCACHE) + + # - name: Go modules cache + # uses: actions/cache@v2.1.7 + # with: + # path: ${{ steps.go-paths.outputs.mod_cache }} + # key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} + + # - name: Go build cache + # uses: actions/cache@v2.1.7 + # with: + # path: ${{ steps.go-paths.outputs.build_cache }} + # key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }} + + # - name: Go modules sync + # run: go mod tidy + + # - name: Verify Generated clientset is up to date + # run: make clientset-verify + + # - name: Build + # run: make build + + # - name: Test + # run: make test + + # validate-arm64: + # name: Validate PR on ARM64 + # runs-on: ARM64 + # container: arm64v8/ubuntu:focal + # env: + # ARCH: arm64 + # steps: + # - name: Setup Go + # uses: actions/setup-go@v3 + # with: + # go-version: 1.17 + + # - name: Install necessary packages + # run: apt update && apt install -y make ca-certificates gcc + + # - name: Check out code + # uses: actions/checkout@v3 + # with: + # fetch-depth: 1 + + # - name: Set Go paths + # id: go-paths + # run: | + # echo ::set-output name=mod_cache::$(go env GOMODCACHE) + # echo ::set-output name=build_cache::$(go env GOCACHE) + + # - name: Go modules cache + # uses: actions/cache@v2.1.7 + # with: + # path: ${{ steps.go-paths.outputs.mod_cache }} + # key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} + + # - name: Go build cache + # uses: actions/cache@v2.1.7 + # with: + # path: ${{ steps.go-paths.outputs.build_cache }} + # key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }} + + # - name: Go modules sync + # run: go mod tidy + + # - name: Verify Generated clientset is up to date + # run: make clientset-verify + + # - name: Build + # run: make build + + # - name: Test + # run: make test + + # validate-dockerfiles: + # name: Validate Dockerfiles + # runs-on: ubuntu-latest + # container: ghcr.io/kedacore/build-tools:main + # steps: + # - name: Check out code + # uses: actions/checkout@v3 + # with: + # fetch-depth: 1 + + # - uses: dorny/paths-filter@v2 + # id: filter + # with: + # filters: | + # dockerfiles: + # - 'Dockerfile*' + + # - name: Build images + # if: steps.filter.outputs.dockerfiles == 'true' + # run: make docker-build + + # validate-build-tools: + # name: Validate build-tools + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v3 + + # - uses: dorny/paths-filter@v2 + # id: filter + # with: + # filters: | + # tools: + # - 'tools/**' + + # - name: Build tools + # if: steps.filter.outputs.tools == 'true' + # run: make docker-build-tools + + # statics: + # name: Static Checks + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v3 + # - uses: actions/setup-python@v3.0.0 + # - uses: actions/setup-go@v3 + # with: + # go-version: 1.17 + # - name: Get golangci + # run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.42.0 + # - uses: pre-commit/action@v2.0.3 + + # codeScanning: + # name: Code Scanning + # runs-on: ubuntu-latest + + # strategy: + # fail-fast: false + # matrix: + # language: ['go'] + # # Learn more... https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection + + # steps: + # - name: Checkout repository + # uses: actions/checkout@v3 + # with: + # # We must fetch at least the immediate parents so that if this is + # # a pull request then we can checkout the head. + # fetch-depth: 2 + + # # If this run was triggered by a pull request event, then checkout + # # the head of the pull request instead of the merge commit. + # - run: git checkout HEAD^2 + # if: ${{ github.event_name == 'pull_request' }} + + # # Initializes the CodeQL tools for scanning. + # - name: Initialize CodeQL + # uses: github/codeql-action/init@v1 + # with: + # languages: ${{ matrix.language }} + + # # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # # If this step fails, then you should remove it and run the build manually (see below) + # - name: Autobuild + # uses: github/codeql-action/autobuild@v1 + + # - name: Perform CodeQL Analysis + # uses: github/codeql-action/analyze@v1 From dc2b659287c466d8e17ea0295b34c769d8938af0 Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Mon, 7 Mar 2022 19:41:19 +0100 Subject: [PATCH 4/9] Grant execution permissions Signed-off-by: Jorge Turrado --- tests/run-arm-smoke-tests.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 tests/run-arm-smoke-tests.sh diff --git a/tests/run-arm-smoke-tests.sh b/tests/run-arm-smoke-tests.sh old mode 100644 new mode 100755 From b2d405e411667ff12df49baa64b2a2486d6d1c26 Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Mon, 7 Mar 2022 20:02:51 +0100 Subject: [PATCH 5/9] Add smoke test to main and nightly e2e workflow Signed-off-by: Jorge Turrado --- .github/workflows/main-build.yml | 32 +++ .github/workflows/nightly-e2e.yml | 36 ++- .github/workflows/pr-validation.yml | 373 +++++++++++++--------------- 3 files changed, 237 insertions(+), 204 deletions(-) diff --git a/.github/workflows/main-build.yml b/.github/workflows/main-build.yml index 26c9cee4980..dd2f188d858 100644 --- a/.github/workflows/main-build.yml +++ b/.github/workflows/main-build.yml @@ -126,3 +126,35 @@ jobs: AZURE_SP_KEY: ${{ secrets.AZURE_SP_KEY }} AZURE_SP_TENANT: ${{ secrets.AZURE_SP_TENANT }} AZURE_SUBSCRIPTION: ${{ secrets.AZURE_SUBSCRIPTION }} + + 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 + + - name: Install prerequisites + run: | + apt update + apt install curl npm 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: JorTurFer/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 diff --git a/.github/workflows/nightly-e2e.yml b/.github/workflows/nightly-e2e.yml index 83a969f8b6c..45cef7ae335 100644 --- a/.github/workflows/nightly-e2e.yml +++ b/.github/workflows/nightly-e2e.yml @@ -2,11 +2,12 @@ name: nightly-e2e-test on: schedule: - cron: "0 0 * * *" -concurrency: e2e-tests + jobs: - test: + validate: name: Test runs-on: ubuntu-latest + concurrency: e2e-tests # build-tools is built from ../../tools/build-tools.Dockerfile container: ghcr.io/kedacore/build-tools:main steps: @@ -56,3 +57,34 @@ jobs: AZURE_SP_KEY: ${{ secrets.AZURE_SP_KEY }} AZURE_SP_TENANT: ${{ secrets.AZURE_SP_TENANT }} 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 npm 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: JorTurFer/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 \ No newline at end of file diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index f05a7820e27..900d81d6aea 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -2,219 +2,188 @@ name: CI on: - pull_request jobs: - validate-arm64: - name: validate-arm64 - runs-on: ARM64 - concurrency: arm-smoke-tests + validate: + name: Validate PR + runs-on: ubuntu-latest + container: ubuntu:focal steps: + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: 1.17 + + - name: Install necessary packages + run: apt update && apt install -y make ca-certificates gcc + - name: Check out code uses: actions/checkout@v3 with: fetch-depth: 1 + - name: Set Go paths + id: go-paths + run: | + echo ::set-output name=mod_cache::$(go env GOMODCACHE) + echo ::set-output name=build_cache::$(go env GOCACHE) + + - name: Go modules cache + uses: actions/cache@v2.1.7 + with: + path: ${{ steps.go-paths.outputs.mod_cache }} + key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} + + - name: Go build cache + uses: actions/cache@v2.1.7 + with: + path: ${{ steps.go-paths.outputs.build_cache }} + key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }} + + - name: Go modules sync + run: go mod tidy + + - name: Verify Generated clientset is up to date + run: make clientset-verify + + - name: Build + run: make build + + - name: Test + run: make test + + validate-arm64: + name: Validate PR on ARM64 + runs-on: ARM64 + container: arm64v8/ubuntu:focal + env: + ARCH: arm64 + steps: - name: Setup Go uses: actions/setup-go@v3 with: go-version: 1.17 - - name: Install prerequisites + - name: Install necessary packages + run: apt update && apt install -y make ca-certificates gcc + + - name: Check out code + uses: actions/checkout@v3 + with: + fetch-depth: 1 + + - name: Set Go paths + id: go-paths run: | - apt update - apt install curl npm make ca-certificates gcc libc-dev -y - env: - DEBIAN_FRONTEND: noninteractive + echo ::set-output name=mod_cache::$(go env GOMODCACHE) + echo ::set-output name=build_cache::$(go env GOCACHE) - - name: Create k8s v1.23 Kind Cluster - uses: JorTurFer/kind-action@main + - name: Go modules cache + uses: actions/cache@v2.1.7 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: - # name: Validate PR - # runs-on: ubuntu-latest - # container: ubuntu:focal - # steps: - # - name: Setup Go - # uses: actions/setup-go@v3 - # with: - # go-version: 1.17 - - # - name: Install necessary packages - # run: apt update && apt install -y make ca-certificates gcc - - # - name: Check out code - # uses: actions/checkout@v3 - # with: - # fetch-depth: 1 - - # - name: Set Go paths - # id: go-paths - # run: | - # echo ::set-output name=mod_cache::$(go env GOMODCACHE) - # echo ::set-output name=build_cache::$(go env GOCACHE) - - # - name: Go modules cache - # uses: actions/cache@v2.1.7 - # with: - # path: ${{ steps.go-paths.outputs.mod_cache }} - # key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} - - # - name: Go build cache - # uses: actions/cache@v2.1.7 - # with: - # path: ${{ steps.go-paths.outputs.build_cache }} - # key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }} - - # - name: Go modules sync - # run: go mod tidy - - # - name: Verify Generated clientset is up to date - # run: make clientset-verify - - # - name: Build - # run: make build - - # - name: Test - # run: make test - - # validate-arm64: - # name: Validate PR on ARM64 - # runs-on: ARM64 - # container: arm64v8/ubuntu:focal - # env: - # ARCH: arm64 - # steps: - # - name: Setup Go - # uses: actions/setup-go@v3 - # with: - # go-version: 1.17 - - # - name: Install necessary packages - # run: apt update && apt install -y make ca-certificates gcc - - # - name: Check out code - # uses: actions/checkout@v3 - # with: - # fetch-depth: 1 - - # - name: Set Go paths - # id: go-paths - # run: | - # echo ::set-output name=mod_cache::$(go env GOMODCACHE) - # echo ::set-output name=build_cache::$(go env GOCACHE) - - # - name: Go modules cache - # uses: actions/cache@v2.1.7 - # with: - # path: ${{ steps.go-paths.outputs.mod_cache }} - # key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} - - # - name: Go build cache - # uses: actions/cache@v2.1.7 - # with: - # path: ${{ steps.go-paths.outputs.build_cache }} - # key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }} - - # - name: Go modules sync - # run: go mod tidy - - # - name: Verify Generated clientset is up to date - # run: make clientset-verify - - # - name: Build - # run: make build - - # - name: Test - # run: make test - - # validate-dockerfiles: - # name: Validate Dockerfiles - # runs-on: ubuntu-latest - # container: ghcr.io/kedacore/build-tools:main - # steps: - # - name: Check out code - # uses: actions/checkout@v3 - # with: - # fetch-depth: 1 - - # - uses: dorny/paths-filter@v2 - # id: filter - # with: - # filters: | - # dockerfiles: - # - 'Dockerfile*' - - # - name: Build images - # if: steps.filter.outputs.dockerfiles == 'true' - # run: make docker-build - - # validate-build-tools: - # name: Validate build-tools - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v3 - - # - uses: dorny/paths-filter@v2 - # id: filter - # with: - # filters: | - # tools: - # - 'tools/**' - - # - name: Build tools - # if: steps.filter.outputs.tools == 'true' - # run: make docker-build-tools - - # statics: - # name: Static Checks - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v3 - # - uses: actions/setup-python@v3.0.0 - # - uses: actions/setup-go@v3 - # with: - # go-version: 1.17 - # - name: Get golangci - # run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.42.0 - # - uses: pre-commit/action@v2.0.3 - - # codeScanning: - # name: Code Scanning - # runs-on: ubuntu-latest - - # strategy: - # fail-fast: false - # matrix: - # language: ['go'] - # # Learn more... https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection - - # steps: - # - name: Checkout repository - # uses: actions/checkout@v3 - # with: - # # We must fetch at least the immediate parents so that if this is - # # a pull request then we can checkout the head. - # fetch-depth: 2 - - # # If this run was triggered by a pull request event, then checkout - # # the head of the pull request instead of the merge commit. - # - run: git checkout HEAD^2 - # if: ${{ github.event_name == 'pull_request' }} - - # # Initializes the CodeQL tools for scanning. - # - name: Initialize CodeQL - # uses: github/codeql-action/init@v1 - # with: - # languages: ${{ matrix.language }} - - # # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # # If this step fails, then you should remove it and run the build manually (see below) - # - name: Autobuild - # uses: github/codeql-action/autobuild@v1 - - # - name: Perform CodeQL Analysis - # uses: github/codeql-action/analyze@v1 + path: ${{ steps.go-paths.outputs.mod_cache }} + key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} + + - name: Go build cache + uses: actions/cache@v2.1.7 + with: + path: ${{ steps.go-paths.outputs.build_cache }} + key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }} + + - name: Go modules sync + run: go mod tidy + + - name: Verify Generated clientset is up to date + run: make clientset-verify + + - name: Build + run: make build + + - name: Test + run: make test + + validate-dockerfiles: + name: Validate Dockerfiles + runs-on: ubuntu-latest + container: ghcr.io/kedacore/build-tools:main + steps: + - name: Check out code + uses: actions/checkout@v3 + with: + fetch-depth: 1 + + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + dockerfiles: + - 'Dockerfile*' + + - name: Build images + if: steps.filter.outputs.dockerfiles == 'true' + run: make docker-build + + validate-build-tools: + name: Validate build-tools + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + tools: + - 'tools/**' + + - name: Build tools + if: steps.filter.outputs.tools == 'true' + run: make docker-build-tools + + statics: + name: Static Checks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3.0.0 + - uses: actions/setup-go@v3 + with: + go-version: 1.17 + - name: Get golangci + run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.42.0 + - uses: pre-commit/action@v2.0.3 + + codeScanning: + name: Code Scanning + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + language: ['go'] + # Learn more... https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + # We must fetch at least the immediate parents so that if this is + # a pull request then we can checkout the head. + fetch-depth: 2 + + # If this run was triggered by a pull request event, then checkout + # the head of the pull request instead of the merge commit. + - run: git checkout HEAD^2 + if: ${{ github.event_name == 'pull_request' }} + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 From e2bd9f8c8b0b510e4a0a16d7018e5b7023fa2926 Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Mon, 7 Mar 2022 20:04:48 +0100 Subject: [PATCH 6/9] Update changelog Signed-off-by: Jorge Turrado --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d2d114be30..4440844cb69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ ### New - **General:** Automatically release container image for ARM ([#2263]https://github.com/kedacore/keda/issues/2263)) +- **General:** Automatically run end-to-end tests on ARM ([#2262]https://github.com/kedacore/keda/issues/2262)) ### Improvements From 5ab05a354e4bd7fce0f0fb2cedb2fbcd66a1ae8f Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Mon, 7 Mar 2022 20:13:38 +0100 Subject: [PATCH 7/9] Fix style Signed-off-by: Jorge Turrado --- .github/workflows/nightly-e2e.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly-e2e.yml b/.github/workflows/nightly-e2e.yml index 45cef7ae335..30e086bdd2f 100644 --- a/.github/workflows/nightly-e2e.yml +++ b/.github/workflows/nightly-e2e.yml @@ -87,4 +87,4 @@ jobs: cluster_name: smoke-tests-cluster - name: Run smoke test - run: make arm-smoke-test \ No newline at end of file + run: make arm-smoke-test From e9d368e87cab4d7f35ac0e37b57734bee3fa2693 Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Mon, 7 Mar 2022 20:35:55 +0100 Subject: [PATCH 8/9] Add missing container on pr validation Signed-off-by: Jorge Turrado --- .github/workflows/pr-validation.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 900d81d6aea..065d7485993 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -124,6 +124,7 @@ jobs: validate-build-tools: name: Validate build-tools runs-on: ubuntu-latest + container: ghcr.io/kedacore/build-tools:main steps: - uses: actions/checkout@v3 From 483284d5e9f9581034c958f0fc59d59865acaa9a Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Wed, 9 Mar 2022 14:05:42 +0100 Subject: [PATCH 9/9] Apply feedback Signed-off-by: Jorge Turrado --- tests/run-all.sh | 4 ++-- tests/run-arm-smoke-tests.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/run-all.sh b/tests/run-all.sh index 0eacd6b9a08..8b3ff43c17b 100755 --- a/tests/run-all.sh +++ b/tests/run-all.sh @@ -28,7 +28,7 @@ function run_tests { fi counter=$((counter+1)) - ./node_modules/.bin/ava $test_case > "${test_case}.1.log" 2>&1 & + ./node_modules/.bin/ava $test_case > "${test_case}.log" 2>&1 & pid=$! echo "Running $test_case with pid: $pid" pids+=($pid) @@ -61,7 +61,7 @@ function run_tests { for test_case in "${retry_lookup[@]}" do counter=$((counter+1)) - ./node_modules/.bin/ava $test_case > "${test_case}.2.log" 2>&1 & + ./node_modules/.bin/ava $test_case > "${test_case}.retry.log" 2>&1 & pid=$! echo "Rerunning $test_case with pid: $pid" pids+=($pid) diff --git a/tests/run-arm-smoke-tests.sh b/tests/run-arm-smoke-tests.sh index 93ae663e117..b747869f18b 100755 --- a/tests/run-arm-smoke-tests.sh +++ b/tests/run-arm-smoke-tests.sh @@ -28,7 +28,7 @@ function run_tests { do test_case="scalers/${scaler}" counter=$((counter+1)) - ./node_modules/.bin/ava $test_case > "${test_case}.1.log" 2>&1 & + ./node_modules/.bin/ava $test_case > "${test_case}.log" 2>&1 & pid=$! echo "Running $test_case with pid: $pid" pids+=($pid) @@ -61,7 +61,7 @@ function run_tests { for test_case in "${retry_lookup[@]}" do counter=$((counter+1)) - ./node_modules/.bin/ava $test_case > "${test_case}.2.log" 2>&1 & + ./node_modules/.bin/ava $test_case > "${test_case}.retry.log" 2>&1 & pid=$! echo "Rerunning $test_case with pid: $pid" pids+=($pid)