Sync eng/common directory with azure-sdk-tools for PR 5911 (#4563)

* 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 <bebroder@microsoft.com>

---------

Co-authored-by: Albert Cheng <albertcheng@microsoft.com>
Co-authored-by: Albert Cheng <38804567+ckairen@users.noreply.github.com>
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
This commit is contained in:
Azure SDK Bot 2023-04-20 14:16:14 -07:00 committed by GitHub
parent 00b38d6b9f
commit 26e3b35c17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
@ -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
@ -376,6 +379,14 @@ 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
}
@ -383,11 +394,11 @@ function CheckDependencies()
}
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>