e2e tests: use new image versions

This commit is contained in:
Malte Poll 2022-11-23 09:41:42 +01:00 committed by Malte Poll
parent 457ff442ce
commit 3dc9c60864
10 changed files with 110 additions and 52 deletions

View File

@ -15,7 +15,7 @@ inputs:
description: "Machine type of VM to spawn."
required: false
osImage:
description: "OS image to use. The default value 'debug-latest' will select the latest available debug image."
description: "OS image to use."
required: true
isDebugImage:
description: "Is OS img a debug img?"
@ -101,42 +101,8 @@ runs:
- name: Set image
shell: bash
env:
CSP: ${{ inputs.cloudProvider }}
run: |
case $CSP in
azure)
if [ "${{ inputs.osImage == 'debug-latest' }}" = true ]
then
IMAGE_DEFINITION=$(az sig image-definition list --resource-group constellation-images --gallery-name Constellation_Debug_CVM --query "[].name" -o tsv | sort --version-sort | tail -n 1)
AZURE_IMAGE=$(az sig image-version list --resource-group constellation-images --gallery-name Constellation_Debug_CVM --gallery-image-definition ${IMAGE_DEFINITION} --query "sort_by([], &publishingProfile.publishedDate)[].id" -o table | tail -n 1)
else
AZURE_IMAGE=${{ inputs.osImage }}
fi
yq eval -i "(.provider.azure.image) = \"${AZURE_IMAGE}\"" constellation-conf.yaml
;;
gcp)
if [ "${{ inputs.osImage == 'debug-latest' }}" = true ]
then
GCP_IMAGE_NAME=$(gcloud compute images list --project constellation-images --filter="name ~ constellation-\d{10} AND family~constellation-debug-v\d+-\d+-\d+" --sort-by=creationTimestamp --format="table(name)" | tail -n 1)
GCP_IMAGE="projects/constellation-images/global/images/${GCP_IMAGE_NAME}"
else
GCP_IMAGE=${{ inputs.osImage }}
fi
yq eval -i "(.provider.gcp.image) = \"${GCP_IMAGE}\"" constellation-conf.yaml
;;
aws)
if [ "${{ inputs.osImage == 'debug-latest' }}" = true ]
then
AWS_IMAGE=$(aws ec2 describe-images --owners 795746500882 --region eu-central-1 --filters "Name=name,Values=constellation-debug-v*" --query "sort_by(Images, &CreationDate)[].ImageId" | jq -r '.[-1]')
else
AWS_IMAGE=${{ inputs.osImage }}
fi
yq eval -i "(.provider.aws.image) = \"${AWS_IMAGE}\"" constellation-conf.yaml
;;
esac
image: ${{ inputs.osImage }}
run: yq eval -i "(.image) = \"${image}\"" constellation-conf.yaml
- name: Set instanceType
if: ${{ inputs.machineType && inputs.machineType != 'default' }}

View File

@ -17,8 +17,7 @@ inputs:
description: "VM machine type. Make sure it matches selected cloud provider!"
required: false
osImage:
description: "OS image to run. The default value 'debug-latest' will select the latest available debug image."
default: "debug-latest"
description: "OS image to run."
required: true
isDebugImage:
description: "Is OS img a debug img?"

View File

