From 15ee041defe8cfa8379f0a45718e57c5f4db543a Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Tue, 5 Nov 2024 14:50:01 +0100 Subject: [PATCH 1/6] let smoke test provision its own cluster ifx action fix wait deploy infra to the cluster fix home location fix missing infra token fix --- .github/workflows/smoke-test.yaml | 53 +++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/.github/workflows/smoke-test.yaml b/.github/workflows/smoke-test.yaml index 4b9318798..2c9fa7965 100644 --- a/.github/workflows/smoke-test.yaml +++ b/.github/workflows/smoke-test.yaml @@ -27,8 +27,56 @@ jobs: echo "Cluster: ${{ inputs.cluster }}" echo "Prefix: ${{ inputs.prefix }}" + create-cluster: + runs-on: ubuntu-latest + outputs: + cluster-name: ${{ steps.determine-cluster-name.outputs.cluster-name }} + steps: + - name: Determine cluster name + id: determine-cluster-name + run: | + echo "cluster-name=daily-smoke-test-$(date +%s)" >> ${GITHUB_OUTPUT} + + - uses: stackrox/actions/infra/create-cluster@v1 + with: + token: ${{ secrets.INFRA_TOKEN }} + flavor: gke-default + name: ${{ steps.determine-cluster-name.outputs.cluster-name }} + lifespan: 8h + wait: true + + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} + + - name: Authenticate to GCloud + uses: google-github-actions/auth@v2 + with: + credentials_json: ${{ secrets.INFRA_CI_AUTOMATION_GCP_SA }} + + - name: Set up Cloud SDK + uses: "google-github-actions/setup-gcloud@v2" + with: + install_components: "gke-gcloud-auth-plugin" + + - name: Download production infractl + uses: stackrox/actions/infra/install-infractl@v1 + + - name: Download artifacts + env: + INFRA_TOKEN: ${{ secrets.INFRA_TOKEN }} + run: | + /home/runner/.local/bin/infractl artifacts "${{ steps.determine-cluster-name.outputs.cluster-name }}" -d /home/runner/artifacts >> "$GITHUB_STEP_SUMMARY" + + - name: Deploy infra to smoke test cluster + run: | + ENVIRONMENT=development TEST_MODE=true make install-argo clean-argo-config install-monitoring helm-deploy + smoke-test: runs-on: ubuntu-latest + needs: [create-cluster] env: KUBECONFIG: /home/runner/artifacts/kubeconfig INFRA_TOKEN_PROD: ${{ secrets.INFRA_TOKEN }} @@ -67,12 +115,12 @@ jobs: - name: Download production infractl uses: stackrox/actions/infra/install-infractl@v1 - - name: Download artifacts for cluster ${{ inputs.cluster }} + - name: Download artifacts for cluster ${{ needs.create-cluster.outputs.cluster-name }} env: INFRA_TOKEN: ${{ env.INFRA_TOKEN_PROD }} run: | set -uo pipefail - infractl artifacts "${{ inputs.cluster }}" -d "/home/runner/artifacts" >> "$GITHUB_STEP_SUMMARY" + infractl artifacts "${{ needs.create-cluster.outputs.cluster-name }}" -d "/home/runner/artifacts" >> "$GITHUB_STEP_SUMMARY" kubectl -n infra port-forward svc/infra-server-service 8443:8443 & sleep 10 @@ -87,3 +135,4 @@ jobs: endpoint: localhost:8443 insecure: true args: ${{ matrix.flavors.args }} + no-slack: true From 49091209d4edae7f0ede48bacc886df2a14763f5 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Wed, 15 Oct 2025 13:31:28 +0200 Subject: [PATCH 2/6] update and ready for run --- .github/workflows/smoke-test.yaml | 49 +++++++++++++------------------ 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/.github/workflows/smoke-test.yaml b/.github/workflows/smoke-test.yaml index 2c9fa7965..b30296e08 100644 --- a/.github/workflows/smoke-test.yaml +++ b/.github/workflows/smoke-test.yaml @@ -1,32 +1,21 @@ name: Smoke test infra flavors run-name: >- ${{ - format('Smoke testing flavors on infra cluster {0} (prefix {1})', - inputs.cluster, - inputs.prefix + format('Smoke testing flavors: prefix {0}, triggered by {1}', + inputs.prefix, + github.actor ) }} on: workflow_dispatch: inputs: - cluster: - description: Infra cluster to run smoke test on (in acs-team-temp-dev project) - required: true prefix: description: Prefix added to the clusters created for the smoke test (maximum 7 chars) default: ist required: true jobs: - debug: - runs-on: ubuntu-latest - steps: - - name: Show inputs - run: | - echo "Cluster: ${{ inputs.cluster }}" - echo "Prefix: ${{ inputs.prefix }}" - create-cluster: runs-on: ubuntu-latest outputs: @@ -35,7 +24,7 @@ jobs: - name: Determine cluster name id: determine-cluster-name run: | - echo "cluster-name=daily-smoke-test-$(date +%s)" >> ${GITHUB_OUTPUT} + echo "cluster-name=infra-smoke-test-$(date +%s)" >> "${GITHUB_OUTPUT}" - uses: stackrox/actions/infra/create-cluster@v1 with: @@ -49,7 +38,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - ref: ${{ github.event.pull_request.head.sha }} + ref: ${{ github.ref }} - name: Authenticate to GCloud uses: google-github-actions/auth@v2 @@ -85,20 +74,20 @@ jobs: strategy: matrix: flavors: [ - {name: "demo", "args": "", "uniqueness": "a"}, - {name: "aks", "args": "", "uniqueness": "b"}, - {name: "aro", "args": "", "uniqueness": "c"}, - {name: "eks", "args": "user-arns=arn:aws:iam::393282794030:user/joey@stackrox.com", "uniqueness": "d"}, + # {name: "demo", "args": "", "uniqueness": "a"}, + # {name: "aks", "args": "", "uniqueness": "b"}, + # {name: "aro", "args": "", "uniqueness": "c"}, + # {name: "eks", "args": "user-arns=arn:aws:iam::393282794030:user/joey@stackrox.com", "uniqueness": "d"}, {name: "gke", "args": "", "uniqueness": "e"}, - {name: "ibmroks", "args": "", "uniqueness": "f"}, - {name: "ocp-4", "args": "", "uniqueness": "g"}, - {name: "ocp-4-demo", "args": "", "uniqueness": "h"}, - {name: "ocp-4-perf-scale", "args": "", "uniqueness": "i"}, - {name: "osd-on-aws", "args": "", "uniqueness": "k"}, - {name: "osd-on-gcp", "args": "", "uniqueness": "l"}, - {name: "qa-demo", "args": "main-image=quay.io/rhacs-eng/main:4.7.0", "uniqueness": "m"}, - {name: "rosa", "args": "", "uniqueness": "n"}, - {name: "rosahcp", "args": "", "uniqueness": "o"}, + # {name: "ibmroks", "args": "", "uniqueness": "f"}, + # {name: "ocp-4", "args": "", "uniqueness": "g"}, + # {name: "ocp-4-demo", "args": "", "uniqueness": "h"}, + # {name: "ocp-4-perf-scale", "args": "", "uniqueness": "i"}, + # {name: "osd-on-aws", "args": "", "uniqueness": "k"}, + # {name: "osd-on-gcp", "args": "", "uniqueness": "l"}, + # {name: "qa-demo", "args": "main-image=quay.io/rhacs-eng/main:4.7.0", "uniqueness": "m"}, + # {name: "rosa", "args": "", "uniqueness": "n"}, + # {name: "rosahcp", "args": "", "uniqueness": "o"}, ] fail-fast: false steps: @@ -136,3 +125,5 @@ jobs: insecure: true args: ${{ matrix.flavors.args }} no-slack: true + + # TODO: Destroy infra cluster for ${{ matrix.flavors.name }} From 2d5da7d51227dde81f72e40c0f132bcffd98bb42 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Wed, 15 Oct 2025 13:47:08 +0200 Subject: [PATCH 3/6] fix infra deployment --- .github/workflows/smoke-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/smoke-test.yaml b/.github/workflows/smoke-test.yaml index b30296e08..6041885d2 100644 --- a/.github/workflows/smoke-test.yaml +++ b/.github/workflows/smoke-test.yaml @@ -61,7 +61,7 @@ jobs: - name: Deploy infra to smoke test cluster run: | - ENVIRONMENT=development TEST_MODE=true make install-argo clean-argo-config install-monitoring helm-deploy + ENVIRONMENT=development TEST_MODE=true make helm-deploy smoke-test: runs-on: ubuntu-latest From 6a4bad8276e10b96dd19bf7a2ccea899324a5d3f Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Wed, 15 Oct 2025 14:01:54 +0200 Subject: [PATCH 4/6] fix KUBECONFIG env var --- .github/workflows/smoke-test.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/smoke-test.yaml b/.github/workflows/smoke-test.yaml index 6041885d2..d9eb90eb9 100644 --- a/.github/workflows/smoke-test.yaml +++ b/.github/workflows/smoke-test.yaml @@ -15,6 +15,9 @@ on: default: ist required: true +env: + KUBECONFIG: /home/runner/artifacts/kubeconfig + jobs: create-cluster: runs-on: ubuntu-latest @@ -58,6 +61,7 @@ jobs: INFRA_TOKEN: ${{ secrets.INFRA_TOKEN }} run: | /home/runner/.local/bin/infractl artifacts "${{ steps.determine-cluster-name.outputs.cluster-name }}" -d /home/runner/artifacts >> "$GITHUB_STEP_SUMMARY" + kubectl get nodes -o wide - name: Deploy infra to smoke test cluster run: | @@ -67,7 +71,6 @@ jobs: runs-on: ubuntu-latest needs: [create-cluster] env: - KUBECONFIG: /home/runner/artifacts/kubeconfig INFRA_TOKEN_PROD: ${{ secrets.INFRA_TOKEN }} INFRA_TOKEN_DEV: ${{ secrets.INFRA_TOKEN_DEV }} USE_GKE_GCLOUD_AUTH_PLUGIN: "True" From 15f5559e4cada93eadf9b93487c4877fa05080c5 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Wed, 15 Oct 2025 14:22:06 +0200 Subject: [PATCH 5/6] block by waiting for image to appear --- .github/workflows/smoke-test.yaml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/smoke-test.yaml b/.github/workflows/smoke-test.yaml index d9eb90eb9..7c8dfd173 100644 --- a/.github/workflows/smoke-test.yaml +++ b/.github/workflows/smoke-test.yaml @@ -61,7 +61,18 @@ jobs: INFRA_TOKEN: ${{ secrets.INFRA_TOKEN }} run: | /home/runner/.local/bin/infractl artifacts "${{ steps.determine-cluster-name.outputs.cluster-name }}" -d /home/runner/artifacts >> "$GITHUB_STEP_SUMMARY" - kubectl get nodes -o wide + + - name: Determine tag + id: tag + run: | + echo "tag=$(make tag)" >> "$GITHUB_OUTPUT" + + - name: Wait for image + uses: stackrox/actions/release/wait-for-image@v1 + with: + token: ${{ secrets.QUAY_RHACS_ENG_BEARER_TOKEN }} + image: rhacs-eng/infra-server:${{ steps.tag.outputs.tag }} + limit: 1800 - name: Deploy infra to smoke test cluster run: | From 420a6b9e1e22d80fc9ba4fd501bea6bc051bd4c3 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Wed, 15 Oct 2025 15:02:24 +0200 Subject: [PATCH 6/6] enable all smoke tests --- .github/workflows/smoke-test.yaml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/smoke-test.yaml b/.github/workflows/smoke-test.yaml index 7c8dfd173..90a6af737 100644 --- a/.github/workflows/smoke-test.yaml +++ b/.github/workflows/smoke-test.yaml @@ -88,20 +88,20 @@ jobs: strategy: matrix: flavors: [ - # {name: "demo", "args": "", "uniqueness": "a"}, - # {name: "aks", "args": "", "uniqueness": "b"}, - # {name: "aro", "args": "", "uniqueness": "c"}, - # {name: "eks", "args": "user-arns=arn:aws:iam::393282794030:user/joey@stackrox.com", "uniqueness": "d"}, + {name: "demo", "args": "", "uniqueness": "a"}, + {name: "aks", "args": "", "uniqueness": "b"}, + {name: "aro", "args": "", "uniqueness": "c"}, + {name: "eks", "args": "user-arns=arn:aws:iam::393282794030:user/joey@stackrox.com", "uniqueness": "d"}, {name: "gke", "args": "", "uniqueness": "e"}, - # {name: "ibmroks", "args": "", "uniqueness": "f"}, - # {name: "ocp-4", "args": "", "uniqueness": "g"}, - # {name: "ocp-4-demo", "args": "", "uniqueness": "h"}, - # {name: "ocp-4-perf-scale", "args": "", "uniqueness": "i"}, - # {name: "osd-on-aws", "args": "", "uniqueness": "k"}, - # {name: "osd-on-gcp", "args": "", "uniqueness": "l"}, - # {name: "qa-demo", "args": "main-image=quay.io/rhacs-eng/main:4.7.0", "uniqueness": "m"}, - # {name: "rosa", "args": "", "uniqueness": "n"}, - # {name: "rosahcp", "args": "", "uniqueness": "o"}, + {name: "ibmroks", "args": "", "uniqueness": "f"}, + {name: "ocp-4", "args": "", "uniqueness": "g"}, + {name: "ocp-4-demo", "args": "", "uniqueness": "h"}, + {name: "ocp-4-perf-scale", "args": "", "uniqueness": "i"}, + {name: "osd-on-aws", "args": "", "uniqueness": "k"}, + {name: "osd-on-gcp", "args": "", "uniqueness": "l"}, + {name: "qa-demo", "args": "main-image=quay.io/rhacs-eng/main:4.7.0", "uniqueness": "m"}, + {name: "rosa", "args": "", "uniqueness": "n"}, + {name: "rosahcp", "args": "", "uniqueness": "o"}, ] fail-fast: false steps: