Sync eng/common directory with azure-sdk-tools for PR 4944 (#4191)

* Helm template for deploy script

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

Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>

* fixing helm upgrade command

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 2022-12-14 12:48:57 -08:00 committed by GitHub
parent db6f71fbbb
commit 111776e6af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 8 deletions

View File

@ -26,6 +26,9 @@ param(
# Override remote stress-test-addons with local on-disk addons for development
[System.IO.FileInfo]$LocalAddonsPath,
# Renders chart templates locally without deployment
[Parameter(Mandatory=$False)][switch]$Template,
# Matrix generation parameters
[Parameter(Mandatory=$False)][string]$MatrixFileName,
[Parameter(Mandatory=$False)][string]$MatrixSelection,

View File

@ -97,6 +97,7 @@ function DeployStressTests(
return $true
})]
[System.IO.FileInfo]$LocalAddonsPath,
[Parameter(Mandatory=$False)][switch]$Template,
[Parameter(Mandatory=$False)][string]$MatrixFileName,
[Parameter(Mandatory=$False)][string]$MatrixSelection = "sparse",
[Parameter(Mandatory=$False)][string]$MatrixDisplayNameFilter,
@ -298,11 +299,13 @@ function DeployStressPackage(
}
Write-Host "Installing or upgrading stress test $($pkg.ReleaseName) from $($pkg.Directory)"
$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
$generatedConfigPath = Join-Path $pkg.Directory generatedValues.yaml
$subCommand = $Template ? "template" : "upgrade"
$installFlag = $Template ? "" : "--install"
$helmCommandArg = "helm", $subCommand, $pkg.ReleaseName, $pkg.Directory, "-n", $pkg.Namespace, $installFlag, "--set", "stress-test-addons.env=$environment", "--values", $generatedConfigPath
$result = (Run @helmCommandArg) 2>&1 | Write-Host
if ($LASTEXITCODE) {
# 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
@ -324,12 +327,13 @@ function DeployStressPackage(
# Helm 3 stores release information in kubernetes secrets. The only way to add extra labels around
# specific releases (thereby enabling filtering on `helm list`) is to label the underlying secret resources.
# There is not currently support for setting these labels via the helm cli.
$helmReleaseConfig = RunOrExitOnFailure kubectl get secrets `
if(!$Template) {
$helmReleaseConfig = RunOrExitOnFailure kubectl get secrets `
-n $pkg.Namespace `
-l "status=deployed,name=$($pkg.ReleaseName)" `
-o jsonpath='{.items[0].metadata.name}'
Run kubectl label secret -n $pkg.Namespace --overwrite $helmReleaseConfig deployId=$deployId
Run kubectl label secret -n $pkg.Namespace --overwrite $helmReleaseConfig deployId=$deployId
}
}
function CheckDependencies()