2022-05-09 03:45:59 -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
|
2022-10-21 04:16:44 -04:00
|
|
|
osImage:
|
2022-12-09 05:51:38 -05:00
|
|
|
description: "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
|
|
|
|
osImage:
|
|
|
|
description: "Full name of OS image (CSP independent image version UID). Leave empty for latest debug image on main."
|
|
|
|
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-10-14 08:49:04 -04:00
|
|
|
env:
|
2022-11-02 09:46:06 -04:00
|
|
|
ARM_CLIENT_ID: ${{ secrets.AZURE_E2E_CLIENT_ID }}
|
2022-10-14 08:49:04 -04:00
|
|
|
ARM_CLIENT_SECRET: ${{ secrets.AZURE_E2E_CLIENT_SECRET }}
|
2022-11-02 09:46:06 -04:00
|
|
|
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_E2E_SUBSCRIPTION_ID }}
|
|
|
|
ARM_TENANT_ID: ${{ secrets.AZURE_E2E_TENANT_ID }}
|
2022-10-14 08:49:04 -04:00
|
|
|
|
2022-05-03 05:15:53 -04:00
|
|
|
jobs:
|
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
|
|
|
|
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: |
|
2022-12-09 05:51:38 -05:00
|
|
|
if [[ -z "${{ inputs.osImage }}" ]]; then
|
2022-12-01 07:25:30 -05:00
|
|
|
echo "Using latest debug image from main."
|
|
|
|
else
|
|
|
|
echo "Using image '${{ inputs.osImage }}'."
|
|
|
|
echo "image=${{ inputs.osImage }}" >> "$GITHUB_OUTPUT"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2023-01-06 05:49:55 -05:00
|
|
|
- name: Checkout head
|
|
|
|
if: inputs.git-ref == 'head'
|
2023-01-05 10:17:51 -05:00
|
|
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.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
|
|
|
|
if: inputs.git-ref != 'head'
|
|
|
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
|
|
|
with:
|
|
|
|
ref: ${{ inputs.git-ref }}
|
|
|
|
|
2023-01-12 10:46:51 -05:00
|
|
|
- name: Login to AWS
|
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
|
2022-12-09 05:51:38 -05:00
|
|
|
if: steps.check-input.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: |
|
|
|
|
case "${{ inputs.osImage }}" in
|
|
|
|
"")
|
|
|
|
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-20 06:04:44 -04:00
|
|
|
needs: [find-latest-image]
|
|
|
|
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
|
|
|
|
run: brew install coreutils kubectl bash
|
|
|
|
|
2022-12-20 07:19:12 -05:00
|
|
|
- name: Checkout head
|
|
|
|
if: inputs.git-ref == 'head'
|
2023-01-05 10:17:51 -05:00
|
|
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.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-01-05 10:17:51 -05:00
|
|
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.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
|
2022-12-14 08:55:14 -05:00
|
|
|
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
|
2022-09-14 09:14:26 -04:00
|
|
|
with:
|
2023-03-08 04:05:36 -05:00
|
|
|
go-version: "1.20.2"
|
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-09-02 06:43:04 -04:00
|
|
|
- name: Login to Azure
|
2023-01-12 02:44:40 -05:00
|
|
|
if: inputs.cloudProvider == 'azure'
|
2022-11-08 10:13:10 -05:00
|
|
|
uses: ./.github/actions/login_azure
|
2022-09-02 06:43:04 -04:00
|
|
|
with:
|
|
|
|
azure_credentials: ${{ secrets.AZURE_E2E_CREDENTIALS }}
|
|
|
|
|
|
|
|
- name: Create Azure resource group
|
|
|
|
id: az_resource_group_gen
|
2023-01-12 02:44:40 -05:00
|
|
|
if: inputs.cloudProvider == 'azure'
|
2022-09-02 06:43:04 -04:00
|
|
|
shell: bash
|
|
|
|
run: |
|
2023-01-11 08:27:18 -05:00
|
|
|
uuid=$(uuidgen)
|
2022-09-02 06:43:04 -04:00
|
|
|
name=e2e-test-${uuid%%-*}
|
2022-11-11 08:49:16 -05:00
|
|
|
az group create --location westus --name "$name" --tags e2e
|
|
|
|
echo "res_group_name=$name" >> "$GITHUB_OUTPUT"
|
2022-09-02 06:43:04 -04: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-01-16 12:15:17 -05:00
|
|
|
gcp_service_account: "constellation-e2e@constellation-331613.iam.gserviceaccount.com"
|
2022-08-29 02:55:36 -04:00
|
|
|
gcpClusterServiceAccountKey: ${{ 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-11-02 10:16:47 -04:00
|
|
|
azureSubscription: ${{ secrets.AZURE_E2E_SUBSCRIPTION_ID }}
|
|
|
|
azureTenant: ${{ secrets.AZURE_E2E_TENANT_ID }}
|
|
|
|
azureClientID: ${{ secrets.AZURE_E2E_CLIENT_ID }}
|
2022-08-30 07:42:14 -04:00
|
|
|
azureClientSecret: ${{ secrets.AZURE_E2E_CLIENT_SECRET }}
|
2022-11-02 10:16:47 -04:00
|
|
|
azureUserAssignedIdentity: ${{ secrets.AZURE_E2E_USER_ASSIGNED_IDENTITY }}
|
2022-09-02 06:43:04 -04:00
|
|
|
azureResourceGroup: ${{ steps.az_resource_group_gen.outputs.res_group_name }}
|
2022-12-01 07:25:30 -05:00
|
|
|
osImage: ${{ needs.find-latest-image.outputs.image }}
|
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 }}
|
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
|
|
|
|
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 06:43:04 -04:00
|
|
|
- name: Always destroy Azure resource group
|
2023-01-12 02:44:40 -05:00
|
|
|
if: always() && inputs.cloudProvider == 'azure'
|
2022-09-02 06:43:04 -04: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 10:59:56 -04:00
|
|
|
--no-wait \
|
2022-09-02 06:43:04 -04:00
|
|
|
--yes
|