Skip to content

Commit

Permalink
ci: add error handling to e2e windows liveness probe (#3018)
Browse files Browse the repository at this point in the history
* workflows: add error handling to e2e windows liveness probe

* update retry condition in last iteration

* Update liveness probe to check for correct number of nodes

* ci: fix Windows e2e test not pushing required container images (#3021)

* More output when waiting for nodes to get ready
* Create unique resource group name for Windows e2e test
* Push container images on windows CLI build to fix e2e test

---------

Signed-off-by: Daniel Weiße <[email protected]>

* Fix resource group naming

Signed-off-by: Daniel Weiße <[email protected]>

---------

Signed-off-by: Daniel Weiße <[email protected]>
Co-authored-by: Daniel Weiße <[email protected]>
Co-authored-by: Daniel Weiße <[email protected]>
  • Loading branch information
3 people committed Apr 11, 2024
1 parent f6dfea2 commit e89d8e4
Showing 1 changed file with 35 additions and 13 deletions.
48 changes: 35 additions & 13 deletions .github/workflows/e2e-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ jobs:
build-cli:
name: Build Windows CLI
runs-on: ubuntu-22.04
permissions:
id-token: write
checks: write
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
Expand All @@ -26,17 +31,26 @@ jobs:
useCache: "true"
buildBuddyApiKey: ${{ secrets.BUILDBUDDY_ORG_API_KEY }}

- name: Log in to the Container registry
uses: ./.github/actions/container_registry_login
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build CLI
uses: ./.github/actions/build_cli
with:
targetOS: "windows"
targetArch: "amd64"
enterpriseCLI: true
outputPath: "build/constellation"
push: true

- name: Upload CLI artifact
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
path: "bazel-bin/cli/cli_enterprise_windows_amd64"
path: build/constellation.exe
name: "constell-exe"

e2e-test:
Expand All @@ -57,7 +71,6 @@ jobs:
- name: Check CLI version
shell: pwsh
run: |
Move-Item -Path .\cli_enterprise_windows_amd64 -Destination .\constellation.exe
.\constellation.exe version
Add-Content -Path $env:windir\System32\drivers\etc\hosts -Value "`n127.0.0.1`tlicense.confidential.cloud" -Force
Expand All @@ -69,8 +82,10 @@ jobs:
- name: Create IAM configuration
shell: pwsh
run: |
$uid = Get-Random -Minimum 1000 -Maximum 9999
$rgName = "e2e-win-${{ github.run_id }}-${{ github.run_attempt }}-$uid"
.\constellation.exe config generate azure
.\constellation.exe iam create azure --region=westus --resourceGroup=e2eWindoewsRG --servicePrincipal=e2eWindoewsSP --update-config --debug -y
.\constellation.exe iam create azure --region=westus --resourceGroup=$rgName-rg --servicePrincipal=$rgName-sp --update-config --debug -y
- name: Login to Azure (Cluster service principal)
uses: ./.github/actions/login_azure
Expand All @@ -96,24 +111,31 @@ jobs:
Write-Host "Retry ${retryCount}: Checking node status..."
$nodesOutput = & kubectl get nodes --kubeconfig "$PWD\constellation-admin.conf"
$status = $?
$nodesOutput
$lines = $nodesOutput -split "`r?`n" | Select-Object -Skip 1
if ($status) {
$lines = $nodesOutput -split "`r?`n" | Select-Object -Skip 1
$allNodesReady = $true
if ($lines.count -eq 4) {
$allNodesReady = $true
foreach ($line in $lines) {
$columns = $line -split '\s+' | Where-Object { $_ -ne '' }
foreach ($line in $lines) {
$columns = $line -split '\s+' | Where-Object { $_ -ne '' }
$nodeName = $columns[0]
$status = $columns[1]
$nodeName = $columns[0]
$status = $columns[1]
if ($status -ne "Ready") {
Write-Host "Node $nodeName is not ready!"
$allNodesReady = $false
if ($status -ne "Ready") {
Write-Host "Node $nodeName is not ready!"
$allNodesReady = $false
}
}
}
}
if (-not $allNodesReady) {
if (-not $allNodesReady -and $retryCount -lt $maxRetries) {
Write-Host "Retrying in $retryIntervalSeconds seconds..."
Start-Sleep -Seconds $retryIntervalSeconds
}
Expand Down

0 comments on commit e89d8e4

Please sign in to comment.