Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync eng/common directory with azure-sdk-tools for PR 4944 #24230

Merged
merged 3 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions eng/common/scripts/stress-testing/deploy-stress-tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand Down