2023-03-21 09:18:14 +01:00
name : e2e test manual
2022-05-03 11:15:53 +02:00
on :
workflow_dispatch :
inputs :
workerNodesCount :
2022-06-30 11:27:23 +02:00
description : "Number of worker nodes to spawn."
default : "2"
2022-05-03 11:15:53 +02:00
required : true
controlNodesCount :
2022-06-30 11:27:23 +02:00
description : "Number of control-plane nodes to spawn."
2022-09-14 14:12:42 +02:00
default : "3"
2022-05-03 11:15:53 +02:00
required : true
cloudProvider :
2022-06-30 11:27:23 +02:00
description : "Which cloud provider to use."
2022-05-03 11:15:53 +02:00
type : choice
options :
2022-06-30 11:27:23 +02:00
- "gcp"
- "azure"
2022-11-08 16:43:17 +01:00
- "aws"
2022-10-24 18:47:03 +02:00
default : "azure"
2022-05-03 11:15:53 +02:00
required : true
2023-01-11 14:27:18 +01:00
runner :
description : "Architecture of the runner that executes the CLI"
type : choice
options :
- "ubuntu-22.04"
- "macos-12"
default : "ubuntu-22.04"
2022-10-24 18:47:03 +02:00
test :
description : "The test to run."
type : choice
options :
2022-10-28 11:01:31 +02:00
- "sonobuoy quick"
2022-10-24 18:47:03 +02:00
- "sonobuoy full"
- "autoscaling"
2022-12-21 10:49:21 +01:00
- "lb"
2023-02-28 11:21:26 +01:00
- "perf-bench"
2023-01-09 08:54:41 +01:00
- "verify"
2023-01-19 10:41:07 +01:00
- "recover"
2022-10-28 15:51:43 +02:00
- "nop"
2023-02-21 12:47:14 +01:00
- "iamcreate"
2022-05-03 11:15:53 +02:00
required : true
2022-08-09 10:02:15 +02:00
kubernetesVersion :
description : "Kubernetes version to create the cluster from."
2023-02-27 10:27:06 +01:00
default : "1.25"
2022-08-09 10:02:15 +02:00
required : true
2022-12-01 15:43:40 +01:00
keepMeasurements :
description : "Keep measurements embedded in the CLI."
type : boolean
default : false
required : false
2023-03-31 12:41:32 +02:00
cliImageVersion :
description : "Version of a released CLI to download:Full name of OS image (CSP independent image version UID). Leave empty for latest debug image on main."
2022-11-23 09:41:42 +01:00
type : string
2022-12-09 11:51:38 +01:00
default : ""
required : false
2022-09-02 12:09:45 +02:00
machineType :
description : "Override VM machine type. Leave as 'default' or empty to use the default VM type for the selected cloud provider."
type : string
default : "default"
required : false
2022-12-20 13:19:12 +01:00
git-ref :
description : "Git ref to checkout."
type : string
default : "head"
required : false
2023-01-06 11:49:55 +01:00
workflow_call :
inputs :
workerNodesCount :
description : "Number of worker nodes to spawn."
type : number
required : true
controlNodesCount :
description : "Number of control-plane nodes to spawn."
type : number
required : true
cloudProvider :
description : "Which cloud provider to use."
type : string
required : true
runner :
description : "Architecture of the runner that executes the CLI"
type : string
required : true
test :
description : "The test to run."
type : string
required : true
kubernetesVersion :
description : "Kubernetes version to create the cluster from."
type : string
required : true
keepMeasurements :
description : "Keep measurements embedded in the CLI."
type : boolean
required : true
2023-03-31 12:41:32 +02:00
cliImageVersion :
description : "Version of a released CLI to download and full name of OS image (CSP independent image version UID). Leave empty for latest debug image on main. Must be in the form of 'cliVersion:image'."
2023-01-06 11:49:55 +01:00
type : string
required : true
machineType :
description : "Override VM machine type. Leave as 'default' or empty to use the default VM type for the selected cloud provider."
type : string
required : true
git-ref :
description : "Git ref to checkout."
type : string
required : true
2022-08-09 15:29:39 +02:00
2022-10-14 14:49:04 +02:00
env :
2022-11-02 14:46:06 +01:00
ARM_CLIENT_ID : ${{ secrets.AZURE_E2E_CLIENT_ID }}
2022-10-14 14:49:04 +02:00
ARM_CLIENT_SECRET : ${{ secrets.AZURE_E2E_CLIENT_SECRET }}
2022-11-02 14:46:06 +01:00
ARM_SUBSCRIPTION_ID : ${{ secrets.AZURE_E2E_SUBSCRIPTION_ID }}
ARM_TENANT_ID : ${{ secrets.AZURE_E2E_TENANT_ID }}
2022-10-14 14:49:04 +02:00
2022-05-03 11:15:53 +02:00
jobs :
2023-03-31 12:41:32 +02:00
split-cliImageVersion :
name : Split cliImageVersion
runs-on : ubuntu-22.04
permissions :
id-token : write
contents : read
outputs :
image : ${{ steps.split-cliImageVersion.outputs.image }}
cliVersion : ${{ steps.split-cliImageVersion.outputs.cliVersion }}
steps :
- name : Split cliImageVersion
id : split-cliImageVersion
shell : bash
run : |
if [[ -z "${{ inputs.cliImageVersion }}" ]]; then
echo "Using latest debug image from main."
exit 0
fi
cliImageVersion="${{ inputs.cliImageVersion }}"
image="${cliImageVersion##*:}"
cliVersion="${cliImageVersion%%:*}"
echo "image=${image}" | tee -a "$GITHUB_OUTPUT"
echo "cliVersion=${cliVersion}" | tee -a "$GITHUB_OUTPUT"
2022-12-01 13:25:30 +01:00
find-latest-image :
2022-12-09 11:51:38 +01:00
name : Select image
2022-12-01 13:25:30 +01:00
runs-on : ubuntu-22.04
2023-03-31 12:41:32 +02:00
needs : [ split-cliImageVersion]
2022-12-01 13:25:30 +01:00
permissions :
id-token : write
contents : read
outputs :
2023-01-12 16:46:51 +01:00
image : ${{ steps.find-latest-image.outputs.output }}${{ steps.check-input.outputs.image }}
2023-01-11 14:27:18 +01:00
isDebugImage : ${{ steps.isDebugImage.outputs.isDebugImage }}
2022-12-01 13:25:30 +01:00
steps :
- name : Check input
id : check-input
shell : bash
run : |
2023-03-31 12:41:32 +02:00
if [[ -z "${{ needs.split-cliImageVersion.outputs.image }}" ]]; then
2022-12-01 13:25:30 +01:00
echo "Using latest debug image from main."
exit 0
2023-03-21 09:18:14 +01:00
else
2023-03-31 12:41:32 +02:00
echo "image=${{ needs.split-cliImageVersion.outputs.image }}" | tee -a "$GITHUB_OUTPUT"
2022-12-01 13:25:30 +01:00
fi
2023-01-06 11:49:55 +01:00
- name : Checkout head
2023-03-31 12:41:32 +02:00
if : needs.split-cliImageVersion.outputs.image == '' && inputs.git-ref == 'head'
2023-04-03 16:36:43 +02:00
uses : actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
2022-12-01 13:25:30 +01:00
with :
2022-12-19 15:21:28 +01:00
ref : ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}
2022-12-01 13:25:30 +01:00
2023-01-06 11:49:55 +01:00
- name : Checkout ref
2023-03-31 12:41:32 +02:00
if : needs.split-cliImageVersion.outputs.image == '' && inputs.git-ref != 'head'
2023-04-03 16:36:43 +02:00
uses : actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
2023-01-06 11:49:55 +01:00
with :
ref : ${{ inputs.git-ref }}
2023-01-12 16:46:51 +01:00
- name : Login to AWS
2023-03-31 12:41:32 +02:00
if : needs.split-cliImageVersion.outputs.image == ''
2023-03-21 10:56:30 +01:00
uses : aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef # v2.0.0
2023-01-12 16:46:51 +01:00
with :
role-to-assume : arn:aws:iam::795746500882:role/GithubConstellationVersionsAPIRead
aws-region : eu-central-1
2022-12-01 13:25:30 +01:00
- name : Find latest image
id : find-latest-image
2023-03-31 12:41:32 +02:00
if : needs.split-cliImageVersion.outputs.image == ''
2023-01-12 16:46:51 +01:00
uses : ./.github/actions/versionsapi
2022-12-01 13:25:30 +01:00
with :
2023-01-12 16:46:51 +01:00
command : latest
2022-12-09 11:51:38 +01:00
ref : main
stream : debug
2022-12-01 13:25:30 +01:00
2023-01-11 14:27:18 +01:00
- name : Is debug image?
id : isDebugImage
shell : bash
run : |
2023-03-31 12:41:32 +02:00
case "${{ needs.split-cliImageVersion.outputs.image }}" in
2023-01-11 14:27:18 +01:00
"" )
echo "isDebugImage=true" >> "$GITHUB_OUTPUT"
echo "Image is debug image."
;;
*"/stream/debug/"*)
echo "isDebugImage=true" >> "$GITHUB_OUTPUT"
echo "Image is debug image."
;;
*)
echo "isDebugImage=false" >> "$GITHUB_OUTPUT"
echo "Image is not debug image."
;;
esac
e2e-test-manual :
runs-on : ${{ inputs.runner }}
2022-11-08 16:43:17 +01:00
permissions :
id-token : write
2023-03-17 15:36:29 +01:00
checks : write
2022-11-08 16:43:17 +01:00
contents : read
2023-03-31 12:41:32 +02:00
needs : [ find-latest-image, split-cliImageVersion]
2023-03-20 11:04:44 +01:00
if : always() && !cancelled()
2022-05-03 11:15:53 +02:00
steps :
2023-03-20 11:04:44 +01:00
- name : Install basic tools (macOS)
2023-01-11 14:27:18 +01:00
if : runner.os == 'macOS'
shell : bash
2023-03-21 11:31:55 +01:00
run : brew install coreutils kubectl bash terraform
2023-01-11 14:27:18 +01:00
2022-12-20 13:19:12 +01:00
- name : Checkout head
if : inputs.git-ref == 'head'
2023-04-03 16:36:43 +02:00
uses : actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
2022-10-24 18:47:03 +02:00
with :
2022-12-19 15:21:28 +01:00
ref : ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}
2023-01-18 10:15:58 +01:00
2022-12-20 13:19:12 +01:00
- name : Checkout ref
if : inputs.git-ref != 'head'
2023-04-03 16:36:43 +02:00
uses : actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
2022-12-20 13:19:12 +01:00
with :
ref : ${{ inputs.git-ref }}
2022-09-02 12:43:04 +02:00
2022-09-14 15:14:26 +02:00
- name : Setup Go environment
2022-12-14 14:55:14 +01:00
uses : actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
2022-09-14 15:14:26 +02:00
with :
2023-03-08 04:05:36 -05:00
go-version : "1.20.2"
2022-09-14 15:14:26 +02:00
2023-01-11 14:27:18 +01:00
- name : Set up gcloud CLI (macOS)
2023-01-12 08:44:40 +01:00
if : inputs.cloudProvider == 'gcp' && runner.os == 'macOS'
2023-02-15 14:47:42 +01:00
uses : google-github-actions/setup-gcloud@62d4898025f6041e16b1068643bfc5a696863587 # v1.1.0
2023-01-11 14:27:18 +01:00
2022-09-02 12:43:04 +02:00
- name : Login to Azure
2023-01-12 08:44:40 +01:00
if : inputs.cloudProvider == 'azure'
2022-11-08 16:13:10 +01:00
uses : ./.github/actions/login_azure
2022-09-02 12:43:04 +02:00
with :
azure_credentials : ${{ secrets.AZURE_E2E_CREDENTIALS }}
- name : Create Azure resource group
id : az_resource_group_gen
2023-01-12 08:44:40 +01:00
if : inputs.cloudProvider == 'azure'
2022-09-02 12:43:04 +02:00
shell : bash
run : |
2023-01-11 14:27:18 +01:00
uuid=$(uuidgen)
2022-09-02 12:43:04 +02:00
name=e2e-test-${uuid%%-*}
2022-11-11 14:49:16 +01:00
az group create --location westus --name "$name" --tags e2e
echo "res_group_name=$name" >> "$GITHUB_OUTPUT"
2022-09-02 12:43:04 +02:00
2022-06-30 11:27:23 +02:00
- name : Run manual E2E test
2022-11-09 10:28:34 +01:00
id : e2e_test
2022-06-30 11:27:23 +02:00
uses : ./.github/actions/e2e_test
with :
2023-01-06 11:49:55 +01:00
workerNodesCount : ${{ inputs.workerNodesCount }}
controlNodesCount : ${{ inputs.controlNodesCount }}
cloudProvider : ${{ inputs.cloudProvider }}
machineType : ${{ inputs.machineType }}
2022-11-02 15:16:47 +01:00
gcpProject : ${{ secrets.GCP_E2E_PROJECT }}
2023-01-16 18:15:17 +01:00
gcp_service_account : "constellation-e2e@constellation-331613.iam.gserviceaccount.com"
2022-08-29 08:55:36 +02:00
gcpClusterServiceAccountKey : ${{ secrets.GCP_CLUSTER_SERVICE_ACCOUNT }}
2023-01-06 11:49:55 +01:00
test : ${{ inputs.test }}
kubernetesVersion : ${{ inputs.kubernetesVersion }}
keepMeasurements : ${{ inputs.keepMeasurements }}
2023-03-01 16:46:23 +01:00
awsOpenSearchDomain : ${{ secrets.AWS_OPENSEARCH_DOMAIN }}
awsOpenSearchUsers : ${{ secrets.AWS_OPENSEARCH_USER }}
awsOpenSearchPwd : ${{ secrets.AWS_OPENSEARCH_PWD }}
2022-11-02 15:16:47 +01:00
azureSubscription : ${{ secrets.AZURE_E2E_SUBSCRIPTION_ID }}
azureTenant : ${{ secrets.AZURE_E2E_TENANT_ID }}
azureClientID : ${{ secrets.AZURE_E2E_CLIENT_ID }}
2022-08-30 13:42:14 +02:00
azureClientSecret : ${{ secrets.AZURE_E2E_CLIENT_SECRET }}
2022-11-02 15:16:47 +01:00
azureUserAssignedIdentity : ${{ secrets.AZURE_E2E_USER_ASSIGNED_IDENTITY }}
2022-09-02 12:43:04 +02:00
azureResourceGroup : ${{ steps.az_resource_group_gen.outputs.res_group_name }}
2022-12-01 13:25:30 +01:00
osImage : ${{ needs.find-latest-image.outputs.image }}
2023-03-31 12:41:32 +02:00
cliVersion : ${{ needs.split-cliImageVersion.outputs.cliVersion }}
2023-01-11 14:27:18 +01:00
isDebugImage : ${{ needs.find-latest-image.outputs.isDebugImage }}
2023-03-20 16:05:08 +01:00
buildBuddyApiKey : ${{ secrets.BUILDBUDDY_ORG_API_KEY }}
2022-09-02 12:40:22 +02:00
- name : Always terminate cluster
if : always()
uses : ./.github/actions/constellation_destroy
2022-11-09 10:28:34 +01:00
with :
kubeconfig : ${{ steps.e2e_test.outputs.kubeconfig }}
2022-09-02 12:40:22 +02:00
2023-02-21 12:47:14 +01:00
- name : Always delete IAM configuration
if : always() && inputs.test == 'iamcreate' && inputs.cloudProvider != 'azure' # skip for Azure, as the SP / MI does not have the required permissions
uses : ./.github/actions/constellation_iam_destroy
2022-09-02 12:43:04 +02:00
- name : Always destroy Azure resource group
2023-01-12 08:44:40 +01:00
if : always() && inputs.cloudProvider == 'azure'
2022-09-02 12:43:04 +02:00
shell : bash
run : |
az group delete \
--name ${{ steps.az_resource_group_gen.outputs.res_group_name }} \
--force-deletion-types Microsoft.Compute/virtualMachineScaleSets \
--force-deletion-types Microsoft.Compute/virtualMachines \
2022-09-02 16:59:56 +02:00
--no -wait \
2022-09-02 12:43:04 +02:00
--yes