ci: refactor artifact and resource naming

Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
Paul Meyer 2023-04-13 12:02:19 +02:00
parent 1f82b4d266
commit 76979136de
4 changed files with 27 additions and 32 deletions

View File

@ -23,6 +23,9 @@ inputs:
kubernetesVersion:
description: "Kubernetes version to create the cluster from."
required: false
artifactNameSuffix:
description: "Suffix for artifact naming."
required: true
keepMeasurements:
default: "false"
description: "Keep measurements embedded in the CLI."
@ -267,5 +270,5 @@ runs:
if: always() && !env.ACT
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: serial-logs-${{ inputs.cloudProvider }}
name: serial-logs-${{ inputs.artifactNameSuffix }}
path: "*.log"

View File

@ -3,29 +3,23 @@ description: Create IAM configuration for a Constellation cluster.
inputs:
cloudProvider:
description: "Either 'aws', 'azure' or 'gcp'."
required: true
description: "Either 'aws', 'azure' or 'gcp'."
required: true
namePrefix:
description: "Name prefix to use for resources."
required: true
#
# AWS specific inputs
#
awsZone:
description: "AWS zone to deploy Constellation in."
required: false
awsPrefix:
description: "name prefix to use for the AWS resources."
required: false
#
# Azure specific inputs
#
azureRegion:
description: "Azure region to deploy Constellation in."
required: false
azureResourceGroup:
description: "Name of the Azure resource group being created."
required: false
azureServicePrincipal:
description: "Name of the Azure service principal being created."
required: false
#
# GCP specific inputs
#
@ -35,9 +29,6 @@ inputs:
gcpZone:
description: "The GCP zone to deploy Constellation in."
required: false
gcpServiceAccountID:
description: "ID of the GCP service account being created."
required: false
outputs:
existingConfig:
@ -53,7 +44,7 @@ runs:
run: |
constellation iam create aws \
--zone=${{ inputs.awsZone }} \
--prefix=${{ inputs.awsPrefix }} \
--prefix=${{ inputs.namePrefix }} \
--generate-config --yes
- name: Constellation iam create azure
@ -62,8 +53,8 @@ runs:
run: |
constellation iam create azure \
--region=${{ inputs.azureRegion }} \
--resourceGroup=${{ inputs.azureResourceGroup }} \
--servicePrincipal=${{ inputs.azureServicePrincipal }} \
--resourceGroup="${{ inputs.namePrefix }}-rg" \
--servicePrincipal="${{ inputs.namePrefix }}-sp" \
--generate-config --yes
- name: Constellation iam create gcp
@ -73,7 +64,7 @@ runs:
constellation iam create gcp \
--projectID=${{ inputs.gcpProjectID }} \
--zone=${{ inputs.gcpZone }} \
--serviceAccountID=${{ inputs.gcpServiceAccountID }} \
--serviceAccountID="${{ inputs.namePrefix }}-sa" \
--generate-config --yes
- name: Set existing config

View File

@ -2,11 +2,12 @@ name: sonobuoy
description: "Execute the e2e test framework sonobuoy."
inputs:
cloudProvider:
description: "CSP name necessary for artifact naming."
artifactNameSuffix:
description: "Suffix for artifact naming."
required: true
sonobuoyTestSuiteCmd:
description: "Which tests should be run?"
required: true
kubeconfig:
description: "The kubeconfig of the cluster to test."
required: true
@ -45,14 +46,14 @@ runs:
if: always() && !env.ACT
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: "sonobuoy_logs_${{ inputs.cloudProvider}}.tar.gz"
path: "*_sonobuoy_*.tar.gz"
name: "sonobuoy-logs-${{ inputs.artifactNameSuffix }}.tar.gz"
path: "*-sonobuoy-*.tar.gz"
# Only works on "sonobuoy full" tests (e2e plugin)
- name: Extract test results
if: (!env.ACT) && contains(inputs.sonobuoyTestSuiteCmd, '--plugin e2e')
shell: bash
run: tar -xf *_sonobuoy_*.tar.gz
run: tar -xf *-sonobuoy-*.tar.gz
- name: Publish test results
if: (!env.ACT) && contains(inputs.sonobuoyTestSuiteCmd, '--plugin e2e')

View File

@ -167,26 +167,24 @@ runs:
with:
azure_credentials: ${{ inputs.azureIAMCreateCredentials }}
- name: Create UUID
id: create-uuid
- name: Create prefix
id: create-prefix
shell: bash
run: |
uuid=$(uuidgen)
echo "uuid=${uuid%%-*}" >> $GITHUB_OUTPUT
echo "uuid=${uuid%%-*}" | tee -a $GITHUB_OUTPUT
echo "prefix=e2e-${{ github.run_id }}-${{ github.run_attempt }}-${uuid}" | tee -a $GITHUB_OUTPUT
- name: Create IAM configuration
id: constellation-iam-create
uses: ./.github/actions/constellation_iam_create
with:
cloudProvider: ${{ inputs.cloudProvider }}
namePrefix: ${{ steps.create-prefix.outputs.prefix }}
awsZone: eu-central-1c
awsPrefix: e2e_${{ github.run_id }}_${{ github.run_attempt }}_${{ steps.create-uuid.outputs.uuid }}
azureRegion: northeurope
azureResourceGroup: e2e_${{ github.run_id }}_${{ github.run_attempt }}_${{ steps.create-uuid.outputs.uuid }}_rg
azureServicePrincipal: e2e_${{ github.run_id }}_${{ github.run_attempt }}_${{ steps.create-uuid.outputs.uuid }}_sp
gcpProjectID: ${{ inputs.gcpProject }}
gcpZone: europe-west3-b
gcpServiceAccountID: e2e-${{ github.run_id }}-${{ github.run_attempt }}-${{ steps.create-uuid.outputs.uuid }}-sa
- name: Login to GCP (Cluster service account)
if: inputs.cloudProvider == 'gcp'
@ -223,6 +221,7 @@ runs:
kubernetesVersion: ${{ inputs.kubernetesVersion }}
keepMeasurements: ${{ inputs.keepMeasurements }}
existingConfig: ${{ steps.constellation-iam-create.outputs.existingConfig }}
artifactNameSuffix: ${{ steps.create-prefix.outputs.prefix }}
#
# Test payloads
@ -239,7 +238,7 @@ runs:
with:
sonobuoyTestSuiteCmd: "--mode quick"
kubeconfig: ${{ steps.constellation-create.outputs.kubeconfig }}
cloudProvider: ${{ inputs.cloudProvider }}
artifactNameSuffix: ${{ steps.create-prefix.outputs.prefix }}
- name: Run sonobuoy full test
if: inputs.test == 'sonobuoy full'
@ -249,6 +248,7 @@ runs:
sonobuoyTestSuiteCmd: '--plugin e2e --plugin-env e2e.E2E_FOCUS="\[Conformance\]" --plugin-env e2e.E2E_SKIP="for service with type clusterIP|HostPort validates that there is no conflict between pods with same hostPort but different hostIP and protocol" --plugin https://raw.githubusercontent.com/vmware-tanzu/sonobuoy-plugins/master/cis-benchmarks/kube-bench-plugin.yaml --plugin https://raw.githubusercontent.com/vmware-tanzu/sonobuoy-plugins/master/cis-benchmarks/kube-bench-master-plugin.yaml'
kubeconfig: ${{ steps.constellation-create.outputs.kubeconfig }}
cloudProvider: ${{ inputs.cloudProvider }}
artifactNameSuffix: ${{ steps.create-prefix.outputs.prefix }}
- name: Run autoscaling test
if: inputs.test == 'autoscaling'