Skip to content

Commit

Permalink
Automatically compile bicep files in stress test deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
benbp authored and azure-sdk committed Aug 10, 2021
1 parent 7d5efb8 commit 227b841
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions eng/common/scripts/stress-testing/deploy-stress-tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,14 @@ function DeployStressPackage(
}

Run helm dependency update $pkg.Directory
if ($LASTEXITCODE) { return }

if ($pushImages) {
if ($LASTEXITCODE) { return $LASTEXITCODE }
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`
Expand All @@ -132,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
}
}
}
Expand All @@ -158,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
Expand Down

0 comments on commit 227b841

Please sign in to comment.