Sync eng/common directory with azure-sdk-tools for PR 1866 (#2728)

* Deploy for stress tests at resource group scope

* Automatically compile bicep files in stress test deploy script

Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
This commit is contained in:
Azure SDK Bot 2021-08-11 13:37:00 -07:00 committed by GitHub
parent e5c60f913c
commit 33e56e1bbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -116,10 +116,15 @@ function DeployStressPackage(
exit 1
}
if ($pushImages) {
Run helm dependency update $pkg.Directory
if ($LASTEXITCODE) { return $LASTEXITCODE }
Run helm dependency update $pkg.Directory
if ($LASTEXITCODE) { return }
if (Test-Path "$($pkg.Directory)/test-resources.bicep") {
Run az bicep build -f "$($pkg.Directory)/test-resources.bicep"
if ($LASTEXITCODE) { return }
}
if ($pushImages) {
$dockerFiles = Get-ChildItem "$($pkg.Directory)/Dockerfile*"
foreach ($dockerFile in $dockerFiles) {
# Infer docker image name from parent directory name, if file is named `Dockerfile`
@ -131,13 +136,13 @@ function DeployStressPackage(
$imageTag = "${registry}.azurecr.io/$($repository.ToLower())/$($imageName):$deployId"
Write-Host "Building and pushing stress test docker image '$imageTag'"
Run docker build -t $imageTag -f $dockerFile.FullName $dockerFile.DirectoryName
if ($LASTEXITCODE) { return $LASTEXITCODE }
if ($LASTEXITCODE) { return }
Run docker push $imageTag
if ($LASTEXITCODE) {
if ($PSCmdlet.ParameterSetName -ne 'DoLogin') {
Write-Warning "If docker push is failing due to authentication issues, try calling this script with '-Login'"
}
return $LASTEXITCODE
return
}
}
}
@ -157,7 +162,7 @@ function DeployStressPackage(
# 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 $LASTEXITCODE
return
}
# Helm 3 stores release information in kubernetes secrets. The only way to add extra labels around