e2e: Fix cleanup on error/cancel

This commit is contained in:
katexochen 2022-09-02 12:40:22 +02:00 committed by Paul Meyer
parent 90b4067523
commit 3c123d9fec
7 changed files with 144 additions and 29 deletions

View File

@ -5,4 +5,4 @@ runs:
steps: steps:
- name: Constellation terminate - name: Constellation terminate
run: constellation terminate run: constellation terminate
shell: bash shell: bash

View File

@ -39,9 +39,6 @@ inputs:
kubernetesVersion: kubernetesVersion:
description: "Kubernetes version to create the cluster from." description: "Kubernetes version to create the cluster from."
required: false required: false
msTeamsWebhook:
description: "WebHook used to notify of failure."
required: true
cosignPublicKey: cosignPublicKey:
description: "Cosign public key to sign measurements." description: "Cosign public key to sign measurements."
required: false required: false
@ -124,21 +121,3 @@ runs:
uses: ./.github/actions/sonobuoy uses: ./.github/actions/sonobuoy
with: with:
sonobuoyTestSuiteCmd: ${{ inputs.sonobuoyTestSuiteCmd }} sonobuoyTestSuiteCmd: ${{ inputs.sonobuoyTestSuiteCmd }}
- name: Notify teams channel
if: ${{ failure() && github.ref == 'refs/heads/main' }}
run: |
sudo apt-get install gettext-base -y
export TEAMS_JOB_NAME=${{ inputs.cloudProvider }}
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 \
"${{ inputs.msTeamsWebhook }}"
shell: bash
working-directory: .github/actions/e2e_test
- name: Always terminate cluster
if: always()
uses: ./.github/actions/constellation_destroy

View File

@ -29,4 +29,24 @@ jobs:
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' 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'
kubernetesVersion: ${{ matrix.version }} kubernetesVersion: ${{ matrix.version }}
azureClientSecret: ${{ secrets.AZURE_E2E_CLIENT_SECRET }} azureClientSecret: ${{ secrets.AZURE_E2E_CLIENT_SECRET }}
msTeamsWebhook: ${{ secrets.MS_TEAMS_WEBHOOK_URI }}
- name: Always terminate cluster
if: always()
continue-on-error: true
uses: ./.github/actions/constellation_destroy
- name: Notify teams channel
if: ${{ failure() && github.ref == 'refs/heads/main' }}
continue-on-error: true
run: |
sudo apt-get install gettext-base -y
export TEAMS_JOB_NAME=azure
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

View File

@ -24,7 +24,6 @@ jobs:
azureClientSecret: ${{ secrets.AZURE_E2E_CLIENT_SECRET }} azureClientSecret: ${{ secrets.AZURE_E2E_CLIENT_SECRET }}
# TODO: Remove E2E_SKIP once AB#2174 is resolved # TODO: Remove E2E_SKIP once AB#2174 is resolved
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' 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'
msTeamsWebhook: ${{ secrets.MS_TEAMS_WEBHOOK_URI }}
cosignPublicKey: ${{ secrets.COSIGN_PUBLIC_KEY }} cosignPublicKey: ${{ secrets.COSIGN_PUBLIC_KEY }}
cosignPrivateKey: ${{ secrets.COSIGN_PRIVATE_KEY }} cosignPrivateKey: ${{ secrets.COSIGN_PRIVATE_KEY }}
cosignPassword: ${{ secrets.COSIGN_PASSWORD }} cosignPassword: ${{ secrets.COSIGN_PASSWORD }}
@ -33,6 +32,26 @@ jobs:
awsDefaultRegion: ${{ secrets.AWS_DEFAULT_REGION }} awsDefaultRegion: ${{ secrets.AWS_DEFAULT_REGION }}
awsBucketName: ${{ secrets.PUBLIC_BUCKET_NAME }} awsBucketName: ${{ secrets.PUBLIC_BUCKET_NAME }}
- name: Always terminate cluster
if: always()
continue-on-error: true
uses: ./.github/actions/constellation_destroy
- name: Notify teams channel
if: ${{ failure() && github.ref == 'refs/heads/main' }}
continue-on-error: true
run: |
sudo apt-get install gettext-base -y
export TEAMS_JOB_NAME=azure
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
test-older-versions: test-older-versions:
strategy: strategy:
matrix: matrix:
@ -55,4 +74,24 @@ jobs:
azureClientSecret: ${{ secrets.AZURE_E2E_CLIENT_SECRET }} azureClientSecret: ${{ secrets.AZURE_E2E_CLIENT_SECRET }}
sonobuoyTestSuiteCmd: "--mode quick" sonobuoyTestSuiteCmd: "--mode quick"
kubernetesVersion: ${{ matrix.version }} kubernetesVersion: ${{ matrix.version }}
msTeamsWebhook: ${{ secrets.MS_TEAMS_WEBHOOK_URI }}
- name: Always terminate cluster
if: always()
continue-on-error: true
uses: ./.github/actions/constellation_destroy
- name: Notify teams channel
if: ${{ failure() && github.ref == 'refs/heads/main' }}
continue-on-error: true
run: |
sudo apt-get install gettext-base -y
export TEAMS_JOB_NAME=azure
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

View File

