mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-25 07:29:38 -05:00
ci: join macos with normal tests (#933)
Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
parent
b89a30130f
commit
c1e776a1a2
224
.github/workflows/e2e-test-manual-macos.yml
vendored
224
.github/workflows/e2e-test-manual-macos.yml
vendored
@ -1,224 +0,0 @@
|
||||
name: e2e Test Manual (macOS CLI)
|
||||
|
||||
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"
|
||||
- "lb"
|
||||
- "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."
|
||||
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:
|
||||
build-bootstrapper-linux:
|
||||
name: "Build bootstrapper (debug image)"
|
||||
runs-on: ubuntu-22.04
|
||||
if: ${{ github.event.inputs.isDebugImage == 'true' }}
|
||||
steps:
|
||||
- name: Setup Go environment
|
||||
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
|
||||
if: ${{ github.event.steps.check-bootstrapper-cache.cache-hit != 'true'}}
|
||||
with:
|
||||
go-version: "1.19.4"
|
||||
|
||||
- name: Check out repository
|
||||
if: ${{ github.event.steps.check-bootstrapper-cache.cache-hit != 'true'}}
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
with:
|
||||
ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}
|
||||
|
||||
- name: Build bootstrapper
|
||||
if: ${{ github.event.steps.check-bootstrapper-cache.cache-hit != 'true'}}
|
||||
uses: ./.github/actions/build_bootstrapper
|
||||
|
||||
- name: Upload bootstrapper to cache
|
||||
if: ${{ github.event.steps.check-bootstrapper-cache.cache-hit != 'true'}}
|
||||
uses: actions/cache@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3
|
||||
with:
|
||||
key: bootstrapper-${{ github.sha }}
|
||||
path: "build/bootstrapper"
|
||||
|
||||
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@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
with:
|
||||
ref: ${{ !github.event.pull_request.head.repo.fork && 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-darwin:
|
||||
name: "e2e Test Manual (macOS)"
|
||||
runs-on: macos-12
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
needs: [build-bootstrapper-linux, find-latest-image]
|
||||
if: ${{ always() && !cancelled() && (needs.build-bootstrapper-linux.result == 'success' || needs.build-bootstrapper-linux.result == 'skipped') }}
|
||||
steps:
|
||||
- name: Install the basics
|
||||
shell: bash
|
||||
run: brew install coreutils kubectl bash
|
||||
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
with:
|
||||
ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}
|
||||
|
||||
- name: Setup Go environment
|
||||
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
|
||||
with:
|
||||
go-version: "1.19.4"
|
||||
|
||||
- name: Login to Azure
|
||||
if: ${{ github.event.inputs.cloudProvider == 'azure' }}
|
||||
uses: ./.github/actions/login_azure
|
||||
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=$(uuidgen)
|
||||
name=e2e-test-${uuid%%-*}
|
||||
az group create --location westus --name "$name" --tags e2e
|
||||
echo "res_group_name=$name" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Set up gcloud CLI
|
||||
if: ${{ github.event.inputs.cloudProvider == 'gcp' }}
|
||||
uses: google-github-actions/setup-gcloud@d51b5346f85640ec2aa2fa057354d2b82c2fcbce # v1.0.1
|
||||
|
||||
- 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 }}
|
||||
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 }}
|
||||
azureClientSecret: ${{ secrets.AZURE_E2E_CLIENT_SECRET }}
|
||||
azureUserAssignedIdentity: ${{ secrets.AZURE_E2E_USER_ASSIGNED_IDENTITY }}
|
||||
azureResourceGroup: ${{ steps.az_resource_group_gen.outputs.res_group_name }}
|
||||
osImage: ${{ needs.find-latest-image.outputs.image }}
|
||||
isDebugImage: ${{ github.event.inputs.isDebugImage }}
|
||||
|
||||
- name: Always terminate cluster
|
||||
if: always()
|
||||
continue-on-error: true
|
||||
uses: ./.github/actions/constellation_destroy
|
||||
with:
|
||||
kubeconfig: ${{ steps.e2e_test.outputs.kubeconfig }}
|
||||
|
||||
- name: Notify teams channel
|
||||
if: ${{ failure() && github.ref == 'refs/heads/main' }}
|
||||
run: |
|
||||
brew install gettext && brew link --force gettext
|
||||
export TEAMS_JOB_NAME="${{ github.event.inputs.cloudProvider }} (macOS, manual)"
|
||||
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
|
||||
|
||||
- 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 \
|
||||
--no-wait \
|
||||
--yes
|
110
.github/workflows/e2e-test-manual.yml
vendored
110
.github/workflows/e2e-test-manual.yml
vendored
@ -20,6 +20,13 @@ on:
|
||||
- "aws"
|
||||
default: "azure"
|
||||
required: true
|
||||
runner:
|
||||
description: "Architecture of the runner that executes the CLI"
|
||||
type: choice
|
||||
options:
|
||||
- "ubuntu-22.04"
|
||||
- "macos-12"
|
||||
default: "ubuntu-22.04"
|
||||
test:
|
||||
description: "The test to run."
|
||||
type: choice
|
||||
@ -46,11 +53,6 @@ on:
|
||||
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
|
||||
@ -77,6 +79,7 @@ jobs:
|
||||
contents: read
|
||||
outputs:
|
||||
image: ${{ steps.find-latest-image.outputs.image }}${{ steps.check-input.outputs.image }}
|
||||
isDebugImage: ${{ steps.isDebugImage.outputs.isDebugImage }}
|
||||
steps:
|
||||
- name: Check input
|
||||
id: check-input
|
||||
@ -103,13 +106,78 @@ jobs:
|
||||
ref: main
|
||||
stream: debug
|
||||
|
||||
e2e-test-manual:
|
||||
- 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
|
||||
|
||||
build-bootstrapper:
|
||||
name: "Build bootstrapper for macOS runner"
|
||||
runs-on: ubuntu-22.04
|
||||
if: inputs.runner == 'macos-12' && needs.find-latest-image.outputs.isDebugImage == 'true'
|
||||
needs: [find-latest-image]
|
||||
steps:
|
||||
- name: Setup Go environment
|
||||
if: github.event.steps.check-bootstrapper-cache.cache-hit != 'true'
|
||||
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
|
||||
with:
|
||||
go-version: "1.19.4"
|
||||
|
||||
- name: Checkout head
|
||||
if: github.event.steps.check-bootstrapper-cache.cache-hit != 'true' && inputs.git-ref == 'head'
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
with:
|
||||
ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}
|
||||
- name: Checkout ref
|
||||
if: github.event.steps.check-bootstrapper-cache.cache-hit != 'true' && inputs.git-ref != 'head'
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
with:
|
||||
ref: ${{ inputs.git-ref }}
|
||||
|
||||
- name: Build bootstrapper
|
||||
if: github.event.steps.check-bootstrapper-cache.cache-hit != 'true'
|
||||
uses: ./.github/actions/build_bootstrapper
|
||||
|
||||
- name: Upload bootstrapper to cache
|
||||
if: github.event.steps.check-bootstrapper-cache.cache-hit != 'true'
|
||||
uses: actions/cache@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3
|
||||
with:
|
||||
key: bootstrapper-${{ github.sha }}
|
||||
path: "build/bootstrapper"
|
||||
|
||||
e2e-test-manual:
|
||||
runs-on: ${{ inputs.runner }}
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
needs: [find-latest-image]
|
||||
needs: [find-latest-image, build-bootstrapper]
|
||||
if: |
|
||||
always() &&
|
||||
!cancelled() &&
|
||||
(
|
||||
needs.build-bootstrapper.result == 'success' ||
|
||||
needs.build-bootstrapper.result == 'skipped'
|
||||
)
|
||||
steps:
|
||||
- name: Install the basics tools (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
shell: bash
|
||||
run: brew install coreutils kubectl bash
|
||||
|
||||
- name: Checkout head
|
||||
if: inputs.git-ref == 'head'
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
@ -126,18 +194,22 @@ jobs:
|
||||
with:
|
||||
go-version: "1.19.4"
|
||||
|
||||
- name: Set up gcloud CLI (macOS)
|
||||
if: github.event.inputs.cloudProvider == 'gcp' && runner.os == 'macOS'
|
||||
uses: google-github-actions/setup-gcloud@d51b5346f85640ec2aa2fa057354d2b82c2fcbce # v1.0.1
|
||||
|
||||
- name: Login to Azure
|
||||
if: ${{ github.event.inputs.cloudProvider == 'azure' }}
|
||||
if: github.event.inputs.cloudProvider == 'azure'
|
||||
uses: ./.github/actions/login_azure
|
||||
with:
|
||||
azure_credentials: ${{ secrets.AZURE_E2E_CREDENTIALS }}
|
||||
|
||||
- name: Create Azure resource group
|
||||
id: az_resource_group_gen
|
||||
if: ${{ github.event.inputs.cloudProvider == 'azure' }}
|
||||
if: github.event.inputs.cloudProvider == 'azure'
|
||||
shell: bash
|
||||
run: |
|
||||
uuid=$(cat /proc/sys/kernel/random/uuid)
|
||||
uuid=$(uuidgen)
|
||||
name=e2e-test-${uuid%%-*}
|
||||
az group create --location westus --name "$name" --tags e2e
|
||||
echo "res_group_name=$name" >> "$GITHUB_OUTPUT"
|
||||
@ -163,7 +235,7 @@ jobs:
|
||||
azureUserAssignedIdentity: ${{ secrets.AZURE_E2E_USER_ASSIGNED_IDENTITY }}
|
||||
azureResourceGroup: ${{ steps.az_resource_group_gen.outputs.res_group_name }}
|
||||
osImage: ${{ needs.find-latest-image.outputs.image }}
|
||||
isDebugImage: ${{ github.event.inputs.isDebugImage }}
|
||||
isDebugImage: ${{ needs.find-latest-image.outputs.isDebugImage }}
|
||||
|
||||
- name: Always terminate cluster
|
||||
if: always()
|
||||
@ -172,22 +244,8 @@ jobs:
|
||||
with:
|
||||
kubeconfig: ${{ steps.e2e_test.outputs.kubeconfig }}
|
||||
|
||||
- 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)"
|
||||
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
|
||||
|
||||
- name: Always destroy Azure resource group
|
||||
if: ${{ always() && github.event.inputs.cloudProvider == 'azure' }}
|
||||
if: always() && github.event.inputs.cloudProvider == 'azure'
|
||||
shell: bash
|
||||
run: |
|
||||
az group delete \
|
||||
|
Loading…
Reference in New Issue
Block a user