@ -0,0 +1,50 @@
name: Find latest OS image
description: Finds the latest OS image of a given type.
inputs:
imageType:
description: "Type of image to find. Can be one of [debug, release] or a custom prefix (branch name)."
required: true
outputs:
image:
description: "The latest image of the given type."
value: ${{ steps.find-latest-image.outputs.image }}
runs:
using: "composite"
steps:
- name: Login to AWS
uses: aws-actions/configure-aws-credentials@67fbcbb121271f7775d2e7715933280b06314838 # v1.7.0
with:
role-to-assume: arn:aws:iam::795746500882:role/GithubConstellationImageFinder
aws-region: eu-central-1
- name: Set search prefix
id: set-search-prefix
shell: bash
env:
image_type: ${{ inputs.imageType }}
run: |
if [[ "${image_type}" == "debug" ]]; then
echo "prefix=debug-v" >> "${GITHUB_OUTPUT}"
elif [[ "${image_type}" == "release" ]]; then
echo "prefix=v" >> "${GITHUB_OUTPUT}"
else
echo "prefix=${image_type}" >> "${GITHUB_OUTPUT}"
fi
- name: Find latest image
id: find-latest-image
shell: bash
env:
bucket: cdn-constellation-backend
prefix: constellation/v1/images/${{ steps.set-search-prefix.outputs.prefix }}
run: |
newest_debug_image_path=$(aws s3api list-objects-v2 \
--output text \
--bucket "${bucket}" \
--prefix "${prefix}" \
--query "reverse(sort_by(Contents, &LastModified))[0].Key")
image=$(basename "${newest_debug_image_path}" .json)
echo "image=${image}" >> "${GITHUB_OUTPUT}"

View File

@ -5,7 +5,7 @@ inputs:
description: "Which cloud provider to use."
required: true
osImage:
description: "OS image to run. The default value 'debug-latest' will select the latest available debug image."
description: "OS image to run."
required: true
isDebugImage:
description: "Is OS img a debug img?"

View File

@ -81,17 +81,17 @@ This checklist will prepare `v1.3.0` from `v1.2.0`. Adjust your version numbers
11. Run manual E2E tests using [Linux](/.github/workflows/e2e-test-manual.yml) and [macOS](/.github/workflows/e2e-test-manual-macos.yml) to confirm functionality and stability.
```sh
gh workflow run e2e-test-manual.yml --ref release/v$minor -F cloudProvider=azure -F machineType=Standard_DC4as_v5 -F test="sonobuoy full" -F osImage=/CommunityGalleries/ConstellationCVM-b3782fa0-0df7-4f2f-963e-fc7fc42663df/Images/constellation/Versions/$ver -F isDebugImage=false
gh workflow run e2e-test-manual-macos.yml --ref release/v$minor -F cloudProvider=azure -F machineType=Standard_DC4as_v5 -F test="sonobuoy full" -F osImage=/CommunityGalleries/ConstellationCVM-b3782fa0-0df7-4f2f-963e-fc7fc42663df/Images/constellation/Versions/$ver -F isDebugImage=false
gh workflow run e2e-test-manual.yml --ref release/v$minor -F cloudProvider=gcp -F machineType=n2d-standard-4 -F test="sonobuoy full" -F osImage=projects/constellation-images/global/images/constellation-v$gcpVer -F isDebugImage=false
gh workflow run e2e-test-manual-macos.yml --ref release/v$minor -F cloudProvider=gcp -F machineType=n2d-standard-4 -F test="sonobuoy full" -F osImage=projects/constellation-images/global/images/constellation-v$gcpVer -F isDebugImage=false
gh workflow run e2e-test-manual.yml --ref release/v$minor -F cloudProvider=azure -F machineType=Standard_DC4as_v5 -F test="sonobuoy full" -F osImage=v$ver -F isDebugImage=false
gh workflow run e2e-test-manual-macos.yml --ref release/v$minor -F cloudProvider=azure -F machineType=Standard_DC4as_v5 -F test="sonobuoy full" -F osImage=v$ver -F isDebugImage=false
gh workflow run e2e-test-manual.yml --ref release/v$minor -F cloudProvider=gcp -F machineType=n2d-standard-4 -F test="sonobuoy full" -F osImage=v$ver -F isDebugImage=false
gh workflow run e2e-test-manual-macos.yml --ref release/v$minor -F cloudProvider=gcp -F machineType=n2d-standard-4 -F test="sonobuoy full" -F osImage=v$ver -F isDebugImage=false
```
12. [Generate measurements](/.github/workflows/generate-measurements.yml) for the images on each CSP.
```sh
gh workflow run generate-measurements.yml --ref release/v$minor -F cloudProvider=azure -F osImage=/CommunityGalleries/ConstellationCVM-b3782fa0-0df7-4f2f-963e-fc7fc42663df/Images/constellation/Versions/$ver -F isDebugImage=false
gh workflow run generate-measurements.yml --ref release/v$minor -F cloudProvider=gcp -F osImage=projects/constellation-images/global/images/constellation-v$gcpVer -F isDebugImage=false
gh workflow run generate-measurements.yml --ref release/v$minor -F cloudProvider=azure -F osImage=v$ver -F isDebugImage=false
gh workflow run generate-measurements.yml --ref release/v$minor -F cloudProvider=gcp -F osImage=v$ver -F isDebugImage=false
```
13. Create a new tag on this release branch

