Skip to content

Commit

Permalink
stress test error out for breaking helm versions (#5911)
Browse files Browse the repository at this point in the history
Stress test deployment now requires helm version 3.11.0+, now throwing a more descriptive error
  • Loading branch information
ckairen authored Apr 20, 2023
1 parent 80de661 commit c98e02f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ $ErrorActionPreference = 'Stop'
$FailedCommands = New-Object Collections.Generic.List[hashtable]

. (Join-Path $PSScriptRoot "../Helpers" PSModule-Helpers.ps1)
. (Join-Path $PSScriptRoot "../SemVer.ps1")

$limitRangeSpec = @"
apiVersion: v1
Expand All @@ -18,6 +19,8 @@ spec:
type: Container
"@

$MIN_HELM_VERSION = "3.11.0"

# Powershell does not (at time of writing) treat exit codes from external binaries
# as cause for stopping execution, so do this via a wrapper function.
# See https://github.com/PowerShell/PowerShell-RFC/pull/277
Expand Down Expand Up @@ -376,18 +379,26 @@ function CheckDependencies()
}
}

# helm version example: v3.11.2+g912ebc1
$helmVersionString = (helm version --short).substring(1) -replace '\+.*',''
$helmVersion = [AzureEngSemanticVersion]::new($helmVersionString)
$minHelmVersion = [AzureEngSemanticVersion]::new($MIN_HELM_VERSION)
if ($helmVersion.CompareTo($minHelmVersion) -lt 0) {
throw "Please update helm to version >= $MIN_HELM_VERSION (current version: $helmVersionString)`nAdditional information for updating helm version can be found here: https://helm.sh/docs/intro/install/"
}

if ($shouldError) {
exit 1
}

}

function generateRetryTestsHelmValues ($pkg, $releaseName, $generatedHelmValues) {

$podOutput = RunOrExitOnFailure kubectl get pods -n $pkg.namespace -o json
$pods = $podOutput | ConvertFrom-Json

# Get all jobs within this helm release

$helmStatusOutput = RunOrExitOnFailure helm status -n $pkg.Namespace $pkg.ReleaseName --show-resources
# -----Example output-----
# NAME: <Release Name>
Expand Down

0 comments on commit c98e02f

Please sign in to comment.