From f9ee19ed750f228ba3e26e130506bd1445f0c58e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xo=C3=A1n=20Mall=C3=B3n?= Date: Mon, 6 Jun 2022 21:47:41 +0200 Subject: [PATCH 01/20] fix: unify validate-dev-container using multiarch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Xoán Mallón --- .github/workflows/pr-validation.yml | 42 ++++------------------------- 1 file changed, 5 insertions(+), 37 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 155e35f2f2f..9aec74e57a4 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -160,9 +160,12 @@ jobs: run: make docker-build-tools validate-dev-container: - name: Validate dev-container - runs-on: ubuntu-latest + name: Validate dev-container-${{ matrix.runner }} + runs-on: ${{ matrix.runner }} container: ghcr.io/kedacore/build-tools:main + strategy: + matrix: + runner: [ARM64, ubuntu-latest] steps: - uses: actions/checkout@v3 @@ -177,41 +180,6 @@ jobs: if: steps.filter.outputs.devcontainer == 'true' run: make docker-build-dev-containers - validate-dev-container-arm64: - name: Validate dev-container on ARM64 - runs-on: ARM64 - container: arm64v8/ubuntu:focal - env: - DEBIAN_FRONTEND: noninteractive - steps: - - uses: actions/checkout@v3 - - - uses: dorny/paths-filter@v2 - id: filter - with: - filters: | - devcontainer: - - '.devcontainer/Dockerfile' - - - name: Setup Go - if: steps.filter.outputs.devcontainer == 'true' - uses: actions/setup-go@v3 - with: - go-version: 1.17 - - - name: Install deps - if: steps.filter.outputs.devcontainer == 'true' - run: | - apt update && apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common lsb-release make - curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | apt-key add - 2>/dev/null - add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" - apt-get update - apt-get install -y docker-ce-cli - - - name: Build tools - if: steps.filter.outputs.devcontainer == 'true' - run: make docker-build-dev-containers - statics: name: Static Checks runs-on: ubuntu-latest From 0dffe0a52b356cacbe847249ad46ce845cf6ab21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xo=C3=A1n=20Mall=C3=B3n?= Date: Mon, 6 Jun 2022 21:51:42 +0200 Subject: [PATCH 02/20] fix: force to launch validate-dev-container job MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Xoán Mallón --- .github/workflows/pr-validation.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 9aec74e57a4..42a201cc308 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -169,15 +169,15 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: dorny/paths-filter@v2 - id: filter - with: - filters: | - devcontainer: - - '.devcontainer/Dockerfile' + # - uses: dorny/paths-filter@v2 + # id: filter + # with: + # filters: | + # devcontainer: + # - '.devcontainer/Dockerfile' - name: Build tools - if: steps.filter.outputs.devcontainer == 'true' + # if: steps.filter.outputs.devcontainer == 'true' run: make docker-build-dev-containers statics: From 118bf9bfe7422476679c1d6db685924276a03b55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xo=C3=A1n=20Mall=C3=B3n?= Date: Mon, 6 Jun 2022 22:34:49 +0200 Subject: [PATCH 03/20] fix: unify validate in one job MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Xoán Mallón --- .github/workflows/pr-validation.yml | 6 +- ...bbitmq-queu-separated-connection-params.ts | 139 ++++++++++++++++++ 2 files changed, 142 insertions(+), 3 deletions(-) create mode 100644 tests/scalers/rabbitmq-queu-separated-connection-params.ts diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 42a201cc308..cf7d4b9b6d2 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -3,9 +3,9 @@ on: - pull_request jobs: validate: - name: Validate PR - runs-on: ubuntu-latest - container: ubuntu:focal + name: validate-${{ matrix.runner }} + runs-on: ${{ matrix.runner }} + container: ghcr.io/kedacore/build-tools:main steps: - name: Setup Go uses: actions/setup-go@v3 diff --git a/tests/scalers/rabbitmq-queu-separated-connection-params.ts b/tests/scalers/rabbitmq-queu-separated-connection-params.ts new file mode 100644 index 00000000000..af4a1bda1ea --- /dev/null +++ b/tests/scalers/rabbitmq-queu-separated-connection-params.ts @@ -0,0 +1,139 @@ +import * as sh from 'shelljs' +import test from 'ava' +import { RabbitMQHelper } from './rabbitmq-helpers' + +const testNamespace = 'rabbitmq-queue-separated-auth-params' +const rabbitmqNamespace = 'rabbitmq-separated-auth-params-test' +const queueName = 'hello' +const username = "test-user" +const password = "test-password" +const vhost = "test-vh" +const connectionString = `amqp://${username}:${password}@rabbitmq.${rabbitmqNamespace}.svc.cluster.local/${vhost}` +const messageCount = 500 + +test.before(t => { + // install rabbitmq + RabbitMQHelper.installRabbit(t, username, password, vhost, rabbitmqNamespace) + + sh.config.silent = true + + RabbitMQHelper.createDeployment(t, testNamespace, deployYaml, connectionString, connectionString, queueName) +}) + +test.serial('Deployment should have 0 replicas on start', t => { + const replicaCount = sh.exec( + `kubectl get deployment.apps/test-deployment --namespace ${testNamespace} -o jsonpath="{.spec.replicas}"` + ).stdout + t.is(replicaCount, '0', 'replica count should start out as 0') +}) + +test.serial(`Deployment should scale to 4 with ${messageCount} messages on the queue then back to 0`, t => { + RabbitMQHelper.publishMessages(t, testNamespace, connectionString, messageCount, queueName) + + // with messages published, the consumer deployment should start receiving the messages + let replicaCount = '0' + for (let i = 0; i < 10 && replicaCount !== '4'; i++) { + replicaCount = sh.exec( + `kubectl get deployment.apps/test-deployment --namespace ${testNamespace} -o jsonpath="{.spec.replicas}"` + ).stdout + t.log('replica count is:' + replicaCount) + if (replicaCount !== '4') { + sh.exec('sleep 5s') + } + } + + t.is('4', replicaCount, 'Replica count should be 4 after 10 seconds') + + for (let i = 0; i < 50 && replicaCount !== '0'; i++) { + replicaCount = sh.exec( + `kubectl get deployment.apps/test-deployment --namespace ${testNamespace} -o jsonpath="{.spec.replicas}"` + ).stdout + if (replicaCount !== '0') { + sh.exec('sleep 5s') + } + } + + t.is('0', replicaCount, 'Replica count should be 0 after 3 minutes') +}) + +test.after.always.cb('clean up rabbitmq-queue deployment', t => { + const resources = [ + 'scaledobject.keda.sh/test-scaledobject', + 'triggerauthentications.keda.sh/rabbitmq-trigger-auth', + 'secret/test-secrets', + 'deployment.apps/test-deployment', + ] + + for (const resource of resources) { + sh.exec(`kubectl delete ${resource} --namespace ${testNamespace}`) + } + sh.exec(`kubectl delete namespace ${testNamespace}`) + + // remove rabbitmq + RabbitMQHelper.uninstallRabbit(rabbitmqNamespace) + t.end() +}) + +const deployYaml = `apiVersion: v1 +kind: Secret +metadata: + name: rabbitmq-test-secret +data: + RabbitMqHost: {{CONNECTION_STRING_BASE64}} + RabbitMqUsername: {{USERNAME_BASE64}} + RabbitMqPassword: {{PASSWORD_BASE64}} + RabbitMqDomain: {{DOMAIN_BASE64}} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test-deployment + labels: + app: test-deployment +spec: + replicas: 0 + selector: + matchLabels: + app: test-deployment + template: + metadata: + labels: + app: test-deployment + spec: + containers: + - name: rabbitmq-consumer + image: ghcr.io/kedacore/tests-rabbitmq + imagePullPolicy: Always + command: + - receive + args: + - '{{CONNECTION_STRING}}' +--- +apiVersion: keda.sh/v1alpha1 +kind: TriggerAuthentication +metadata: + name: rabbitmq-trigger-auth +spec: + secretTargetRef: + - parameter: host + name: rabbitmq-test-secret + key: RabbitMqHost +--- +apiVersion: keda.sh/v1alpha1 +kind: ScaledObject +metadata: + name: test-scaledobject +spec: + scaleTargetRef: + name: test-deployment + pollingInterval: 5 + cooldownPeriod: 10 + minReplicaCount: 0 + maxReplicaCount: 4 + triggers: + - type: rabbitmq + metadata: + queueName: {{QUEUE_NAME}} + queueLength: '50' + authenticationRef: + name: rabbitmq-trigger-auth` From ced0a9116a89142cdfda50b26b0cd0d6944b7640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xo=C3=A1n=20Mall=C3=B3n?= Date: Mon, 6 Jun 2022 22:35:56 +0200 Subject: [PATCH 04/20] fix: add matrix strategy to validate job MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Xoán Mallón --- .github/workflows/pr-validation.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index cf7d4b9b6d2..961799e1c41 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -6,6 +6,9 @@ jobs: name: validate-${{ matrix.runner }} runs-on: ${{ matrix.runner }} container: ghcr.io/kedacore/build-tools:main + strategy: + matrix: + runner: [ARM64, ubuntu-latest] steps: - name: Setup Go uses: actions/setup-go@v3 From 6a584cae03a2474ad7b64913ec8119ba6ae049ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xo=C3=A1n=20Mall=C3=B3n?= Date: Mon, 6 Jun 2022 22:39:58 +0200 Subject: [PATCH 05/20] fix: change matrix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Xoán Mallón --- .github/workflows/pr-validation.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 961799e1c41..6593270d6a4 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -3,12 +3,18 @@ on: - pull_request jobs: validate: - name: validate-${{ matrix.runner }} + name: validate-${{ matrix.name }} runs-on: ${{ matrix.runner }} container: ghcr.io/kedacore/build-tools:main strategy: - matrix: - runner: [ARM64, ubuntu-latest] + matrix: + include: + - runner: ARM64 + name: amr64 + - runner: ubuntu:latest + name: amd64 + - runner: amd + kindImage: kindest/node:v1.22.0@sha256:b8bda84bb3a190e6e028b1760d277454a72267a5454b57db34437c34a588d047 steps: - name: Setup Go uses: actions/setup-go@v3 From 231996faef51682de7617ef5b86a88bef4c4a21f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xo=C3=A1n=20Mall=C3=B3n?= Date: Mon, 6 Jun 2022 22:40:51 +0200 Subject: [PATCH 06/20] fix: correct matrix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Xoán Mallón --- .github/workflows/pr-validation.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 6593270d6a4..3d1c8a59fef 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -13,8 +13,6 @@ jobs: name: amr64 - runner: ubuntu:latest name: amd64 - - runner: amd - kindImage: kindest/node:v1.22.0@sha256:b8bda84bb3a190e6e028b1760d277454a72267a5454b57db34437c34a588d047 steps: - name: Setup Go uses: actions/setup-go@v3 From 7875b24ece0e8811c83f9cd8ec5c8719808b3c4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xo=C3=A1n=20Mall=C3=B3n?= Date: Mon, 6 Jun 2022 22:42:44 +0200 Subject: [PATCH 07/20] fix: change matrix adding attributes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Xoán Mallón --- .github/workflows/pr-validation.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 3d1c8a59fef..1025b5df566 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -167,12 +167,16 @@ jobs: run: make docker-build-tools validate-dev-container: - name: Validate dev-container-${{ matrix.runner }} + name: Validate dev-container-${{ matrix.name }} runs-on: ${{ matrix.runner }} container: ghcr.io/kedacore/build-tools:main strategy: - matrix: - runner: [ARM64, ubuntu-latest] + matrix: + include: + - runner: ARM64 + name: amr64 + - runner: ubuntu:latest + name: amd64 steps: - uses: actions/checkout@v3 From 960e165153c8b8ee12f53b7ed8a0a6ae507a9ab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xo=C3=A1n=20Mall=C3=B3n?= Date: Mon, 6 Jun 2022 22:43:30 +0200 Subject: [PATCH 08/20] fix: change name of jobs with matrix style MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Xoán Mallón --- .github/workflows/pr-validation.yml | 37 +++++++++++++++++------------ Makefile | 4 ++-- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 1025b5df566..57d628cf0dc 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -3,7 +3,7 @@ on: - pull_request jobs: validate: - name: validate-${{ matrix.name }} + name: validate - ${{ matrix.name }} runs-on: ${{ matrix.runner }} container: ghcr.io/kedacore/build-tools:main strategy: @@ -142,32 +142,39 @@ jobs: validate-build-tools: name: Validate build-tools - runs-on: ubuntu-latest + runs-on: ${{ matrix.runner }} container: ghcr.io/kedacore/build-tools:main + strategy: + matrix: + include: + - runner: ARM64 + name: amr64 + - runner: ubuntu:latest + name: amd64 steps: - uses: actions/checkout@v3 - - uses: dorny/paths-filter@v2 - id: filter - with: - filters: | - tools: - - 'tools/**' + # - uses: dorny/paths-filter@v2 + # id: filter + # with: + # filters: | + # tools: + # - 'tools/**' - - name: Set up QEMU - if: steps.filter.outputs.tools == 'true' - uses: docker/setup-qemu-action@v2 + # - name: Set up QEMU + # if: steps.filter.outputs.tools == 'true' + # uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - if: steps.filter.outputs.tools == 'true' - uses: docker/setup-buildx-action@v2 + # - name: Set up Docker Buildx + # if: steps.filter.outputs.tools == 'true' + # uses: docker/setup-buildx-action@v2 - name: Build tools if: steps.filter.outputs.tools == 'true' run: make docker-build-tools validate-dev-container: - name: Validate dev-container-${{ matrix.name }} + name: Validate dev-container - ${{ matrix.name }} runs-on: ${{ matrix.runner }} container: ghcr.io/kedacore/build-tools:main strategy: diff --git a/Makefile b/Makefile index 2415dc297d2..6034e8aa092 100644 --- a/Makefile +++ b/Makefile @@ -310,8 +310,8 @@ help: ## Display this help. @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) .PHONY: docker-build-tools -docker-build-tools: ## Build multi-arch Docker image for build-tools. - docker buildx build --platform=${BUILD_PLATFORMS} -f tools/build-tools.Dockerfile -t ${IMAGE_BUILD_TOOLS} . +docker-build-tools: ## Build build-tools image + docker build -f tools/build-tools.Dockerfile -t $(IMAGE_BUILD_TOOLS) . .PHONY: publish-build-tools publish-build-tools: ## Build and push multi-arch Docker image for build-tools. From ba78e2896c342099e4a23460d611b355b0710cc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xo=C3=A1n=20Mall=C3=B3n?= Date: Mon, 6 Jun 2022 22:51:47 +0200 Subject: [PATCH 09/20] fix: change name of matrix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Xoán Mallón --- .github/workflows/pr-validation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 57d628cf0dc..a4dd23dc866 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -141,7 +141,7 @@ jobs: run: make docker-build validate-build-tools: - name: Validate build-tools + name: Validate build-tools - ${{ matrix.name }} runs-on: ${{ matrix.runner }} container: ghcr.io/kedacore/build-tools:main strategy: From 71789c0707a0fb639d3f594128832df6d47e251c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xo=C3=A1n=20Mall=C3=B3n?= Date: Tue, 7 Jun 2022 19:36:00 +0200 Subject: [PATCH 10/20] fix: correct typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Xoán Mallón --- .github/workflows/pr-validation.yml | 39 ++++++++++++++++------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index a4dd23dc866..eb48dfb8509 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -7,12 +7,10 @@ jobs: runs-on: ${{ matrix.runner }} container: ghcr.io/kedacore/build-tools:main strategy: - matrix: + matrix: include: - runner: ARM64 - name: amr64 - - runner: ubuntu:latest - name: amd64 + name: arm64 steps: - name: Setup Go uses: actions/setup-go@v3 @@ -120,24 +118,31 @@ jobs: if: always() validate-dockerfiles: - name: Validate Dockerfiles - runs-on: ubuntu-latest + name: validate-dockerfiles - ${{ matrix.name }} + runs-on: ${{ matrix.runner }} container: ghcr.io/kedacore/build-tools:main + strategy: + matrix: + include: + - runner: ARM64 + name: arm64 + - runner: ubuntu-latest + name: amd64 steps: - name: Check out code uses: actions/checkout@v3 with: fetch-depth: 1 - - uses: dorny/paths-filter@v2 - id: filter - with: - filters: | - dockerfiles: - - 'Dockerfile*' + # - uses: dorny/paths-filter@v2 + # id: filter + # with: + # filters: | + # dockerfiles: + # - 'Dockerfile*' - name: Build images - if: steps.filter.outputs.dockerfiles == 'true' + # if: steps.filter.outputs.dockerfiles == 'true' run: make docker-build validate-build-tools: @@ -148,8 +153,8 @@ jobs: matrix: include: - runner: ARM64 - name: amr64 - - runner: ubuntu:latest + name: arm64 + - runner: ubuntu-latest name: amd64 steps: - uses: actions/checkout@v3 @@ -181,8 +186,8 @@ jobs: matrix: include: - runner: ARM64 - name: amr64 - - runner: ubuntu:latest + name: arm64 + - runner: ubuntu-latest name: amd64 steps: - uses: actions/checkout@v3 From 1a5b19b452edf15493cf7ed8337d73f8f8049539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xo=C3=A1n=20Mall=C3=B3n?= Date: Tue, 7 Jun 2022 19:36:47 +0200 Subject: [PATCH 11/20] fix: add all elements to matrix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Xoán Mallón --- .github/workflows/pr-validation.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index eb48dfb8509..45c6da41373 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -11,6 +11,8 @@ jobs: include: - runner: ARM64 name: arm64 + - runner: ubuntu-latest + name: amd64 steps: - name: Setup Go uses: actions/setup-go@v3 From 11b2161b97d3c5de3685123ebec5ad7d77c7d75f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xo=C3=A1n=20Mall=C3=B3n?= Date: Tue, 7 Jun 2022 19:43:18 +0200 Subject: [PATCH 12/20] fix: simple change to trigger actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Xoán Mallón --- .github/workflows/pr-validation.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 45c6da41373..001ecd58990 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -135,7 +135,6 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 1 - # - uses: dorny/paths-filter@v2 # id: filter # with: From a6d4a43d641555aac93bf105814aba23e082dc81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xo=C3=A1n=20Mall=C3=B3n?= Date: Tue, 7 Jun 2022 19:47:35 +0200 Subject: [PATCH 13/20] fix: unify workflows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Xoán Mallón --- .github/workflows/pr-validation.yml | 56 ----------------------------- 1 file changed, 56 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 001ecd58990..fdc3b673f79 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -63,62 +63,6 @@ jobs: paths: "report.xml" if: always() - 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@v3.0.5 - with: - path: ${{ steps.go-paths.outputs.mod_cache }} - key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} - - - name: Go build cache - uses: actions/cache@v3.0.5 - 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 - - - name: Create test Summary - uses: test-summary/action@v1 - with: - paths: "report.xml" - if: always() - validate-dockerfiles: name: validate-dockerfiles - ${{ matrix.name }} runs-on: ${{ matrix.runner }} From 218ebccf06a9420cf672769173b26de82a5e9d68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xo=C3=A1n=20Mall=C3=B3n?= Date: Tue, 7 Jun 2022 19:51:07 +0200 Subject: [PATCH 14/20] fix: remove innecesary step MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Xoán Mallón --- .github/workflows/pr-validation.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index fdc3b673f79..169a2aa3188 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -14,13 +14,6 @@ jobs: - runner: ubuntu-latest name: amd64 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 From f8d2625ca66e6255c6972342ea7213317451bd87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xo=C3=A1n=20Mall=C3=B3n?= Date: Tue, 7 Jun 2022 19:56:41 +0200 Subject: [PATCH 15/20] fix: make to launch all jobs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Xoán Mallón --- .github/workflows/pr-validation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 169a2aa3188..01e90979ff9 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -113,7 +113,7 @@ jobs: # uses: docker/setup-buildx-action@v2 - name: Build tools - if: steps.filter.outputs.tools == 'true' + # if: steps.filter.outputs.tools == 'true' run: make docker-build-tools validate-dev-container: From a50d544c6fc0eb6d4a3bd5e5bdb973ca298ab54b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xo=C3=A1n=20Mall=C3=B3n?= Date: Tue, 7 Jun 2022 20:29:28 +0200 Subject: [PATCH 16/20] fix: add test command to check change go version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Xoán Mallón --- .github/workflows/pr-validation.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 01e90979ff9..272e20797d6 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -20,6 +20,13 @@ jobs: with: fetch-depth: 1 + - uses: actions/setup-go@v3 + with: + go-version: 1.18 + + - name: Check go version + run: go version + - name: Set Go paths id: go-paths run: | From cdeb166aecee3b79301113beb71be01dd9517f24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xo=C3=A1n=20Mall=C3=B3n?= Date: Wed, 8 Jun 2022 21:28:59 +0200 Subject: [PATCH 17/20] fix: remove unnecesary file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Xoán Mallón --- ...bbitmq-queu-separated-connection-params.ts | 139 ------------------ 1 file changed, 139 deletions(-) delete mode 100644 tests/scalers/rabbitmq-queu-separated-connection-params.ts diff --git a/tests/scalers/rabbitmq-queu-separated-connection-params.ts b/tests/scalers/rabbitmq-queu-separated-connection-params.ts deleted file mode 100644 index af4a1bda1ea..00000000000 --- a/tests/scalers/rabbitmq-queu-separated-connection-params.ts +++ /dev/null @@ -1,139 +0,0 @@ -import * as sh from 'shelljs' -import test from 'ava' -import { RabbitMQHelper } from './rabbitmq-helpers' - -const testNamespace = 'rabbitmq-queue-separated-auth-params' -const rabbitmqNamespace = 'rabbitmq-separated-auth-params-test' -const queueName = 'hello' -const username = "test-user" -const password = "test-password" -const vhost = "test-vh" -const connectionString = `amqp://${username}:${password}@rabbitmq.${rabbitmqNamespace}.svc.cluster.local/${vhost}` -const messageCount = 500 - -test.before(t => { - // install rabbitmq - RabbitMQHelper.installRabbit(t, username, password, vhost, rabbitmqNamespace) - - sh.config.silent = true - - RabbitMQHelper.createDeployment(t, testNamespace, deployYaml, connectionString, connectionString, queueName) -}) - -test.serial('Deployment should have 0 replicas on start', t => { - const replicaCount = sh.exec( - `kubectl get deployment.apps/test-deployment --namespace ${testNamespace} -o jsonpath="{.spec.replicas}"` - ).stdout - t.is(replicaCount, '0', 'replica count should start out as 0') -}) - -test.serial(`Deployment should scale to 4 with ${messageCount} messages on the queue then back to 0`, t => { - RabbitMQHelper.publishMessages(t, testNamespace, connectionString, messageCount, queueName) - - // with messages published, the consumer deployment should start receiving the messages - let replicaCount = '0' - for (let i = 0; i < 10 && replicaCount !== '4'; i++) { - replicaCount = sh.exec( - `kubectl get deployment.apps/test-deployment --namespace ${testNamespace} -o jsonpath="{.spec.replicas}"` - ).stdout - t.log('replica count is:' + replicaCount) - if (replicaCount !== '4') { - sh.exec('sleep 5s') - } - } - - t.is('4', replicaCount, 'Replica count should be 4 after 10 seconds') - - for (let i = 0; i < 50 && replicaCount !== '0'; i++) { - replicaCount = sh.exec( - `kubectl get deployment.apps/test-deployment --namespace ${testNamespace} -o jsonpath="{.spec.replicas}"` - ).stdout - if (replicaCount !== '0') { - sh.exec('sleep 5s') - } - } - - t.is('0', replicaCount, 'Replica count should be 0 after 3 minutes') -}) - -test.after.always.cb('clean up rabbitmq-queue deployment', t => { - const resources = [ - 'scaledobject.keda.sh/test-scaledobject', - 'triggerauthentications.keda.sh/rabbitmq-trigger-auth', - 'secret/test-secrets', - 'deployment.apps/test-deployment', - ] - - for (const resource of resources) { - sh.exec(`kubectl delete ${resource} --namespace ${testNamespace}`) - } - sh.exec(`kubectl delete namespace ${testNamespace}`) - - // remove rabbitmq - RabbitMQHelper.uninstallRabbit(rabbitmqNamespace) - t.end() -}) - -const deployYaml = `apiVersion: v1 -kind: Secret -metadata: - name: rabbitmq-test-secret -data: - RabbitMqHost: {{CONNECTION_STRING_BASE64}} - RabbitMqUsername: {{USERNAME_BASE64}} - RabbitMqPassword: {{PASSWORD_BASE64}} - RabbitMqDomain: {{DOMAIN_BASE64}} ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: test-deployment - labels: - app: test-deployment -spec: - replicas: 0 - selector: - matchLabels: - app: test-deployment - template: - metadata: - labels: - app: test-deployment - spec: - containers: - - name: rabbitmq-consumer - image: ghcr.io/kedacore/tests-rabbitmq - imagePullPolicy: Always - command: - - receive - args: - - '{{CONNECTION_STRING}}' ---- -apiVersion: keda.sh/v1alpha1 -kind: TriggerAuthentication -metadata: - name: rabbitmq-trigger-auth -spec: - secretTargetRef: - - parameter: host - name: rabbitmq-test-secret - key: RabbitMqHost ---- -apiVersion: keda.sh/v1alpha1 -kind: ScaledObject -metadata: - name: test-scaledobject -spec: - scaleTargetRef: - name: test-deployment - pollingInterval: 5 - cooldownPeriod: 10 - minReplicaCount: 0 - maxReplicaCount: 4 - triggers: - - type: rabbitmq - metadata: - queueName: {{QUEUE_NAME}} - queueLength: '50' - authenticationRef: - name: rabbitmq-trigger-auth` From 18fbc1c9b7557dae5bca95073d937ac9cfa83ecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xo=C3=A1n=20Mall=C3=B3n?= Date: Fri, 15 Jul 2022 11:32:57 +0200 Subject: [PATCH 18/20] fix: add test smoke arm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Xoán Mallón --- .github/workflows/main-build.yml | 12 +---- .github/workflows/pr-validation.yml | 84 ++++++++++++++++++----------- 2 files changed, 55 insertions(+), 41 deletions(-) diff --git a/.github/workflows/main-build.yml b/.github/workflows/main-build.yml index efeac8e343b..85497a1fffa 100644 --- a/.github/workflows/main-build.yml +++ b/.github/workflows/main-build.yml @@ -143,19 +143,9 @@ jobs: needs: build name: validate-arm64 runs-on: ARM64 + container: ghcr.io/kedacore/build-tools:main 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 diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 272e20797d6..1365631b2e7 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -20,9 +20,10 @@ jobs: with: fetch-depth: 1 - - uses: actions/setup-go@v3 - with: - go-version: 1.18 + # Enable this if you need a different version that the already installed in build-tools image + # - uses: actions/setup-go@v3 + # with: + # go-version: 1.18 - name: Check go version run: go version @@ -79,17 +80,40 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 1 - # - uses: dorny/paths-filter@v2 - # id: filter - # with: - # filters: | - # dockerfiles: - # - 'Dockerfile*' + + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + dockerfiles: + - 'Dockerfile*' - name: Build images - # if: steps.filter.outputs.dockerfiles == 'true' + if: steps.filter.outputs.dockerfiles == 'true' run: make docker-build + test-smoke-arm64: + needs: build + name: validate-arm64 + runs-on: ARM64 + container: ghcr.io/kedacore/build-tools:main + concurrency: arm-smoke-tests + steps: + + - 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-build-tools: name: Validate build-tools - ${{ matrix.name }} runs-on: ${{ matrix.runner }} @@ -104,23 +128,23 @@ jobs: steps: - uses: actions/checkout@v3 - # - uses: dorny/paths-filter@v2 - # id: filter - # with: - # filters: | - # tools: - # - 'tools/**' + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + tools: + - 'tools/**' - # - name: Set up QEMU - # if: steps.filter.outputs.tools == 'true' - # uses: docker/setup-qemu-action@v2 + - name: Set up QEMU + if: steps.filter.outputs.tools == 'true' + uses: docker/setup-qemu-action@v2 - # - name: Set up Docker Buildx - # if: steps.filter.outputs.tools == 'true' - # uses: docker/setup-buildx-action@v2 + - name: Set up Docker Buildx + if: steps.filter.outputs.tools == 'true' + uses: docker/setup-buildx-action@v2 - name: Build tools - # if: steps.filter.outputs.tools == 'true' + if: steps.filter.outputs.tools == 'true' run: make docker-build-tools validate-dev-container: @@ -137,15 +161,15 @@ jobs: steps: - uses: actions/checkout@v3 - # - uses: dorny/paths-filter@v2 - # id: filter - # with: - # filters: | - # devcontainer: - # - '.devcontainer/Dockerfile' + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + devcontainer: + - '.devcontainer/Dockerfile' - name: Build tools - # if: steps.filter.outputs.devcontainer == 'true' + if: steps.filter.outputs.devcontainer == 'true' run: make docker-build-dev-containers statics: From 2a743cec2027c70c0dbf8e4cf96875d9bb0ab7e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xo=C3=A1n=20Mall=C3=B3n?= Date: Fri, 15 Jul 2022 11:33:39 +0200 Subject: [PATCH 19/20] fix: delete innecesary line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Xoán Mallón --- .github/workflows/pr-validation.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 1365631b2e7..c5c043d7b57 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -93,7 +93,6 @@ jobs: run: make docker-build test-smoke-arm64: - needs: build name: validate-arm64 runs-on: ARM64 container: ghcr.io/kedacore/build-tools:main From 9b5b29df530cf73adf3141b87760895cb191e208 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xo=C3=A1n=20Mall=C3=B3n?= Date: Fri, 15 Jul 2022 11:40:56 +0200 Subject: [PATCH 20/20] fix: delete container for smoke tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Xoán Mallón --- .github/workflows/main-build.yml | 12 +++++++++++- .github/workflows/pr-validation.yml | 21 --------------------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/.github/workflows/main-build.yml b/.github/workflows/main-build.yml index 85497a1fffa..efeac8e343b 100644 --- a/.github/workflows/main-build.yml +++ b/.github/workflows/main-build.yml @@ -143,9 +143,19 @@ jobs: needs: build name: validate-arm64 runs-on: ARM64 - container: ghcr.io/kedacore/build-tools:main 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 diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index c5c043d7b57..59adbc75c5f 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -92,27 +92,6 @@ jobs: if: steps.filter.outputs.dockerfiles == 'true' run: make docker-build - test-smoke-arm64: - name: validate-arm64 - runs-on: ARM64 - container: ghcr.io/kedacore/build-tools:main - concurrency: arm-smoke-tests - steps: - - - 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-build-tools: name: Validate build-tools - ${{ matrix.name }} runs-on: ${{ matrix.runner }}