@ -30,4 +30,23 @@ jobs:
gcpClusterServiceAccountKey: ${{ secrets.GCP_CLUSTER_SERVICE_ACCOUNT }} gcpClusterServiceAccountKey: ${{ secrets.GCP_CLUSTER_SERVICE_ACCOUNT }}
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' 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'
kubernetesVersion: ${{ matrix.version }} kubernetesVersion: ${{ matrix.version }}
msTeamsWebhook: ${{ secrets.MS_TEAMS_WEBHOOK_URI }}
- name: Always terminate cluster
if: always()
continue-on-error: true
uses: ./.github/actions/constellation_destroy
- name: Notify teams channel
if: ${{ failure() && github.ref == 'refs/heads/main' }}
continue-on-error: true
run: |
sudo apt-get install gettext-base -y
export TEAMS_JOB_NAME=gcp
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

View File

@ -25,7 +25,6 @@ jobs:
gcpClusterServiceAccountKey: ${{ secrets.GCP_CLUSTER_SERVICE_ACCOUNT }} gcpClusterServiceAccountKey: ${{ secrets.GCP_CLUSTER_SERVICE_ACCOUNT }}
# TODO: Remove E2E_SKIP once AB#2174 is resolved # TODO: Remove E2E_SKIP once AB#2174 is resolved
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' 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'
msTeamsWebhook: ${{ secrets.MS_TEAMS_WEBHOOK_URI }}
cosignPublicKey: ${{ secrets.COSIGN_PUBLIC_KEY }} cosignPublicKey: ${{ secrets.COSIGN_PUBLIC_KEY }}
cosignPrivateKey: ${{ secrets.COSIGN_PRIVATE_KEY }} cosignPrivateKey: ${{ secrets.COSIGN_PRIVATE_KEY }}
cosignPassword: ${{ secrets.COSIGN_PASSWORD }} cosignPassword: ${{ secrets.COSIGN_PASSWORD }}
@ -34,6 +33,26 @@ jobs:
awsDefaultRegion: ${{ secrets.AWS_DEFAULT_REGION }} awsDefaultRegion: ${{ secrets.AWS_DEFAULT_REGION }}
awsBucketName: ${{ secrets.PUBLIC_BUCKET_NAME }} awsBucketName: ${{ secrets.PUBLIC_BUCKET_NAME }}
- name: Always terminate cluster
if: always()
continue-on-error: true
uses: ./.github/actions/constellation_destroy
- name: Notify teams channel
if: ${{ failure() && github.ref == 'refs/heads/main' }}
continue-on-error: true
run: |
sudo apt-get install gettext-base -y
export TEAMS_JOB_NAME=gcp
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
test-older-versions: test-older-versions:
strategy: strategy:
matrix: matrix:
@ -44,6 +63,7 @@ jobs:
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Run GCP E2E test - name: Run GCP E2E test
uses: ./.github/actions/e2e_test uses: ./.github/actions/e2e_test
with: with:
@ -56,4 +76,23 @@ jobs:
gcpClusterServiceAccountKey: ${{ secrets.GCP_CLUSTER_SERVICE_ACCOUNT }} gcpClusterServiceAccountKey: ${{ secrets.GCP_CLUSTER_SERVICE_ACCOUNT }}
sonobuoyTestSuiteCmd: "--mode quick" sonobuoyTestSuiteCmd: "--mode quick"
kubernetesVersion: ${{ matrix.version }} kubernetesVersion: ${{ matrix.version }}
msTeamsWebhook: ${{ secrets.MS_TEAMS_WEBHOOK_URI }}
- name: Always terminate cluster
if: always()
continue-on-error: true
uses: ./.github/actions/constellation_destroy
- name: Notify teams channel
if: ${{ failure() && github.ref == 'refs/heads/main' }}
continue-on-error: true
run: |
sudo apt-get install gettext-base -y
export TEAMS_JOB_NAME=gcp
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

View File

@ -70,7 +70,6 @@ jobs:
sonobuoyTestSuiteCmd: ${{ github.event.inputs.sonobuoyTestSuiteCmd }} sonobuoyTestSuiteCmd: ${{ github.event.inputs.sonobuoyTestSuiteCmd }}
kubernetesVersion: ${{ github.event.inputs.kubernetesVersion }} kubernetesVersion: ${{ github.event.inputs.kubernetesVersion }}
azureClientSecret: ${{ secrets.AZURE_E2E_CLIENT_SECRET }} azureClientSecret: ${{ secrets.AZURE_E2E_CLIENT_SECRET }}
msTeamsWebhook: ${{ secrets.MS_TEAMS_WEBHOOK_URI }}
coreosImage: ${{ github.event.inputs.coreosImage }} coreosImage: ${{ github.event.inputs.coreosImage }}
isDebugImage: ${{ github.event.inputs.isDebugImage }} isDebugImage: ${{ github.event.inputs.isDebugImage }}
cosignPublicKey: ${{ secrets.COSIGN_PUBLIC_KEY }} cosignPublicKey: ${{ secrets.COSIGN_PUBLIC_KEY }}
@ -80,3 +79,23 @@ jobs:
awsSecretAccessKey: ${{ secrets.AWS_SECRET_ACCESS_KEY }} awsSecretAccessKey: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
awsDefaultRegion: ${{ secrets.AWS_DEFAULT_REGION }} awsDefaultRegion: ${{ secrets.AWS_DEFAULT_REGION }}
awsBucketName: ${{ secrets.PUBLIC_BUCKET_NAME }} awsBucketName: ${{ secrets.PUBLIC_BUCKET_NAME }}
- name: Always terminate cluster
if: always()
continue-on-error: true
uses: ./.github/actions/constellation_destroy
- name: Notify teams channel
if: ${{ failure() && github.ref == 'refs/heads/main' }}
run: |
sudo apt-get install gettext-base -y
export TEAMS_JOB_NAME=azure
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