Skip to content

Commit

Permalink
Sync eng/common directory with azure-sdk-tools for PR 5911 (#34576)
Browse files Browse the repository at this point in the history
* stress test warning against breaking helm versions

* import

* pr update

* Update eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1

Co-authored-by: Ben Broderick Phillips <[email protected]>

---------

Co-authored-by: Albert Cheng <[email protected]>
Co-authored-by: Albert Cheng <[email protected]>
Co-authored-by: Ben Broderick Phillips <[email protected]>
  • Loading branch information
4 people authored Apr 20, 2023
1 parent 71862e1 commit 09844b9
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 09844b9

Please sign in to comment.