View File

@ -12,6 +12,26 @@ env:
ARM_TENANT_ID: ${{ secrets.AZURE_E2E_TENANT_ID }}
jobs:
find-latest-image:
name: Find latest debug image
runs-on: ubuntu-22.04
permissions:
id-token: write
contents: read
outputs:
image: ${{ steps.find-latest-image.outputs.image }}
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
with:
ref: ${{ github.head_ref }}
- name: Find latest image
id: find-latest-image
uses: ./.github/actions/find_latest_image
with:
imageType: debug
e2e-daily:
strategy:
fail-fast: false
@ -21,6 +41,7 @@ jobs:
permissions:
id-token: write
contents: read
needs: [find-latest-image]
steps:
- name: Check out repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0
@ -56,6 +77,7 @@ jobs:
workerNodesCount: "2"
controlNodesCount: "3"
cloudProvider: ${{ matrix.provider }}
osImage: ${{ needs.find-latest-image.outputs.image }}
azureSubscription: ${{ secrets.AZURE_E2E_SUBSCRIPTION_ID }}
azureTenant: ${{ secrets.AZURE_E2E_TENANT_ID }}
azureClientID: ${{ secrets.AZURE_E2E_CLIENT_ID }}

View File

@ -34,8 +34,7 @@ on:
default: "1.24"
required: true
osImage:
description: "OS image (full path). Examples are in internal/config/config.go."
default: "debug-latest"
description: "Full name of OS image (CSP independent image version UID)."
type: string
required: true
isDebugImage:

View File

@ -35,9 +35,9 @@ on:
default: "1.24"
required: true
osImage:
description: "OS image (full path). Examples are in internal/config/config.go."
default: "debug-latest"
required: false
description: "Full name of OS image (CSP independent image version UID)."
type: string
required: true
isDebugImage:
description: "Is OS image a debug image?"
type: boolean

View File

@ -12,6 +12,26 @@ env:
ARM_TENANT_ID: ${{ secrets.AZURE_E2E_TENANT_ID }}
jobs:
find-latest-image:
name: Find latest debug image
runs-on: ubuntu-22.04
permissions:
id-token: write
contents: read
outputs:
image: ${{ steps.find-latest-image.outputs.image }}
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
with:
ref: ${{ github.head_ref }}
- name: Find latest image
id: find-latest-image
uses: ./.github/actions/find_latest_image
with:
imageType: debug
e2e-weekly:
strategy:
fail-fast: false
@ -40,6 +60,7 @@ jobs:
permissions:
id-token: write
contents: read
needs: [find-latest-image]
steps:
- name: Check out repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0
@ -75,6 +96,7 @@ jobs:
workerNodesCount: "2"
controlNodesCount: "3"
cloudProvider: ${{ matrix.provider }}
osImage: ${{ needs.find-latest-image.outputs.image }}
kubernetesVersion: ${{ matrix.version }}
azureSubscription: ${{ secrets.AZURE_E2E_SUBSCRIPTION_ID }}
azureTenant: ${{ secrets.AZURE_E2E_TENANT_ID }}

View File

@ -12,7 +12,7 @@ on:
default: "gcp"
required: true
osImage:
description: "OS image (full path). Examples are in internal/config/config.go."
description: "Full name of OS image (CSP independent image version UID)."
type: string
required: true
isDebugImage: