constellation/.github/workflows/e2e-test-manual.yml

186 lines
6.5 KiB
YAML
Raw Normal View History

name: e2e Test Manual
on:
workflow_dispatch:
inputs:
workerNodesCount:
description: "Number of worker nodes to spawn."
default: "2"
required: true
controlNodesCount:
description: "Number of control-plane nodes to spawn."
default: "3"
required: true
cloudProvider:
description: "Which cloud provider to use."
type: choice
options:
- "gcp"
- "azure"
- "aws"
default: "azure"
required: true
test:
description: "The test to run."
type: choice
options:
- "sonobuoy quick"
- "sonobuoy full"
- "autoscaling"
- "k-bench"
- "nop"
required: true
kubernetesVersion:
description: "Kubernetes version to create the cluster from."
default: "1.25"
required: true
keepMeasurements:
description: "Keep measurements embedded in the CLI."
type: boolean
default: false
required: false
osImage:
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
default: ""
required: false
isDebugImage:
description: "Is OS image a debug image?"
type: boolean
default: true
required: false
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
env:
ARM_CLIENT_ID: ${{ secrets.AZURE_E2E_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.AZURE_E2E_CLIENT_SECRET }}
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_E2E_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.AZURE_E2E_TENANT_ID }}
jobs:
find-latest-image:
name: Select image
runs-on: ubuntu-22.04
permissions:
id-token: write
contents: read
outputs:
image: ${{ steps.find-latest-image.outputs.image }}${{ steps.check-input.outputs.image }}
steps:
- name: Check input
id: check-input
shell: bash
run: |
if [[ -z "${{ inputs.osImage }}" ]]; then
echo "Using latest debug image from main."
else
echo "Using image '${{ inputs.osImage }}'."
echo "image=${{ inputs.osImage }}" >> "$GITHUB_OUTPUT"
exit 0
fi
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
with:
ref: ${{ github.head_ref }}
- name: Find latest image
id: find-latest-image
if: steps.check-input.outputs.image == ''
uses: ./.github/actions/find_latest_image
with:
ref: main
stream: debug
e2e-test-manual:
runs-on: ubuntu-22.04
permissions:
id-token: write
contents: read
needs: [find-latest-image]
steps:
- name: Check out repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0
with:
ref: ${{ github.head_ref }}
2022-09-02 06:43:04 -04:00
2022-09-14 09:14:26 -04:00
- name: Setup Go environment
uses: actions/setup-go@d0a58c1c4d2b25278816e339b944508c875f3613 # v3.4.0
2022-09-14 09:14:26 -04:00
with:
go-version: "1.19.4"
2022-09-14 09:14:26 -04:00
2022-09-02 06:43:04 -04:00
- name: Login to Azure
if: ${{ github.event.inputs.cloudProvider == 'azure' }}
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
if: ${{ github.event.inputs.cloudProvider == 'azure' }}
shell: bash
run: |
uuid=$(cat /proc/sys/kernel/random/uuid)
name=e2e-test-${uuid%%-*}
az group create --location westus --name "$name" --tags e2e
echo "res_group_name=$name" >> "$GITHUB_OUTPUT"
2022-09-02 06:43:04 -04:00
- name: Run manual E2E test
id: e2e_test
uses: ./.github/actions/e2e_test
with:
workerNodesCount: ${{ github.event.inputs.workerNodesCount }}
controlNodesCount: ${{ github.event.inputs.controlNodesCount }}
cloudProvider: ${{ github.event.inputs.cloudProvider }}
machineType: ${{ github.event.inputs.machineType }}
gcpProject: ${{ secrets.GCP_E2E_PROJECT }}
gcp_service_account_json: ${{ secrets.GCP_SERVICE_ACCOUNT }}
2022-08-29 02:55:36 -04:00
gcpClusterServiceAccountKey: ${{ secrets.GCP_CLUSTER_SERVICE_ACCOUNT }}
test: ${{ github.event.inputs.test }}
kubernetesVersion: ${{ github.event.inputs.kubernetesVersion }}
keepMeasurements: ${{ github.event.inputs.keepMeasurements }}
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 }}
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 }}
osImage: ${{ needs.find-latest-image.outputs.image }}
isDebugImage: ${{ github.event.inputs.isDebugImage }}
2022-09-02 06:40:22 -04:00
- name: Always terminate cluster
if: always()
continue-on-error: true
uses: ./.github/actions/constellation_destroy
with:
kubeconfig: ${{ steps.e2e_test.outputs.kubeconfig }}
2022-09-02 06:40:22 -04:00
- name: Notify teams channel
if: ${{ failure() && github.ref == 'refs/heads/main' }}
run: |
sudo apt-get install gettext-base -y
export TEAMS_JOB_NAME="${{ github.event.inputs.cloudProvider }} (manual)"
2022-09-02 06:40:22 -04:00
export TEAMS_RUN_ID=${{ github.run_id }}
envsubst < teams-payload.json > to-be-send.json
curl \
-H "Content-Type: application/json" \
-d @to-be-send.json \
"${{ secrets.MS_TEAMS_WEBHOOK_URI }}"
shell: bash
working-directory: .github/actions/e2e_test
2022-09-02 06:43:04 -04:00
- name: Always destroy Azure resource group
if: ${{ always() && github.event.inputs.cloudProvider == 'azure' }}
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