2023-03-21 04:18:14 -04:00
name : e2e test manual
2022-05-03 05:15:53 -04:00
on :
workflow_dispatch :
inputs :
workerNodesCount :
2022-06-30 05:27:23 -04:00
description : "Number of worker nodes to spawn."
default : "2"
2022-05-03 05:15:53 -04:00
required : true
controlNodesCount :
2022-06-30 05:27:23 -04:00
description : "Number of control-plane nodes to spawn."
2022-09-14 08:12:42 -04:00
default : "3"
2022-05-03 05:15:53 -04:00
required : true
cloudProvider :
2022-06-30 05:27:23 -04:00
description : "Which cloud provider to use."
2022-05-03 05:15:53 -04:00
type : choice
options :
2022-06-30 05:27:23 -04:00
- "gcp"
- "azure"
2022-11-08 10:43:17 -05:00
- "aws"
2022-10-24 12:47:03 -04:00
default : "azure"
2022-05-03 05:15:53 -04:00
required : true
2023-01-11 08:27:18 -05: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 12:47:03 -04:00
test :
description : "The test to run."
type : choice
options :
2022-10-28 05:01:31 -04:00
- "sonobuoy quick"
2022-10-24 12:47:03 -04:00
- "sonobuoy full"
- "autoscaling"
2022-12-21 04:49:21 -05:00
- "lb"
2023-02-28 05:21:26 -05:00
- "perf-bench"
2023-01-09 02:54:41 -05:00
- "verify"
2023-01-19 04:41:07 -05:00
- "recover"
2022-10-28 09:51:43 -04:00
- "nop"
2023-02-21 06:47:14 -05:00
- "iamcreate"
2022-05-03 05:15:53 -04:00
required : true
2022-08-09 04:02:15 -04:00
kubernetesVersion :
description : "Kubernetes version to create the cluster from."
2023-02-27 04:27:06 -05:00
default : "1.25"
2022-08-09 04:02:15 -04:00
required : true
2022-12-01 09:43:40 -05:00
keepMeasurements :
description : "Keep measurements embedded in the CLI."
type : boolean
default : false
required : false
2023-03-31 06:41:32 -04: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 03:41:42 -05:00
type : string
2022-12-09 05:51:38 -05:00
default : ""
required : false
2022-09-02 06:09:45 -04: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 07:19:12 -05:00
git-ref :
description : "Git ref to checkout."
type : string
default : "head"
required : false
2023-01-06 05:49:55 -05: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 06:41:32 -04: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 05:49:55 -05: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 09:29:39 -04:00
2022-05-03 05:15:53 -04:00
jobs :
2023-03-31 06:41:32 -04: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 07:25:30 -05:00
find-latest-image :
2022-12-09 05:51:38 -05:00
name : Select image
2022-12-01 07:25:30 -05:00
runs-on : ubuntu-22.04
2023-03-31 06:41:32 -04:00
needs : [ split-cliImageVersion]
2022-12-01 07:25:30 -05:00
permissions :
id-token : write
contents : read
outputs :
2023-01-12 10:46:51 -05:00
image : ${{ steps.find-latest-image.outputs.output }}${{ steps.check-input.outputs.image }}
2023-01-11 08:27:18 -05:00
isDebugImage : ${{ steps.isDebugImage.outputs.isDebugImage }}
2022-12-01 07:25:30 -05:00
steps :
- name : Check input
id : check-input
shell : bash
run : |
2023-03-31 06:41:32 -04:00
if [[ -z "${{ needs.split-cliImageVersion.outputs.image }}" ]]; then
2022-12-01 07:25:30 -05:00
echo "Using latest debug image from main."
exit 0
2023-03-21 04:18:14 -04:00
else
2023-03-31 06:41:32 -04:00
echo "image=${{ needs.split-cliImageVersion.outputs.image }}" | tee -a "$GITHUB_OUTPUT"
2022-12-01 07:25:30 -05:00
fi
2023-01-06 05:49:55 -05:00
- name : Checkout head
2023-03-31 06:41:32 -04:00
if : needs.split-cliImageVersion.outputs.image == '' && inputs.git-ref == 'head'
2023-04-03 10:36:43 -04:00
uses : actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
2022-12-01 07:25:30 -05:00
with :
2022-12-19 09:21:28 -05:00
ref : ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}
2022-12-01 07:25:30 -05:00
2023-01-06 05:49:55 -05:00
- name : Checkout ref
2023-03-31 06:41:32 -04:00
if : needs.split-cliImageVersion.outputs.image == '' && inputs.git-ref != 'head'
2023-04-03 10:36:43 -04:00
uses : actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
2023-01-06 05:49:55 -05:00
with :
ref : ${{ inputs.git-ref }}
2023-01-12 10:46:51 -05:00
- name : Login to AWS
2023-03-31 06:41:32 -04:00
if : needs.split-cliImageVersion.outputs.image == ''
2023-03-21 05:56:30 -04:00
uses : aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef # v2.0.0
2023-01-12 10:46:51 -05:00
with :
role-to-assume : arn:aws:iam::795746500882:role/GithubConstellationVersionsAPIRead
aws-region : eu-central-1
2022-12-01 07:25:30 -05:00
- name : Find latest image
id : find-latest-image
2023-03-31 06:41:32 -04:00
if : needs.split-cliImageVersion.outputs.image == ''
2023-01-12 10:46:51 -05:00
uses : ./.github/actions/versionsapi
2022-12-01 07:25:30 -05:00
with :
2023-01-12 10:46:51 -05:00
command : latest
2022-12-09 05:51:38 -05:00
ref : main
stream : debug
2022-12-01 07:25:30 -05:00
2023-01-11 08:27:18 -05:00
- name : Is debug image?
id : isDebugImage
shell : bash
run : |
2023-03-31 06:41:32 -04:00
case "${{ needs.split-cliImageVersion.outputs.image }}" in
2023-01-11 08:27:18 -05: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 10:43:17 -05:00
permissions :
id-token : write
2023-03-17 10:36:29 -04:00
checks : write
2022-11-08 10:43:17 -05:00
contents : read
2023-03-31 06:41:32 -04:00
needs : [ find-latest-image, split-cliImageVersion]
2023-03-20 06:04:44 -04:00
if : always() && !cancelled()
2022-05-03 05:15:53 -04:00
steps :
2023-03-20 06:04:44 -04:00
- name : Install basic tools (macOS)
2023-01-11 08:27:18 -05:00
if : runner.os == 'macOS'
shell : bash
2023-03-21 06:31:55 -04:00
run : brew install coreutils kubectl bash terraform
2023-01-11 08:27:18 -05:00
2022-12-20 07:19:12 -05:00
- name : Checkout head
if : inputs.git-ref == 'head'
2023-04-03 10:36:43 -04:00
uses : actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
2022-10-24 12:47:03 -04:00
with :
2022-12-19 09:21:28 -05:00
ref : ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}
2023-01-18 04:15:58 -05:00
2022-12-20 07:19:12 -05:00
- name : Checkout ref
if : inputs.git-ref != 'head'
2023-04-03 10:36:43 -04:00
uses : actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
2022-12-20 07:19:12 -05:00
with :
ref : ${{ inputs.git-ref }}
2022-09-02 06:43:04 -04:00
2022-09-14 09:14:26 -04:00
- name : Setup Go environment
2023-04-04 05:06:30 -04:00
uses : actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
2022-09-14 09:14:26 -04:00
with :
2023-04-06 10:36:07 -04:00
go-version : "1.20.3"
2022-09-14 09:14:26 -04:00
2023-01-11 08:27:18 -05:00
- name : Set up gcloud CLI (macOS)
2023-01-12 02:44:40 -05:00
if : inputs.cloudProvider == 'gcp' && runner.os == 'macOS'
2023-02-15 08:47:42 -05:00
uses : google-github-actions/setup-gcloud@62d4898025f6041e16b1068643bfc5a696863587 # v1.1.0
2023-01-11 08:27:18 -05:00
2022-06-30 05:27:23 -04:00
- name : Run manual E2E test
2022-11-09 04:28:34 -05:00
id : e2e_test
2022-06-30 05:27:23 -04:00
uses : ./.github/actions/e2e_test
with :
2023-01-06 05:49:55 -05:00
workerNodesCount : ${{ inputs.workerNodesCount }}
controlNodesCount : ${{ inputs.controlNodesCount }}
cloudProvider : ${{ inputs.cloudProvider }}
machineType : ${{ inputs.machineType }}
2022-11-02 10:16:47 -04:00
gcpProject : ${{ secrets.GCP_E2E_PROJECT }}
2023-04-12 07:24:13 -04:00
gcpClusterCreateServiceAccount : "constellation-e2e-cluster@constellation-331613.iam.gserviceaccount.com"
gcpIAMCreateServiceAccount : " constellation-iam-e2e@constellation-331613.iam.gserviceaccount.com"
gcpInClusterServiceAccountKey : ${{ secrets.GCP_CLUSTER_SERVICE_ACCOUNT }}
2023-01-06 05:49:55 -05:00
test : ${{ inputs.test }}
kubernetesVersion : ${{ inputs.kubernetesVersion }}
keepMeasurements : ${{ inputs.keepMeasurements }}
2023-03-01 10:46:23 -05:00
awsOpenSearchDomain : ${{ secrets.AWS_OPENSEARCH_DOMAIN }}
awsOpenSearchUsers : ${{ secrets.AWS_OPENSEARCH_USER }}
awsOpenSearchPwd : ${{ secrets.AWS_OPENSEARCH_PWD }}
2022-12-01 07:25:30 -05:00
osImage : ${{ needs.find-latest-image.outputs.image }}
2023-03-31 06:41:32 -04:00
cliVersion : ${{ needs.split-cliImageVersion.outputs.cliVersion }}
2023-01-11 08:27:18 -05:00
isDebugImage : ${{ needs.find-latest-image.outputs.isDebugImage }}
2023-03-20 11:05:08 -04:00
buildBuddyApiKey : ${{ secrets.BUILDBUDDY_ORG_API_KEY }}
2023-04-12 07:24:13 -04:00
azureClusterCreateCredentials : ${{ secrets.AZURE_E2E_CLUSTER_CREDENTIALS }}
azureIAMCreateCredentials : ${{ secrets.AZURE_E2E_IAM_CREDENTIALS }}
2022-09-02 06:40:22 -04:00
- name : Always terminate cluster
if : always()
uses : ./.github/actions/constellation_destroy
2022-11-09 04:28:34 -05:00
with :
kubeconfig : ${{ steps.e2e_test.outputs.kubeconfig }}
2022-09-02 06:40:22 -04:00
2023-02-21 06:47:14 -05:00
- name : Always delete IAM configuration
2023-04-12 07:24:13 -04:00
if : always()
2023-02-21 06:47:14 -05:00
uses : ./.github/actions/constellation_iam_destroy
2023-04-12 07:24:13 -04:00
with :
cloudProvider : ${{ inputs.cloudProvider }}
azureCredentials : ${{ secrets.AZURE_E2E_IAM_CREDENTIALS }}
gcpServiceAccount : "constellation-iam-e2e@constellation-331613.iam.gserviceaccount.com"