diff --git a/.github/workflows/build_canary.yml b/.github/workflows/build_canary.yml index b365902dc..d20b43ee1 100644 --- a/.github/workflows/build_canary.yml +++ b/.github/workflows/build_canary.yml @@ -5,27 +5,15 @@ on: branches: [ main ] workflow_dispatch: -env: - IMAGE_OPERATOR_NAME: ghcr.io/${{ github.repository_owner }}/http-add-on-operator - IMAGE_INTERCEPTOR_NAME: ghcr.io/${{ github.repository_owner }}/http-add-on-interceptor - IMAGE_SCALER_NAME: ghcr.io/${{ github.repository_owner }}/http-add-on-scaler - jobs: - build_operator: - + build: runs-on: ubuntu-20.04 - + container: ghcr.io/kedacore/build-tools:1.19.5 steps: - uses: actions/checkout@v3 - - name: Set up tags and refs - id: prep - run: | - echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ') - echo ::set-output name=sha::$(git rev-parse --short HEAD) - - - name: Set up Buildx - uses: docker/setup-buildx-action@v2 + - name: Register workspace path + run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - name: Login to GHCR uses: docker/login-action@v2 @@ -37,112 +25,10 @@ jobs: # Server address of Docker registry. If not set then will default to Docker Hub registry: ghcr.io - - name: Build and push operator image - uses: docker/build-push-action@v3 - with: - # Docker repository to tag the image with - tags: | - ${{ env.IMAGE_OPERATOR_NAME }}:canary,${{ env.IMAGE_OPERATOR_NAME }}:sha-${{ steps.prep.outputs.sha }} - labels: | - sh.keda.http.image.source=${{github.event.repository.html_url}} - sh.keda.http.image.created=${{steps.prep.outputs.created}} - sh.keda.http.image.revision=${{github.sha}} - build-args: "VERSION=${{ steps.prep.outputs.sha }}" - file: operator/Dockerfile - context: . - push: true - - build_interceptor: - - runs-on: ubuntu-20.04 - - steps: - - uses: actions/checkout@v3 - - - name: Set up tags and refs - id: prep - run: | - echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ') - echo ::set-output name=sha::$(git rev-parse --short HEAD) - - - name: Set up Buildx + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Login to GHCR - uses: docker/login-action@v2 - with: - # Username used to log in to a Docker registry. If not set then no login will occur - username: ${{ github.repository_owner }} - # https://github.blog/changelog/2021-03-24-packages-container-registry-now-supports-github_token/ - password: ${{ secrets.GITHUB_TOKEN }} - # Server address of Docker registry. If not set then will default to Docker Hub - registry: ghcr.io - - - name: Build and push interceptor image - uses: docker/build-push-action@v3 - with: - # Docker repository to tag the image with - tags: ${{ env.IMAGE_INTERCEPTOR_NAME }}:canary,${{ env.IMAGE_INTERCEPTOR_NAME }}:sha-${{steps.prep.outputs.sha}} - labels: | - sh.keda.http.image.source=${{github.event.repository.html_url}} - sh.keda.http.image.created=${{steps.prep.outputs.created}} - sh.keda.http.image.revision=${{github.sha}} - file: interceptor/Dockerfile - context: . - push: true - - build_scaler: - runs-on: ubuntu-20.04 - - steps: - - uses: actions/checkout@v3 - - - name: Set up tags and refs - id: prep - run: | - echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ') - echo ::set-output name=sha::$(git rev-parse --short HEAD) - - - name: Set up Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to GHCR - uses: docker/login-action@v2 - with: - # Username used to log in to a Docker registry. If not set then no login will occur - username: ${{ github.repository_owner }} - # Password or personal access token used to log in to a Docker registry. If not set then no login will occur - password: ${{ secrets.GITHUB_TOKEN }} - # Server address of Docker registry. If not set then will default to Docker Hub - registry: ghcr.io - - - name: Build and push scaler image - uses: docker/build-push-action@v3 - with: - # Docker repository to tag the image with - tags: ${{ env.IMAGE_SCALER_NAME }}:canary,${{ env.IMAGE_SCALER_NAME }}:sha-${{steps.prep.outputs.sha}} - labels: | - sh.keda.http.image.source=${{github.event.repository.html_url}} - sh.keda.http.image.created=${{steps.prep.outputs.created}} - sh.keda.http.image.revision=${{github.sha}} - file: scaler/Dockerfile - context: . - push: true - - e2e_tests: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - - - name: Helm install - uses: Azure/setup-helm@v3 - - - name: Create k8s v1.23 Kind Cluster - uses: helm/kind-action@main - with: - node_image: kindest/node:v1.23.0@sha256:49824ab1727c04e56a21a5d8372a402fcd32ea51ac96a2706a12af38934f81ac - cluster_name: http-add-on-smoke-tests-cluster - - - name: Run e2e test - run: | - ./tests/e2e-test.sh \ No newline at end of file + - name: Publish on GitHub Container Registry + run: make publish-multiarch + env: + VERSION: canary \ No newline at end of file diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index e3d00efee..99837eb41 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -4,77 +4,21 @@ on: push: tags: [ "v[0-9].[0-9].[0-9]" ] -env: - IMAGE_OPERATOR_NAME: ghcr.io/${{ github.repository_owner }}/http-add-on-operator - IMAGE_INTERCEPTOR_NAME: ghcr.io/${{ github.repository_owner }}/http-add-on-interceptor - IMAGE_SCALER_NAME: ghcr.io/${{ github.repository_owner }}/http-add-on-scaler - jobs: - build_operator: - + build: runs-on: ubuntu-20.04 - + container: ghcr.io/kedacore/build-tools:1.19.5 steps: - uses: actions/checkout@v3 - - name: Set up tags and refs - id: prep - run: | - echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ') - - - name: Get the version - id: get_version - run: | - echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v} - - - name: Set up Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to GHCR - uses: docker/login-action@v2 - with: - # Username used to log in to a Docker registry. If not set then no login will occur - username: ${{ github.repository_owner }} - # Password or personal access token used to log in to a Docker registry. If not set then no login will occur - password: ${{ secrets.GITHUB_TOKEN }} - # Server address of Docker registry. If not set then will default to Docker Hub - registry: ghcr.io - - - name: Build and push operator image - uses: docker/build-push-action@v3 - with: - # Docker repository to tag the image with - tags: ${{ env.IMAGE_OPERATOR_NAME }}:latest,${{ env.IMAGE_OPERATOR_NAME }}:${{ steps.get_version.outputs.VERSION }} - labels: | - sh.keda.http.image.source=${{github.event.repository.html_url}} - sh.keda.http.image.created=${{steps.prep.outputs.created}} - sh.keda.http.image.revision=${{github.sha}} - sh.keda.http.image.release=${{github.ref}} - build-args: "VERSION=${{ steps.prep.outputs.VERSION }}" - file: operator/Dockerfile - context: . - push: true - - build_interceptor: - - runs-on: ubuntu-20.04 - - steps: - - uses: actions/checkout@v3 - - - name: Set up tags and refs - id: prep - run: | - echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ') + - name: Register workspace path + run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - name: Get the version id: get_version run: | echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v} - - name: Set up Buildx - uses: docker/setup-buildx-action@v2 - - name: Login to GHCR uses: docker/login-action@v2 with: @@ -85,59 +29,10 @@ jobs: # Server address of Docker registry. If not set then will default to Docker Hub registry: ghcr.io - - name: Build and push interceptor image - uses: docker/build-push-action@v3 - with: - # Docker repository to tag the image with - tags: ${{ env.IMAGE_INTERCEPTOR_NAME }}:latest,${{ env.IMAGE_INTERCEPTOR_NAME }}:${{ steps.get_version.outputs.VERSION }} - labels: | - sh.keda.http.image.source=${{github.event.repository.html_url}} - sh.keda.http.image.created=${{steps.prep.outputs.created}} - sh.keda.http.image.revision=${{github.sha}} - sh.keda.http.image.release=${{github.ref}} - file: interceptor/Dockerfile - context: . - push: true - - build_scaler: - runs-on: ubuntu-20.04 - - steps: - - uses: actions/checkout@v3 - - - name: Set up tags and refs - id: prep - run: | - echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ') - - - name: Get the version - id: get_version - run: | - echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v} - - - name: Set up Buildx + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Login to GHCR - uses: docker/login-action@v2 - with: - # Username used to log in to a Docker registry. If not set then no login will occur - username: ${{ github.repository_owner }} - # Password or personal access token used to log in to a Docker registry. If not set then no login will occur - password: ${{ secrets.GITHUB_TOKEN }} - # Server address of Docker registry. If not set then will default to Docker Hub - registry: ghcr.io - - - name: Build and push scaler image - uses: docker/build-push-action@v3 - with: - # Docker repository to tag the image with - tags: ${{ env.IMAGE_SCALER_NAME }}:latest,${{ env.IMAGE_SCALER_NAME }}:${{ steps.get_version.outputs.VERSION }} - labels: | - sh.keda.http.image.source=${{github.event.repository.html_url}} - sh.keda.http.image.created=${{steps.prep.outputs.created}} - sh.keda.http.image.revision=${{github.sha}} - sh.keda.http.image.release=${{github.ref}} - file: scaler/Dockerfile - context: . - push: true + - name: Publish on GitHub Container Registry + run: make publish-multiarch + env: + VERSION: ${{ steps.get_version.outputs.VERSION }} \ No newline at end of file diff --git a/.github/workflows/e2e-tests.yaml b/.github/workflows/e2e-tests.yaml index 2b389ddfb..6c9db02bc 100644 --- a/.github/workflows/e2e-tests.yaml +++ b/.github/workflows/e2e-tests.yaml @@ -8,7 +8,7 @@ on: jobs: e2e_tests: runs-on: ubuntu-latest - name: Execute e2e test on k8s-${{ matrix.kubernetesVersion }} + name: Execute e2e test on AMD64 ${{ matrix.kubernetesVersion }} strategy: fail-fast: false matrix: @@ -22,7 +22,6 @@ jobs: kindImage: kindest/node:v1.24.4@sha256:adfaebada924a26c2c9308edd53c6e33b3d4e453782c0063dc0028bdebaddf98 - kubernetesVersion: v1.23 kindImage: kindest/node:v1.23.10@sha256:f047448af6a656fae7bc909e2fab360c18c487ef3edc93f06d78cdfd864b2d12 - steps: - name: Install prerequisites run: | @@ -40,19 +39,91 @@ jobs: uses: helm/kind-action@v1.4.0 with: node_image: ${{ matrix.kindImage }} - cluster_name: e2e-tests-cluster + cluster_name: cluster - name: Generate images and push to the cluster run: | make docker-build - kind load docker-image ghcr.io/kedacore/http-add-on-operator:${VERSION} --name e2e-tests-cluster - kind load docker-image ghcr.io/kedacore/http-add-on-interceptor:${VERSION} --name e2e-tests-cluster - kind load docker-image ghcr.io/kedacore/http-add-on-scaler:${VERSION} --name e2e-tests-cluster + kind load docker-image ghcr.io/kedacore/http-add-on-operator:${VERSION} --name cluster + kind load docker-image ghcr.io/kedacore/http-add-on-interceptor:${VERSION} --name cluster + kind load docker-image ghcr.io/kedacore/http-add-on-scaler:${VERSION} --name cluster + env: + VERSION: ${{ github.sha }} + + - name: Show Kubernetes version + run: | + kubectl version + + - name: Run e2e test + run: | + make e2e-test + env: + VERSION: ${{ github.sha }} + + arm_image_generation: + runs-on: ARM64 + name: Generate ARM64 images for e2e tests + steps: + - name: Install prerequisites + run: | + sudo apt update + sudo apt install curl make ca-certificates gcc libc-dev -y + env: + DEBIAN_FRONTEND: noninteractive + + - uses: actions/checkout@v3 + + - name: Generate images + run: | + make docker-build env: - VERSION: e2e-test + VERSION: ${{ github.sha }} + + arm_e2e_tests: + runs-on: http-add-on-e2e + needs: arm_image_generation + name: Execute e2e test on ARM64 ${{ matrix.kubernetesVersion }} + env: + KUBECONFIG: ${{ github.workspace }}/.kube/config + strategy: + fail-fast: false + matrix: + kubernetesVersion: [v1.26, v1.25, v1.24, v1.23] + include: + - kubernetesVersion: v1.26 + kindImage: kindest/node:v1.26.0@sha256:691e24bd2417609db7e589e1a479b902d2e209892a10ce375fab60a8407c7352 + - kubernetesVersion: v1.25 + kindImage: kindest/node:v1.25.0@sha256:428aaa17ec82ccde0131cb2d1ca6547d13cf5fdabcc0bbecf749baa935387cbf + - kubernetesVersion: v1.24 + kindImage: kindest/node:v1.24.4@sha256:adfaebada924a26c2c9308edd53c6e33b3d4e453782c0063dc0028bdebaddf98 + - kubernetesVersion: v1.23 + kindImage: kindest/node:v1.23.10@sha256:f047448af6a656fae7bc909e2fab360c18c487ef3edc93f06d78cdfd864b2d12 + steps: + - uses: actions/checkout@v3 + + - name: Helm install + uses: Azure/setup-helm@v3 + + - name: Create k8s ${{ matrix.kubernetesVersion }} Kind Cluster + uses: helm/kind-action@v1.4.0 + with: + node_image: ${{ matrix.kindImage }} + cluster_name: ${{ runner.name }} + + - name: Push images to the cluster + run: | + kind load docker-image ghcr.io/kedacore/http-add-on-operator:${VERSION} --name ${{ runner.name }} + kind load docker-image ghcr.io/kedacore/http-add-on-interceptor:${VERSION} --name ${{ runner.name }} + kind load docker-image ghcr.io/kedacore/http-add-on-scaler:${VERSION} --name ${{ runner.name }} + env: + VERSION: ${{ github.sha }} + + - name: Show Kubernetes version + run: | + kubectl version - name: Run e2e test run: | make e2e-test env: - VERSION: e2e-test + VERSION: ${{ github.sha }} diff --git a/.github/workflows/images.yaml b/.github/workflows/images.yaml index 887fa6f9d..dae39cb71 100644 --- a/.github/workflows/images.yaml +++ b/.github/workflows/images.yaml @@ -1,7 +1,5 @@ name: Build Images on: - push: - branches: [main] pull_request: branches: [main] diff --git a/tests/e2e-test.sh b/tests/e2e-test.sh index d1296546f..cb0b19e0f 100755 --- a/tests/e2e-test.sh +++ b/tests/e2e-test.sh @@ -13,22 +13,22 @@ function clear_resources(){ function print_logs { echo ">>> KEDA Operator log <<<" - kubectl logs -n keda -l app=keda-operator + kubectl logs -n keda -l app=keda-operator --tail 5000 printf "##############################################\n" printf "##############################################\n" echo ">>> HTTP Add-on Operator log <<<" - kubectl logs -n keda -l control-plane=controller-manager -c operator + kubectl logs -n keda -l control-plane=controller-manager -c operator --tail 5000 printf "##############################################\n" printf "##############################################\n" echo ">>> HTTP Add-on Interceptor log <<<" - kubectl logs -n keda -l control-plane=interceptor + kubectl logs -n keda -l control-plane=interceptor --tail 5000 printf "##############################################\n" printf "##############################################\n" echo ">>> HTTP Add-on Scaler log <<<" - kubectl logs -n keda -l control-plane=external-scaler + kubectl logs -n keda -l control-plane=external-scaler --tail 5000 printf "##############################################\n" printf "##############################################\n" }