Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: correctly clean up failed windows e2e tests #3059

Merged
merged 10 commits into from
May 3, 2024
Merged
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 11 additions & 22 deletions .github/workflows/e2e-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,12 @@ jobs:
azure_credentials: ${{ secrets.AZURE_E2E_IAM_CREDENTIALS }}

- name: Create IAM configuration
id: iam-create
shell: pwsh
run: |
$uid = Get-Random -Minimum 1000 -Maximum 9999
$rgName = "e2e-win-${{ github.run_id }}-${{ github.run_attempt }}-$uid"
"rgName=$($rgName)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
.\constellation.exe config generate azure -t "workflow=${{ github.run_id }}"
.\constellation.exe iam create azure --region=westus --resourceGroup=$rgName-rg --servicePrincipal=$rgName-sp --update-config --debug -y

Expand Down Expand Up @@ -150,6 +152,7 @@ jobs:
}

- name: Terminate cluster
id: terminate-cluster
if: always()
shell: pwsh
run: |
Expand All @@ -162,11 +165,19 @@ jobs:
azure_credentials: ${{ secrets.AZURE_E2E_IAM_CREDENTIALS }}

- name: Delete IAM configuration
id: delete-iam
if: always()
shell: pwsh
run: |
.\constellation.exe iam destroy --debug -y

- name: Clean up after failure
if: ${{ (failure() && (steps.terminate-cluster.conclusion == 'failure' || steps.delete-iam.conclusion == 'failure')) || cancelled() }} # run on a cleanup failure or if cancelled
miampf marked this conversation as resolved.
Show resolved Hide resolved
shell: pwsh
run: |
az group delete --name ${{ steps.iam-create.outputs.rgName }}-rg --yes
az group delete --name ${{ steps.iam-create.outputs.rgName }}-rg-identity --yes

notify-failure:
name: Notify about failure
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -196,25 +207,3 @@ jobs:
provider: Azure
attestationVariant: "azure-sev-snp"

upload-tfstate:
name: Upload terraform state if it exists
runs-on: ubuntu-22.04
needs: e2e-test
if: always()
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}

- name: Upload tfstate
if: always()
env:
GH_TOKEN: ${{ github.token }}
uses: ./.github/actions/update_tfstate
with:
name: terraform-state-${{ github.run_id }}
runID: ${{ github.run_id }}
encryptionSecret: ${{ secrets.ARTIFACT_ENCRYPT_PASSWD }}
skipDeletion: "true"

Loading