2023-06-21 06:05:04 -04:00
|
|
|
name: e2e test windows
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
2023-08-21 08:36:28 -04:00
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
scheduled:
|
|
|
|
description: Whether this is a scheduled run.
|
|
|
|
type: boolean
|
|
|
|
default: false
|
|
|
|
required: false
|
2023-06-21 06:05:04 -04:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-cli:
|
|
|
|
name: Build Windows CLI
|
|
|
|
runs-on: ubuntu-22.04
|
2024-04-11 05:27:12 -04:00
|
|
|
permissions:
|
|
|
|
id-token: write
|
|
|
|
checks: write
|
|
|
|
contents: read
|
|
|
|
packages: write
|
2023-06-21 06:05:04 -04:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2024-06-19 09:19:41 -04:00
|
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
2023-06-21 06:05:04 -04:00
|
|
|
with:
|
|
|
|
ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}
|
|
|
|
|
2023-10-23 08:39:45 -04:00
|
|
|
- name: Setup bazel
|
|
|
|
uses: ./.github/actions/setup_bazel_nix
|
|
|
|
|
2024-04-11 05:27:12 -04:00
|
|
|
- name: Log in to the Container registry
|
|
|
|
uses: ./.github/actions/container_registry_login
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2023-06-21 06:05:04 -04:00
|
|
|
- name: Build CLI
|
|
|
|
uses: ./.github/actions/build_cli
|
|
|
|
with:
|
|
|
|
targetOS: "windows"
|
|
|
|
targetArch: "amd64"
|
|
|
|
enterpriseCLI: true
|
2024-04-11 05:27:12 -04:00
|
|
|
outputPath: "build/constellation"
|
|
|
|
push: true
|
2023-06-21 06:05:04 -04:00
|
|
|
|
|
|
|
- name: Upload CLI artifact
|
2024-07-18 02:49:57 -04:00
|
|
|
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
|
2023-06-21 06:05:04 -04:00
|
|
|
with:
|
2024-04-11 05:27:12 -04:00
|
|
|
path: build/constellation.exe
|
2023-08-21 08:36:28 -04:00
|
|
|
name: "constell-exe"
|
2023-06-21 06:05:04 -04:00
|
|
|
|
|
|
|
e2e-test:
|
|
|
|
name: E2E Test Windows
|
|
|
|
runs-on: windows-2022
|
|
|
|
needs: build-cli
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2024-06-19 09:19:41 -04:00
|
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
2023-06-21 06:05:04 -04:00
|
|
|
with:
|
|
|
|
ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}
|
|
|
|
|
|
|
|
- name: Download CLI artifact
|
2024-07-18 02:49:57 -04:00
|
|
|
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
|
2023-06-21 06:05:04 -04:00
|
|
|
with:
|
2023-08-21 08:36:28 -04:00
|
|
|
name: "constell-exe"
|
2023-06-21 06:05:04 -04:00
|
|
|
|
|
|
|
- name: Check CLI version
|
|
|
|
shell: pwsh
|
|
|
|
run: |
|
|
|
|
.\constellation.exe version
|
2024-04-10 04:51:09 -04:00
|
|
|
Add-Content -Path $env:windir\System32\drivers\etc\hosts -Value "`n127.0.0.1`tlicense.confidential.cloud" -Force
|
2023-06-21 06:05:04 -04:00
|
|
|
|
|
|
|
- name: Login to Azure (IAM service principal)
|
|
|
|
uses: ./.github/actions/login_azure
|
|
|
|
with:
|
|
|
|
azure_credentials: ${{ secrets.AZURE_E2E_IAM_CREDENTIALS }}
|
|
|
|
|
|
|
|
- name: Create IAM configuration
|
2024-05-03 06:54:08 -04:00
|
|
|
id: iam-create
|
2023-06-21 06:05:04 -04:00
|
|
|
shell: pwsh
|
|
|
|
run: |
|
2024-04-11 05:27:12 -04:00
|
|
|
$uid = Get-Random -Minimum 1000 -Maximum 9999
|
|
|
|
$rgName = "e2e-win-${{ github.run_id }}-${{ github.run_attempt }}-$uid"
|
2024-05-03 06:54:08 -04:00
|
|
|
"rgName=$($rgName)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
|
2024-04-26 03:34:21 -04:00
|
|
|
.\constellation.exe config generate azure -t "workflow=${{ github.run_id }}"
|
2024-04-11 05:27:12 -04:00
|
|
|
.\constellation.exe iam create azure --region=westus --resourceGroup=$rgName-rg --servicePrincipal=$rgName-sp --update-config --debug -y
|
2023-06-21 06:05:04 -04:00
|
|
|
|
|
|
|
- name: Login to Azure (Cluster service principal)
|
|
|
|
uses: ./.github/actions/login_azure
|
|
|
|
with:
|
|
|
|
azure_credentials: ${{ secrets.AZURE_E2E_CLUSTER_CREDENTIALS }}
|
|
|
|
|
2024-01-29 05:52:41 -05:00
|
|
|
- name: Apply config
|
2023-06-21 06:05:04 -04:00
|
|
|
shell: pwsh
|
|
|
|
run: |
|
2024-01-29 05:52:41 -05:00
|
|
|
.\constellation.exe apply --debug -y
|
2023-06-21 06:05:04 -04:00
|
|
|
|
|
|
|
- name: Liveness probe
|
|
|
|
shell: pwsh
|
|
|
|
run: |
|
|
|
|
$retryIntervalSeconds = 30
|
|
|
|
$maxRetries = 50
|
|
|
|
|
|
|
|
$retryCount = 0
|
|
|
|
$allNodesReady = $false
|
|
|
|
|
|
|
|
while (-not $allNodesReady -and $retryCount -lt $maxRetries) {
|
|
|
|
${retryCount}++
|
|
|
|
Write-Host "Retry ${retryCount}: Checking node status..."
|
|
|
|
|
|
|
|
$nodesOutput = & kubectl get nodes --kubeconfig "$PWD\constellation-admin.conf"
|
2024-04-11 05:27:12 -04:00
|
|
|
$status = $?
|
|
|
|
|
|
|
|
$nodesOutput
|
2023-06-21 06:05:04 -04:00
|
|
|
|
2024-04-11 05:27:12 -04:00
|
|
|
if ($status) {
|
|
|
|
$lines = $nodesOutput -split "`r?`n" | Select-Object -Skip 1
|
2023-06-21 06:05:04 -04:00
|
|
|
|
2024-04-11 05:27:12 -04:00
|
|
|
if ($lines.count -eq 4) {
|
|
|
|
$allNodesReady = $true
|
2023-06-21 06:05:04 -04:00
|
|
|
|
2024-04-11 05:27:12 -04:00
|
|
|
foreach ($line in $lines) {
|
|
|
|
$columns = $line -split '\s+' | Where-Object { $_ -ne '' }
|
2023-06-21 06:05:04 -04:00
|
|
|
|
2024-04-11 05:27:12 -04:00
|
|
|
$nodeName = $columns[0]
|
|
|
|
$status = $columns[1]
|
2023-06-21 06:05:04 -04:00
|
|
|
|
2024-04-11 05:27:12 -04:00
|
|
|
if ($status -ne "Ready") {
|
|
|
|
Write-Host "Node $nodeName is not ready!"
|
|
|
|
$allNodesReady = $false
|
|
|
|
}
|
|
|
|
}
|
2023-06-21 06:05:04 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-11 05:27:12 -04:00
|
|
|
if (-not $allNodesReady -and $retryCount -lt $maxRetries) {
|
2023-06-21 06:05:04 -04:00
|
|
|
Write-Host "Retrying in $retryIntervalSeconds seconds..."
|
|
|
|
Start-Sleep -Seconds $retryIntervalSeconds
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($allNodesReady) {
|
|
|
|
Write-Host "All nodes are ready!"
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
Write-Host "Node status check failed after $maxRetries retries."
|
|
|
|
EXIT 1
|
|
|
|
}
|
|
|
|
|
|
|
|
- name: Terminate cluster
|
2024-05-03 06:54:08 -04:00
|
|
|
id: terminate-cluster
|
2023-06-21 06:05:04 -04:00
|
|
|
if: always()
|
|
|
|
shell: pwsh
|
|
|
|
run: |
|
|
|
|
.\constellation.exe terminate --debug -y
|
|
|
|
|
|
|
|
- name: Login to Azure (IAM service principal)
|
|
|
|
if: always()
|
|
|
|
uses: ./.github/actions/login_azure
|
|
|
|
with:
|
|
|
|
azure_credentials: ${{ secrets.AZURE_E2E_IAM_CREDENTIALS }}
|
|
|
|
|
|
|
|
- name: Delete IAM configuration
|
2024-05-03 06:54:08 -04:00
|
|
|
id: delete-iam
|
2023-06-21 06:05:04 -04:00
|
|
|
if: always()
|
|
|
|
shell: pwsh
|
|
|
|
run: |
|
|
|
|
.\constellation.exe iam destroy --debug -y
|
2023-08-21 08:36:28 -04:00
|
|
|
|
2024-05-03 06:54:08 -04:00
|
|
|
- name: Clean up after failure
|
|
|
|
# run on a cleanup failure or if cancelled
|
|
|
|
if: (failure() && (steps.terminate-cluster.conclusion == 'failure' || steps.delete-iam.conclusion == 'failure')) || cancelled()
|
|
|
|
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
|
|
|
|
|
2023-08-21 08:36:28 -04:00
|
|
|
notify-failure:
|
|
|
|
name: Notify about failure
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
needs: e2e-test
|
|
|
|
if: |
|
|
|
|
failure() &&
|
|
|
|
github.ref == 'refs/heads/main' &&
|
|
|
|
inputs.scheduled
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2024-06-19 09:19:41 -04:00
|
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
2023-08-21 08:36:28 -04:00
|
|
|
with:
|
|
|
|
ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}
|
|
|
|
|
2023-11-08 09:27:40 -05:00
|
|
|
- name: Setup bazel
|
|
|
|
uses: ./.github/actions/setup_bazel_nix
|
|
|
|
|
2023-08-21 08:36:28 -04:00
|
|
|
- name: Notify about failure
|
|
|
|
continue-on-error: true
|
2023-11-15 02:48:13 -05:00
|
|
|
uses: ./.github/actions/notify_e2e_failure
|
2023-08-21 08:36:28 -04:00
|
|
|
with:
|
|
|
|
projectWriteToken: ${{ secrets.PROJECT_WRITE_TOKEN }}
|
|
|
|
test: Windows E2E Test
|
|
|
|
provider: Azure
|
2024-01-29 05:52:41 -05:00
|
|
|
attestationVariant: "azure-sev-snp"
|