From 09844b92b4afdf2801095e2780fee1fd43feacca Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Thu, 20 Apr 2023 14:16:21 -0700 Subject: [PATCH] Sync eng/common directory with azure-sdk-tools for PR 5911 (#34576) * 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 --------- Co-authored-by: Albert Cheng Co-authored-by: Albert Cheng <38804567+ckairen@users.noreply.github.com> Co-authored-by: Ben Broderick Phillips --- .../stress-testing/stress-test-deployment-lib.ps1 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 b/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 index a7d45ae66f27a..5ad163c6a848b 100644 --- a/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 +++ b/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 @@ -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: