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

stress test error out for breaking helm versions #5911

Merged
4 commits merged into from
Apr 20, 2023
Merged
Changes from 3 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
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,27 @@ 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) {
CheckDependencies
ckairen marked this conversation as resolved.
Show resolved Hide resolved

$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