From 2b760bf1c1d3e52e8c6648e4f26723f6aefa6afb Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Thu, 10 Nov 2022 17:28:13 -0500 Subject: [PATCH] Warn user when helm fails due to large files not being ignored (#32425) Co-authored-by: Ben Broderick Phillips --- .../stress-test-deployment-lib.ps1 | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) 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 f6d1ada177f90..6db9ac33c7be5 100644 --- a/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 +++ b/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 @@ -162,8 +162,10 @@ function DeployStressTests( -login:$login } - Write-Host "Releases deployed by $deployer" - Run helm list --all-namespaces -l deployId=$deployer + if ($FailedCommands.Count -lt $pkgs.Count) { + Write-Host "Releases deployed by $deployer" + Run helm list --all-namespaces -l deployId=$deployer + } if ($FailedCommands) { Write-Warning "The following commands failed:" @@ -287,17 +289,27 @@ function DeployStressPackage( } Write-Host "Installing or upgrading stress test $($pkg.ReleaseName) from $($pkg.Directory)" - Run helm upgrade $pkg.ReleaseName $pkg.Directory ` - -n $pkg.Namespace ` - --install ` - --set stress-test-addons.env=$environment ` - --values (Join-Path $pkg.Directory generatedValues.yaml) + $result = (Run helm upgrade $pkg.ReleaseName $pkg.Directory ` + -n $pkg.Namespace ` + --install ` + --set stress-test-addons.env=$environment ` + --values (Join-Path $pkg.Directory generatedValues.yaml)) 2>&1 + if ($LASTEXITCODE) { - # Issues like 'UPGRADE FAILED: another operation (install/upgrade/rollback) is in progress' - # can be the result of cancelled `upgrade` operations (e.g. ctrl-c). - # See https://github.com/helm/helm/issues/4558 - Write-Warning "The issue may be fixable by first running 'helm rollback -n $($pkg.Namespace) $($pkg.ReleaseName)'" - return + # Error: UPGRADE FAILED: create: failed to create: Secret "sh.helm.release.v1.stress-test.v3" is invalid: data: Too long: must have at most 1048576 bytes + # Error: UPGRADE FAILED: create: failed to create: Request entity too large: limit is 3145728 + if ($result -like "*Too long*" -or $result -like "*Too large*") { + $result + Write-Warning "*** Ensure any files or directories not part of the stress config are added to .helmignore ***" + Write-Warning "*** See https://helm.sh/docs/chart_template_guide/helm_ignore_file/ ***" + return + } else { + # Issues like 'UPGRADE FAILED: another operation (install/upgrade/rollback) is in progress' + # can be the result of cancelled `upgrade` operations (e.g. ctrl-c). + # See https://github.com/helm/helm/issues/4558 + Write-Warning "The issue may be fixable by first running 'helm rollback -n $($pkg.Namespace) $($pkg.ReleaseName)'" + return + } } # Helm 3 stores release information in kubernetes secrets. The only way to add extra labels around