2023-03-21 04:18:14 -04:00
|
|
|
name: e2e test manual
|
2022-05-03 05:15:53 -04:00
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
2023-07-17 07:45:53 -04:00
|
|
|
nodeCount:
|
|
|
|
description: "Number of nodes to use in the cluster. Given in format `<control-plane nodes>:<worker nodes>`."
|
|
|
|
default: "3:2"
|
|
|
|
type: string
|
2022-05-03 05:15:53 -04:00
|
|
|
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"
|
2023-09-15 11:21:42 -04:00
|
|
|
- "malicious join"
|
2022-10-28 09:51:43 -04:00
|
|
|
- "nop"
|
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-08-18 05:13:24 -04:00
|
|
|
default: "1.27"
|
2022-08-09 04:02:15 -04:00
|
|
|
required: true
|
2023-07-17 07:45:53 -04:00
|
|
|
cliVersion:
|
|
|
|
description: "Version of a released CLI to download. Leave empty to build the CLI from the checked out ref."
|
|
|
|
type: string
|
|
|
|
default: ""
|
|
|
|
required: false
|
|
|
|
imageVersion:
|
|
|
|
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
|
2023-08-10 06:53:40 -04:00
|
|
|
regionZone:
|
|
|
|
description: "Region or zone to create the cluster in. Leave empty for default region/zone."
|
|
|
|
type: string
|
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:
|
2023-07-17 07:45:53 -04:00
|
|
|
nodeCount:
|
|
|
|
description: "Number of nodes to use in the cluster. Given in format `<control-plane nodes>:<worker nodes>`."
|
|
|
|
default: "3:2"
|
|
|
|
type: string
|
2023-01-06 05:49:55 -05:00
|
|
|
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
|
2023-07-17 07:45:53 -04:00
|
|
|
cliVersion:
|
|
|
|
description: "Version of a released CLI to download. Leave empty to build the CLI from the checked out ref."
|
2023-01-06 05:49:55 -05:00
|
|
|
type: string
|
2023-07-17 07:45:53 -04:00
|
|
|
default: ""
|
|
|
|
required: false
|
|
|
|
imageVersion:
|
|
|
|
description: "Full name of OS image (CSP independent image version UID). Leave empty for latest debug image on main."
|
|
|
|
type: string
|
|
|
|
default: ""
|
|
|
|
required: false
|
2023-01-06 05:49:55 -05: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
|
|
|
|
required: true
|
2023-08-10 06:53:40 -04:00
|
|
|
regionZone:
|
|
|
|
description: "Region or zone to create the cluster in. Leave empty for default region/zone."
|
|
|
|
type: string
|
2023-01-06 05:49:55 -05:00
|
|
|
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-07-17 07:45:53 -04:00
|
|
|
split-nodeCount:
|
|
|
|
name: Split nodeCount
|
2023-03-31 06:41:32 -04:00
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
permissions:
|
|
|
|
id-token: write
|
|
|
|
contents: read
|
|
|
|
outputs:
|
2023-07-17 07:45:53 -04:00
|
|
|
workerNodes: ${{ steps.split-nodeCount.outputs.workerNodes }}
|
|
|
|
controlPlaneNodes: ${{ steps.split-nodeCount.outputs.controlPlaneNodes }}
|
2023-03-31 06:41:32 -04:00
|
|
|
steps:
|
2023-07-17 07:45:53 -04:00
|
|
|
- name: Split nodeCount
|
|
|
|
id: split-nodeCount
|
2023-03-31 06:41:32 -04:00
|
|
|
shell: bash
|
|
|
|
run: |
|
2023-07-17 07:45:53 -04:00
|
|
|
nodeCount="${{ inputs.nodeCount }}"
|
|
|
|
workerNodes="${nodeCount##*:}"
|
|
|
|
controlPlaneNodes="${nodeCount%%:*}"
|
|
|
|
|
|
|
|
if [[ -z "${workerNodes}" ]] || [[ -z "{controlPlaneNodes}" ]]; then
|
|
|
|
echo "Invalid nodeCount input: '${nodeCount}'."
|
|
|
|
exit 1
|
2023-03-31 06:41:32 -04:00
|
|
|
fi
|
|
|
|
|
2023-07-17 07:45:53 -04:00
|
|
|
echo "workerNodes=${workerNodes}" | tee -a "$GITHUB_OUTPUT"
|
|
|
|
echo "controlPlaneNodes=${controlPlaneNodes}" | tee -a "$GITHUB_OUTPUT"
|
2023-03-31 06:41:32 -04:00
|
|
|
|
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: |
|
2023-07-17 07:45:53 -04:00
|
|
|
if [[ -z "${{ inputs.imageVersion }}" ]]; 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-07-17 07:45:53 -04:00
|
|
|
echo "image=${{ inputs.imageVersion }}" | 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-07-17 07:45:53 -04:00
|
|
|
if: inputs.imageVersion == '' && inputs.git-ref == 'head'
|
2023-07-03 02:19:10 -04:00
|
|
|
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
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-07-17 07:45:53 -04:00
|
|
|
if: inputs.imageVersion == '' && inputs.git-ref != 'head'
|
2023-07-03 02:19:10 -04:00
|
|
|
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
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-07-17 07:45:53 -04:00
|
|
|
if: inputs.imageVersion == ''
|
2023-07-03 02:19:10 -04:00
|
|
|
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2.2.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-07-17 07:45:53 -04:00
|
|
|
if: inputs.imageVersion == ''
|
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-07-17 07:45:53 -04:00
|
|
|
case "${{ inputs.imageVersion }}" in
|
2023-01-11 08:27:18 -05:00
|
|
|
"")
|
2023-04-14 12:25:53 -04:00
|
|
|
echo "isDebugImage=true" | tee -a "$GITHUB_OUTPUT"
|
2023-01-11 08:27:18 -05:00
|
|
|
;;
|
|
|
|
*"/stream/debug/"*)
|
2023-04-14 12:25:53 -04:00
|
|
|
echo "isDebugImage=true" | tee -a "$GITHUB_OUTPUT"
|
2023-01-11 08:27:18 -05:00
|
|
|
;;
|
|
|
|
*)
|
2023-04-14 12:25:53 -04:00
|
|
|
echo "isDebugImage=false" | tee -a "$GITHUB_OUTPUT"
|
2023-01-11 08:27:18 -05:00
|
|
|
;;
|
|
|
|
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-04-04 04:16:04 -04:00
|
|
|
packages: write
|
2023-07-17 07:45:53 -04:00
|
|
|
needs: [find-latest-image, split-nodeCount]
|
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-07-03 02:19:10 -04:00
|
|
|
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
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-07-03 02:19:10 -04:00
|
|
|
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
2022-12-20 07:19:12 -05:00
|
|
|
with:
|
|
|
|
ref: ${{ inputs.git-ref }}
|
2022-09-02 06:43:04 -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-07-03 02:19:10 -04:00
|
|
|
uses: google-github-actions/setup-gcloud@e30db14379863a8c79331b04a9969f4c1e225e0b # v1.1.1
|
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-07-17 07:45:53 -04:00
|
|
|
workerNodesCount: ${{ needs.split-nodeCount.outputs.workerNodes }}
|
|
|
|
controlNodesCount: ${{ needs.split-nodeCount.outputs.controlPlaneNodes }}
|
2023-01-06 05:49:55 -05:00
|
|
|
cloudProvider: ${{ inputs.cloudProvider }}
|
|
|
|
machineType: ${{ inputs.machineType }}
|
2023-08-10 06:53:40 -04:00
|
|
|
regionZone: ${{ inputs.regionZone }}
|
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"
|
2023-06-06 06:20:09 -04:00
|
|
|
gcpIAMCreateServiceAccount: "constellation-iam-e2e@constellation-331613.iam.gserviceaccount.com"
|
2023-04-12 07:24:13 -04:00
|
|
|
gcpInClusterServiceAccountKey: ${{ secrets.GCP_CLUSTER_SERVICE_ACCOUNT }}
|
2023-01-06 05:49:55 -05:00
|
|
|
test: ${{ inputs.test }}
|
|
|
|
kubernetesVersion: ${{ inputs.kubernetesVersion }}
|
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-07-17 07:45:53 -04:00
|
|
|
cliVersion: ${{ inputs.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 }}
|
2023-04-04 04:16:04 -04:00
|
|
|
registry: ghcr.io
|
|
|
|
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
2023-08-09 12:58:46 -04:00
|
|
|
cosignPassword: ${{ secrets.COSIGN_PASSWORD }}
|
|
|
|
cosignPrivateKey: ${{ secrets.COSIGN_PRIVATE_KEY }}
|
2023-08-04 03:43:32 -04:00
|
|
|
fetchMeasurements: ${{ contains(needs.find-latest-image.outputs.image, '/stream/stable/') }}
|
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"
|
2023-04-27 08:03:49 -04:00
|
|
|
|
|
|
|
- name: Always upload Terraform logs
|
|
|
|
if: always()
|
|
|
|
uses: ./.github/actions/upload_terraform_logs
|
|
|
|
with:
|
|
|
|
artifactNameSuffix: ${{ steps.e2e_test.outputs.namePrefix }}
|