2023-03-21 04:18:14 -04:00
name : e2e meta test
2022-10-24 12:47:03 -04:00
description : "This test does the infrastructure management and runs the e2e test of your choice."
2022-05-09 03:45:59 -04:00
inputs :
workerNodesCount :
2022-08-09 04:02:15 -04:00
description : "Number of worker nodes to spawn."
2022-10-24 12:47:03 -04:00
default : "2"
2022-05-09 03:45:59 -04:00
controlNodesCount :
2022-08-09 04:02:15 -04:00
description : "Number of control-plane nodes to spawn."
2022-10-24 12:47:03 -04:00
default : "3"
2022-05-09 03:45:59 -04:00
cloudProvider :
2022-08-09 04:02:15 -04:00
description : "Which cloud provider to use."
2022-05-09 03:45:59 -04:00
required : true
machineType :
2022-08-09 04:02:15 -04:00
description : "VM machine type. Make sure it matches selected cloud provider!"
2022-10-21 04:16:44 -04:00
osImage :
2022-11-23 03:41:42 -05:00
description : "OS image to run."
2022-08-09 09:29:39 -04:00
required : true
isDebugImage :
2022-10-21 04:16:44 -04:00
description : "Is OS img a debug img?"
2022-08-09 09:29:39 -04:00
required : true
2023-02-03 05:05:42 -05:00
cliVersion :
description : "Version of a released CLI to download, e.g. 'v2.3.0', leave empty to build it."
2022-09-13 10:01:47 -04:00
kubernetesVersion :
description : "Kubernetes version to create the cluster from."
2023-09-26 07:17:59 -04:00
refStream :
description : "RefStream of the image"
2023-08-10 06:53:40 -04:00
regionZone :
description : "Region or zone to use for resource creation"
required : false
2022-11-02 10:16:47 -04:00
gcpProject :
description : "The GCP project to deploy Constellation in."
2023-08-09 08:59:59 -04:00
required : true
2023-04-12 07:24:13 -04:00
gcpIAMCreateServiceAccount :
description : "Service account with permissions to create IAM configuration on GCP."
2023-08-09 08:59:59 -04:00
required : true
2023-04-12 07:24:13 -04:00
gcpClusterCreateServiceAccount :
description : "Service account with permissions to create a Constellation cluster on GCP."
2023-08-09 08:59:59 -04:00
required : true
2023-04-12 07:24:13 -04:00
gcpInClusterServiceAccountKey :
2022-08-29 02:55:36 -04:00
description : "Service account to use inside the created Constellation cluster on GCP."
2023-08-09 08:59:59 -04:00
required : true
2023-03-01 10:46:23 -05:00
awsOpenSearchDomain :
description : "AWS OpenSearch Endpoint Domain to upload the benchmark results."
awsOpenSearchUsers :
description : "AWS OpenSearch User to upload the benchmark results."
awsOpenSearchPwd :
description : "AWS OpenSearch Password to upload the benchmark results."
2023-04-12 07:24:13 -04:00
azureClusterCreateCredentials :
description : "Azure credentials authorized to create a Constellation cluster."
required : true
azureIAMCreateCredentials :
description : "Azure credentials authorized to create an IAM configuration."
required : true
2022-10-24 12:47:03 -04:00
test :
2023-09-26 07:17:59 -04:00
description : "The test to run. Can currently be one of [sonobuoy full, sonobuoy quick, autoscaling, lb, perf-bench, verify, recover, malicious join, nop, upgrade]."
2022-09-13 10:01:47 -04:00
required : true
2022-10-24 12:47:03 -04:00
sonobuoyTestSuiteCmd :
description : "The sonobuoy test suite to run."
2023-03-20 11:05:08 -04:00
buildBuddyApiKey :
description : "BuildBuddy API key for caching Bazel artifacts"
2023-04-04 04:16:04 -04:00
registry :
description : "Container registry to use"
required : true
githubToken :
description : "GitHub authorization token"
required : true
2023-08-09 12:58:46 -04:00
cosignPassword :
description : "The password for the cosign private key. Used for uploading to the config API"
cosignPrivateKey :
description : "The cosign private key. Used for uploading to the config API"
2023-08-04 03:43:32 -04:00
fetchMeasurements :
description : "Update measurements via the 'constellation config fetch-measurements' command."
2023-08-09 08:59:59 -04:00
default : "false"
2023-08-08 06:02:43 -04:00
azureSNPEnforcementPolicy :
description : "Enable security policy for the cluster."
2023-10-17 09:46:15 -04:00
internalLoadBalancer :
description : "Enable internal load balancer for the cluster."
2023-10-27 03:37:26 -04:00
selfManagedInfra :
description : "Use self-managed infrastructure instead of infrastructure created by the Constellation CLI."
default : "false"
2023-10-12 07:27:02 -04:00
s3AccessKey :
description : "Access key for s3proxy"
s3SecretKey :
description : "Secret key for s3proxy"
2023-08-07 05:02:00 -04:00
2022-11-09 04:28:34 -05:00
outputs :
kubeconfig :
description : "The kubeconfig for the cluster."
value : ${{ steps.constellation-create.outputs.kubeconfig }}
2023-04-27 08:03:49 -04:00
namePrefix :
description : "The name prefix of the cloud resources used in the e2e test."
value : ${{ steps.create-prefix.outputs.prefix }}
2023-04-28 03:26:15 -04:00
2022-05-09 03:45:59 -04:00
runs :
2022-08-09 04:02:15 -04:00
using : "composite"
2022-05-09 03:45:59 -04:00
steps :
2022-10-24 12:47:03 -04:00
- name : Check input
2023-10-12 07:27:02 -04:00
if : (!contains(fromJson('["sonobuoy full", "sonobuoy quick", "autoscaling", "perf-bench", "verify", "lb", "recover", "malicious join", "s3proxy", "nop", "upgrade"]'), inputs.test))
2022-10-24 12:47:03 -04:00
shell : bash
run : |
2023-03-21 04:18:14 -04:00
echo "::error::Invalid input for test field: ${{ inputs.test }}"
2022-10-24 12:47:03 -04:00
exit 1
2023-02-28 04:13:26 -05:00
# Perf-bench's network benchmarks require at least two distinct worker nodes.
- name : Validate perf-bench inputs
if : inputs.test == 'perf-bench'
2022-11-02 11:34:30 -04:00
shell : bash
run : |
if [[ "${{ inputs.workerNodesCount }}" -lt 2 ]]; then
2023-02-28 04:13:26 -05:00
echo "::error::Test Perf-Bench requires at least 2 worker nodes."
2022-11-02 11:34:30 -04:00
exit 1
fi
2023-08-09 12:58:46 -04:00
- name : Validate verify input
if : inputs.test == 'verify'
shell : bash
run : |
if [[ "${{ inputs.cosignPassword }}" == '' || "${{ inputs.cosignPrivateKey }}" == '' ]]; then
echo "::error::e2e test verify requires cosignPassword and cosignPrivateKey to be set."
exit 1
fi
2022-09-14 11:41:47 -04:00
- name : Determine build target
id : determine-build-target
shell : bash
run : |
2023-04-14 12:25:53 -04:00
echo "hostOS=$(go env GOOS)" | tee -a "$GITHUB_OUTPUT"
echo "hostArch=$(go env GOARCH)" | tee -a "$GITHUB_OUTPUT"
2022-09-14 11:41:47 -04:00
2023-03-20 11:05:08 -04:00
- name : Setup bazel
2023-10-04 07:55:38 -04:00
uses : ./.github/actions/setup_bazel_nix
2023-03-20 11:05:08 -04:00
with :
2023-05-22 03:22:00 -04:00
useCache : ${{ inputs.buildBuddyApiKey != '' }}
2023-03-20 11:05:08 -04:00
buildBuddyApiKey : ${{ inputs.buildBuddyApiKey }}
2023-04-21 05:05:08 -04:00
- name : Log in to the Container registry
2023-06-06 06:20:09 -04:00
uses : ./.github/actions/container_registry_login
2023-04-21 05:05:08 -04:00
with :
registry : ${{ inputs.registry }}
username : ${{ github.actor }}
password : ${{ inputs.githubToken }}
2022-08-09 04:02:15 -04:00
- name : Build CLI
2023-02-03 05:05:42 -05:00
if : inputs.cliVersion == ''
2022-08-09 04:02:15 -04:00
uses : ./.github/actions/build_cli
2022-09-14 11:41:47 -04:00
with :
targetOS : ${{ steps.determine-build-target.outputs.hostOS }}
targetArch : ${{ steps.determine-build-target.outputs.hostArch }}
2023-05-30 03:08:12 -04:00
enterpriseCLI : true
2023-03-20 11:05:08 -04:00
outputPath : "build/constellation"
2023-07-03 09:13:36 -04:00
push : ${{ inputs.cliVersion == '' }}
2022-09-14 11:41:47 -04:00
2023-03-21 04:18:14 -04:00
- name : Download CLI
2023-02-03 05:05:42 -05:00
if : inputs.cliVersion != ''
shell : bash
run : |
curl -fsSL -o constellation https://github.com/edgelesssys/constellation/releases/download/${{ inputs.cliVersion }}/constellation-linux-amd64
chmod u+x constellation
echo "$(pwd)" >> $GITHUB_PATH
export PATH="$PATH:$(pwd)"
constellation version
# Do not spam license server from pipeline
sudo sh -c 'echo "127.0.0.1 license.confidential.cloud" >> /etc/hosts'
2022-08-09 09:29:39 -04:00
- name : Build the bootstrapper
id : build-bootstrapper
2023-03-20 06:04:44 -04:00
if : inputs.isDebugImage == 'true'
2022-10-24 12:47:03 -04:00
uses : ./.github/actions/build_bootstrapper
2022-09-14 11:41:47 -04:00
2023-01-20 08:32:15 -05:00
- name : Build the upgrade-agent
id : build-upgrade-agent
2023-03-20 06:04:44 -04:00
if : inputs.isDebugImage == 'true'
2023-01-20 08:32:15 -05:00
uses : ./.github/actions/build_upgrade_agent
2022-09-14 11:41:47 -04:00
- name : Build cdbg
id : build-cdbg
if : inputs.isDebugImage == 'true'
2022-10-24 12:47:03 -04:00
uses : ./.github/actions/build_cdbg
2022-09-14 11:41:47 -04:00
with :
targetOS : ${{ steps.determine-build-target.outputs.hostOS }}
targetArch : ${{ steps.determine-build-target.outputs.hostArch }}
2022-05-09 03:45:59 -04:00
2023-04-12 07:24:13 -04:00
- name : Login to GCP (IAM service account)
2022-10-24 12:47:03 -04:00
if : inputs.cloudProvider == 'gcp'
2022-11-08 10:13:10 -05:00
uses : ./.github/actions/login_gcp
2022-08-09 04:02:15 -04:00
with :
2023-04-12 07:24:13 -04:00
service_account : ${{ inputs.gcpIAMCreateServiceAccount }}
2022-05-09 03:45:59 -04:00
2023-04-12 07:24:13 -04:00
- name : Login to AWS (IAM role)
2022-11-08 10:43:17 -05:00
if : inputs.cloudProvider == 'aws'
2023-10-26 02:18:37 -04:00
uses : aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1
2022-11-08 10:43:17 -05:00
with :
2023-04-12 07:24:13 -04:00
role-to-assume : arn:aws:iam::795746500882:role/GithubActionsE2EIAM
2022-11-08 10:43:17 -05:00
aws-region : eu-central-1
2022-11-14 08:14:42 -05:00
# extend token expiry to 6 hours to ensure constellation can terminate
role-duration-seconds : 21600
2022-11-08 10:43:17 -05:00
2023-04-12 07:24:13 -04:00
- name : Login to Azure (IAM service principal)
if : inputs.cloudProvider == 'azure'
uses : ./.github/actions/login_azure
with :
azure_credentials : ${{ inputs.azureIAMCreateCredentials }}
2023-04-13 06:02:19 -04:00
- name : Create prefix
id : create-prefix
2023-04-12 07:24:13 -04:00
shell : bash
run : |
2023-06-06 06:20:09 -04:00
uuid=$(uuidgen | tr "[:upper:]" "[:lower:]")
2023-04-15 13:24:48 -04:00
uuid=${uuid%%-*}
echo "uuid=${uuid}" | tee -a $GITHUB_OUTPUT
2023-04-13 06:02:19 -04:00
echo "prefix=e2e-${{ github.run_id }}-${{ github.run_attempt }}-${uuid}" | tee -a $GITHUB_OUTPUT
2023-04-12 07:24:13 -04:00
2023-10-20 07:38:08 -04:00
- name : Pick a random Azure region
id : pick-az-region
uses : ./.github/actions/pick_azure_region
2023-02-21 06:47:14 -05:00
- name : Create IAM configuration
id : constellation-iam-create
uses : ./.github/actions/constellation_iam_create
with :
cloudProvider : ${{ inputs.cloudProvider }}
2023-04-13 06:02:19 -04:00
namePrefix : ${{ steps.create-prefix.outputs.prefix }}
2023-08-10 06:53:40 -04:00
awsZone : ${{ inputs.regionZone || 'us-east-2c' }}
2023-10-20 07:38:08 -04:00
azureRegion : ${{ inputs.regionZone || steps.pick-az-region.outputs.region }}
2023-02-21 06:47:14 -05:00
gcpProjectID : ${{ inputs.gcpProject }}
2023-08-10 06:53:40 -04:00
gcpZone : ${{ inputs.regionZone || 'europe-west3-b' }}
2023-08-09 02:39:22 -04:00
kubernetesVersion : ${{ inputs.kubernetesVersion }}
2023-04-12 07:24:13 -04:00
- name : Login to GCP (Cluster service account)
if : inputs.cloudProvider == 'gcp'
uses : ./.github/actions/login_gcp
with :
service_account : ${{ inputs.gcpClusterCreateServiceAccount }}
- name : Login to AWS (Cluster role)
if : inputs.cloudProvider == 'aws'
2023-10-26 02:18:37 -04:00
uses : aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1
2023-04-12 07:24:13 -04:00
with :
role-to-assume : arn:aws:iam::795746500882:role/GithubActionsE2ECluster
aws-region : eu-central-1
# extend token expiry to 6 hours to ensure constellation can terminate
role-duration-seconds : 21600
- name : Login to Azure (Cluster service principal)
if : inputs.cloudProvider == 'azure'
uses : ./.github/actions/login_azure
with :
azure_credentials : ${{ inputs.azureClusterCreateCredentials }}
2023-02-21 06:47:14 -05:00
2022-08-09 04:02:15 -04:00
- name : Create cluster
2022-10-24 12:47:03 -04:00
id : constellation-create
2022-08-09 04:02:15 -04:00
uses : ./.github/actions/constellation_create
with :
cloudProvider : ${{ inputs.cloudProvider }}
workerNodesCount : ${{ inputs.workerNodesCount }}
controlNodesCount : ${{ inputs.controlNodesCount }}
machineType : ${{ inputs.machineType }}
2022-10-21 04:16:44 -04:00
osImage : ${{ inputs.osImage }}
2022-08-09 09:29:39 -04:00
isDebugImage : ${{ inputs.isDebugImage }}
2023-04-13 06:02:19 -04:00
artifactNameSuffix : ${{ steps.create-prefix.outputs.prefix }}
2023-08-04 03:43:32 -04:00
fetchMeasurements : ${{ inputs.fetchMeasurements }}
2023-08-07 05:02:00 -04:00
cliVersion : ${{ inputs.cliVersion }}
2023-08-08 06:02:43 -04:00
azureSNPEnforcementPolicy : ${{ inputs.azureSNPEnforcementPolicy }}
2023-09-27 10:17:31 -04:00
azureIAMCreateCredentials : ${{ inputs.azureIAMCreateCredentials }}
azureClusterCreateCredentials : ${{ inputs.azureClusterCreateCredentials }}
kubernetesVersion : ${{ inputs.kubernetesVersion }}
refStream : ${{ inputs.refStream }}
2023-10-17 09:46:15 -04:00
internalLoadBalancer : ${{ inputs.internalLoadBalancer }}
2023-10-27 03:37:26 -04:00
test : ${{ inputs.test }}
selfManagedInfra : ${{ inputs.selfManagedInfra }}
2022-09-02 06:43:04 -04:00
2023-09-27 10:17:31 -04:00
- name : Deploy log- and metrics-collection (Kubernetes)
2023-08-21 02:01:33 -04:00
id : deploy-logcollection
2023-09-27 10:17:31 -04:00
if : inputs.isDebugImage == 'false'
2023-08-21 02:01:33 -04:00
uses : ./.github/actions/deploy_logcollection
with :
kubeconfig : ${{ steps.constellation-create.outputs.kubeconfig }}
opensearchUser : ${{ inputs.awsOpenSearchUsers }}
opensearchPwd : ${{ inputs.awsOpenSearchPwd }}
test : ${{ inputs.test }}
provider : ${{ inputs.cloudProvider }}
isDebugImage : ${{ inputs.isDebugImage }}
2023-09-26 07:17:59 -04:00
kubernetesVersion : ${{ inputs.kubernetesVersion }}
refStream : ${{ inputs.refStream }}
2023-10-30 09:33:58 -04:00
selfManagedInfra : ${{ inputs.selfManagedInfra }}
2023-11-08 09:27:40 -05:00
2022-10-24 12:47:03 -04:00
#
# Test payloads
#
2022-10-28 09:51:43 -04:00
- name : Nop test payload
2023-09-26 07:17:59 -04:00
if : (inputs.test == 'nop') || (inputs.test == 'upgrade')
2022-10-28 09:51:43 -04:00
shell : bash
2023-09-21 04:13:59 -04:00
run : |
echo "::warning::This test has a nop payload. It doesn't run any tests."
echo "Sleeping for 30 seconds to allow logs to propagate to the log collection service."
sleep 30
2022-10-28 09:51:43 -04:00
2022-10-28 05:01:31 -04:00
- name : Run sonobuoy quick test
if : inputs.test == 'sonobuoy quick'
2022-10-25 09:39:54 -04:00
uses : ./.github/actions/e2e_sonobuoy
2022-08-09 04:02:15 -04:00
with :
2022-10-24 12:47:03 -04:00
sonobuoyTestSuiteCmd : "--mode quick"
kubeconfig : ${{ steps.constellation-create.outputs.kubeconfig }}
2023-04-13 06:02:19 -04:00
artifactNameSuffix : ${{ steps.create-prefix.outputs.prefix }}
2022-10-24 12:47:03 -04:00
- name : Run sonobuoy full test
if : inputs.test == 'sonobuoy full'
2022-10-25 09:39:54 -04:00
uses : ./.github/actions/e2e_sonobuoy
2022-10-24 12:47:03 -04:00
with :
2023-06-01 06:33:06 -04:00
# TODO(3u13r): Remove E2E_SKIP once AB#2174 is resolved
2022-10-24 12:47:03 -04:00
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 }}
2023-04-13 06:02:19 -04:00
artifactNameSuffix : ${{ steps.create-prefix.outputs.prefix }}
2022-10-24 12:47:03 -04:00
- name : Run autoscaling test
if : inputs.test == 'autoscaling'
uses : ./.github/actions/e2e_autoscaling
with :
kubeconfig : ${{ steps.constellation-create.outputs.kubeconfig }}
2022-11-01 07:23:01 -04:00
2022-12-21 04:49:21 -05:00
- name : Run lb test
if : inputs.test == 'lb'
uses : ./.github/actions/e2e_lb
with :
kubeconfig : ${{ steps.constellation-create.outputs.kubeconfig }}
2023-02-28 05:21:26 -05:00
- name : Run Performance Benchmark
if : inputs.test == 'perf-bench'
uses : ./.github/actions/e2e_benchmark
2022-11-01 07:23:01 -04:00
with :
cloudProvider : ${{ inputs.cloudProvider }}
kubeconfig : ${{ steps.constellation-create.outputs.kubeconfig }}
2023-03-01 10:46:23 -05:00
awsOpenSearchDomain : ${{ inputs.awsOpenSearchDomain }}
awsOpenSearchUsers : ${{ inputs.awsOpenSearchUsers }}
awsOpenSearchPwd : ${{ inputs.awsOpenSearchPwd }}
2023-01-09 02:54:41 -05:00
- name : Run constellation verify test
if : inputs.test == 'verify'
2023-01-17 05:28:28 -05:00
uses : ./.github/actions/e2e_verify
2023-01-09 02:54:41 -05:00
with :
cloudProvider : ${{ inputs.cloudProvider }}
2023-04-04 04:47:26 -04:00
osImage : ${{ steps.constellation-create.outputs.osImageUsed }}
2023-08-04 09:43:51 -04:00
kubeconfig : ${{ steps.constellation-create.outputs.kubeconfig }}
2023-08-09 12:58:46 -04:00
cosignPassword : ${{ inputs.cosignPassword }}
cosignPrivateKey : ${{ inputs.cosignPrivateKey }}
2023-01-19 04:41:07 -05:00
- name : Run recover test
if : inputs.test == 'recover'
uses : ./.github/actions/e2e_recover
with :
controlNodesCount : ${{ inputs.controlNodesCount }}
kubeconfig : ${{ steps.constellation-create.outputs.kubeconfig }}
masterSecret : ${{ steps.constellation-create.outputs.masterSecret }}
2023-09-15 11:21:42 -04:00
- name : Run malicious join test
if : inputs.test == 'malicious join'
uses : ./.github/actions/e2e_malicious_join
with :
cloudProvider : ${{ inputs.cloudProvider }}
kubeconfig : ${{ steps.constellation-create.outputs.kubeconfig }}
githubToken : ${{ inputs.githubToken }}
2023-10-12 07:27:02 -04:00
- name : Run s3proxy e2e test
if : inputs.test == 's3proxy'
uses : ./.github/actions/e2e_s3proxy
with :
kubeconfig : ${{ steps.constellation-create.outputs.kubeconfig }}
s3AccessKey : ${{ inputs.s3AccessKey }}
s3SecretKey : ${{ inputs.s3SecretKey }}
buildBuddyApiKey : ${{ inputs.buildBuddyApiKey }}
githubToken : ${{ inputs.githubToken }}