DE-53 implement smoke tests #118
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
branches: ['main'] | |
types: ['opened', 'reopened', 'synchronize'] | |
paths: | |
- 'helm/**' | |
- 'files/**' | |
- 'cmd/**' | |
- 'go.*' | |
- 'Dockerfile' | |
- 'test/**' | |
- '!helm/Chart.yaml' | |
- '!helm/README.md' | |
- '!helm/test/**' | |
- '!helm/values.*.yaml' | |
permissions: | |
contents: read | |
jobs: | |
build: | |
name: Build | |
runs-on: ${{ matrix.RUNNER }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- PLATFORM: amd64 | |
RUNNER: self-hosted-amd64-1cpu | |
- PLATFORM: arm64 | |
RUNNER: self-hosted-arm64-1cpu | |
outputs: | |
helm_args: ${{ steps.compute_helm_args.outputs.helm_args }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Build | |
run: | | |
IMAGE="wallarm/sidecar-controller" | |
make build TAG=${GITHUB_SHA} IMAGE=${IMAGE} PLATFORMS=linux/${{ matrix.PLATFORM }} BUILDX_ARGS=--load | |
docker save -o sidecar-${{ matrix.PLATFORM }}.tar ${IMAGE}:${GITHUB_SHA} | |
- name: Save artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sidecar-${{ matrix.PLATFORM }}.tar | |
path: sidecar-${{ matrix.PLATFORM }}.tar | |
retention-days: 1 | |
- name: Compute Helm arguments | |
#TODO get rid of using helm args here | |
id: compute_helm_args | |
run: | | |
HELM_ARGS="--set controller.image.tag=${GITHUB_SHA}" | |
echo "helm_args=${HELM_ARGS}" >> $GITHUB_OUTPUT | |
test: | |
name: Test | |
needs: build | |
uses: wallarm/sidecar/.github/workflows/test.yaml@DE-11 # TODO: fix, tmp, no dynamic resolving here | |
secrets: | |
VAULT_URL: ${{ secrets.VAULT_URL }} | |
VAULT_ROLE: ${{ secrets.VAULT_ROLE }} | |
with: | |
ref: ${{ github.head_ref }} | |
run_lint: true | |
run_validate: true | |
run_test: true | |
run_ct: true | |
helm_args: ${{ needs.build.outputs.helm_args }} | |
load_artifact: true | |
smoke: | |
name: Smoke | |
runs-on: ${{ matrix.RUNNER }} | |
needs: | |
- build | |
strategy: | |
fail-fast: false | |
matrix: | |
k8s: [v1.23.13, v1.27.1] | |
ARCH: [amd64, arm64] | |
include: | |
- ARCH: amd64 | |
RUNNER: self-hosted-amd64-2cpu | |
- ARCH: arm64 | |
RUNNER: self-hosted-arm64-2cpu | |
env: | |
ARCH: ${{ matrix.ARCH }} | |
KIND_CLUSTER_NAME: kind-${{ matrix.k8s }} | |
KUBECONFIG: $HOME/.kube/kind-config-${{ matrix.k8s }} | |
steps: | |
- name: Import secrets | |
uses: hashicorp/vault-action@d1720f055e0635fd932a1d2a48f87a666a57906c # v3.0.0 | |
id: secrets | |
with: | |
exportEnv: false | |
url: ${{ secrets.VAULT_URL }} | |
role: ${{ secrets.VAULT_ROLE }} | |
method: kubernetes | |
path: kubernetes-ci | |
secrets: | | |
kv-gitlab-ci/data/github/ingress api_token ; | |
kv-gitlab-ci/data/github/ingress api_host ; | |
kv-gitlab-ci/data/github/ingress api_preset ; | |
kv-gitlab-ci/data/github/ingress user_token ; | |
kv-gitlab-ci/data/github/ingress webhook_uuid ; | |
kv-gitlab-ci/data/github/ingress webhook_api_key ; | |
kv-gitlab-ci/data/github/shared/allure allure_token ; | |
kv-gitlab-ci/data/github/shared/smoke-tests-registry-creds token_name ; | |
kv-gitlab-ci/data/github/shared/smoke-tests-registry-creds token_secret ; | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# TODO do we need this? | |
# - name: Checkout | |
# uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Load cache | |
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe | |
with: | |
name: sidecar-${{ matrix.ARCH }}.tar | |
- name: Load images | |
run: docker load -i sidecar-${{ env.ARCH }}.tar | |
- name: Create cluster | |
run: kind create cluster --image=kindest/node:${{ matrix.k8s }} | |
- name: Run smoke tests | |
env: | |
SKIP_CLUSTER_CREATION: true | |
SKIP_IMAGE_CREATION: true | |
WALLARM_API_TOKEN: ${{ steps.secrets.outputs.api_token }} | |
WALLARM_API_HOST: ${{ steps.secrets.outputs.api_host }} | |
WALLARM_API_PRESET: ${{ steps.secrets.outputs.api_preset }} | |
USER_TOKEN: ${{ steps.secrets.outputs.user_token }} | |
SMOKE_REGISTRY_TOKEN: ${{ steps.secrets.outputs.token_name }} | |
SMOKE_REGISTRY_SECRET: ${{ steps.secrets.outputs.token_secret }} | |
WEBHOOK_API_KEY: ${{ steps.secrets.outputs.webhook_api_key }} | |
WEBHOOK_UUID: ${{ steps.secrets.outputs.webhook_uuid }} | |
ALLURE_UPLOAD_REPORT: true | |
ALLURE_GENERATE_REPORT: true | |
ALLURE_TOKEN: ${{ steps.secrets.outputs.allure_token }} | |
ALLURE_ENVIRONMENT_K8S: ${{ matrix.k8s }} | |
ALLURE_ENVIRONMENT_ARCH: ${{ matrix.ARCH }} | |
run: | | |
make kind-smoke-test |