constellation/.github/actions/e2e_test/action.yml
Christoph Meyer f4ff473677 AB#2191 Add K-Bench CI step to manual workflow
Add the option to run K-Bench performance to the manual CI workflow
Install CSI drivers in the cluster for K-Bench benchmarks
Attach the results to the workflow in the GitHub Actions view
2022-11-01 12:27:25 +01:00

152 lines
5.7 KiB
YAML

name: E2E meta test
description: "This test does the infrastructure management and runs the e2e test of your choice."
inputs:
workerNodesCount:
description: "Number of worker nodes to spawn."
required: false
default: "2"
controlNodesCount:
description: "Number of control-plane nodes to spawn."
required: false
default: "3"
cloudProvider:
description: "Which cloud provider to use."
required: true
machineType:
description: "VM machine type. Make sure it matches selected cloud provider!"
required: false
osImage:
description: "OS image to run. The default value 'debug-latest' will select the latest available debug image."
default: "debug-latest"
required: true
isDebugImage:
description: "Is OS img a debug img?"
default: "true"
required: true
kubernetesVersion:
description: "Kubernetes version to create the cluster from."
required: false
gcp_service_account_json:
description: "Service account with permissions to create Constellation on GCP."
required: false
gcpClusterServiceAccountKey:
description: "Service account to use inside the created Constellation cluster on GCP."
required: false
azureClientSecret:
description: "The client secret value of the used secret"
required: false
azureResourceGroup:
description: "The resource group to use"
required: false
test:
description: "The test to run. Can currently be one of [sonobuoy full, sonobuoy quick, autoscaling, k-bench, nop]."
required: true
sonobuoyTestSuiteCmd:
description: "The sonobuoy test suite to run."
required: false
runs:
using: "composite"
steps:
- name: Check input
if: ${{ !contains(fromJson('["sonobuoy full", "sonobuoy quick", "autoscaling", "k-bench", "nop"]'), inputs.test) }}
shell: bash
run: |
echo "Invalid input for test field: ${{ inputs.test }}"
exit 1
- name: Determine build target
id: determine-build-target
shell: bash
run: |
echo "hostOS=$(go env GOOS)" >> $GITHUB_OUTPUT
echo "hostArch=$(go env GOARCH)" >> $GITHUB_OUTPUT
- name: Build CLI
uses: ./.github/actions/build_cli
with:
targetOS: ${{ steps.determine-build-target.outputs.hostOS }}
targetArch: ${{ steps.determine-build-target.outputs.hostArch }}
# macOS runners don't have Docker preinstalled, so they cannot build the bootstrapper.
# But we can use a Linux runner to build it and store/retrieve it from the action cache.
- name: Download the bootstrapper from cache
id: download-bootstrapper-cache
if: inputs.isDebugImage == 'true' && runner.os == 'macOS'
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # tag=v3.0.11
with:
key: bootstrapper-${{ github.sha }}
path: "build/bootstrapper"
- name: Build the bootstrapper
id: build-bootstrapper
if: inputs.isDebugImage == 'true' && runner.os != 'macOS'
uses: ./.github/actions/build_bootstrapper
- name: Build cdbg
id: build-cdbg
if: inputs.isDebugImage == 'true'
uses: ./.github/actions/build_cdbg
with:
targetOS: ${{ steps.determine-build-target.outputs.hostOS }}
targetArch: ${{ steps.determine-build-target.outputs.hostArch }}
- name: Login to GCP
if: inputs.cloudProvider == 'gcp'
uses: ./.github/actions/gcp_login
with:
gcp_service_account_json: ${{ inputs.gcp_service_account_json }}
- name: Create cluster
id: constellation-create
uses: ./.github/actions/constellation_create
with:
cloudProvider: ${{ inputs.cloudProvider }}
gcpClusterServiceAccountKey: ${{ inputs.gcpClusterServiceAccountKey }}
workerNodesCount: ${{ inputs.workerNodesCount }}
controlNodesCount: ${{ inputs.controlNodesCount }}
machineType: ${{ inputs.machineType }}
osImage: ${{ inputs.osImage }}
isDebugImage: ${{ inputs.isDebugImage }}
kubernetesVersion: ${{ inputs.kubernetesVersion }}
azureClientSecret: ${{ inputs.azureClientSecret }}
azureResourceGroup: ${{ inputs.azureResourceGroup }}
#
# Test payloads
#
- name: Nop test payload
if: inputs.test == 'nop'
shell: bash
run: echo "::warning::This test has a nop payload. It doesn't run any tests."
- name: Run sonobuoy quick test
if: inputs.test == 'sonobuoy quick'
uses: ./.github/actions/e2e_sonobuoy
with:
sonobuoyTestSuiteCmd: "--mode quick"
kubeconfig: ${{ steps.constellation-create.outputs.kubeconfig }}
- name: Run sonobuoy full test
if: inputs.test == 'sonobuoy full'
uses: ./.github/actions/e2e_sonobuoy
with:
# TODO: Remove E2E_SKIP once AB#2174 is resolved
sonobuoyTestSuiteCmd: '--plugin e2e --plugin-env e2e.E2E_FOCUS="\[Conformance\]" --plugin-env e2e.E2E_SKIP="for service with type clusterIP|HostPort validates that there is no conflict between pods with same hostPort but different hostIP and protocol" --plugin https://raw.githubusercontent.com/vmware-tanzu/sonobuoy-plugins/master/cis-benchmarks/kube-bench-plugin.yaml --plugin https://raw.githubusercontent.com/vmware-tanzu/sonobuoy-plugins/master/cis-benchmarks/kube-bench-master-plugin.yaml'
kubeconfig: ${{ steps.constellation-create.outputs.kubeconfig }}
- name: Run autoscaling test
if: inputs.test == 'autoscaling'
uses: ./.github/actions/e2e_autoscaling
with:
kubeconfig: ${{ steps.constellation-create.outputs.kubeconfig }}
- name: Run K-Bench
if: inputs.test == 'k-bench'
uses: ./.github/actions/k-bench
with:
cloudProvider: ${{ inputs.cloudProvider }}
kubeconfig: ${{ steps.constellation-create.outputs.kubeconfig }}