Skip to content

Commit be6b515

Browse files
azure-sdkckairen
andauthored
Sync eng/common directory with azure-sdk-tools for PR 4713 (Azure#27705)
* stress matrix docker args * github pr update Co-authored-by: Albert Cheng <[email protected]>
1 parent ed6eaa7 commit be6b515

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,9 @@ function DeployStressPackage(
233233
$dockerBuildDir = Split-Path $dockerFilePath
234234
}
235235
$dockerBuildDir = [System.IO.Path]::GetFullPath($dockerBuildDir).Trim()
236-
$dockerBuildConfigs += @{"dockerFilePath"=$dockerFilePath; "dockerBuildDir"=$dockerBuildDir}
236+
$dockerBuildConfigs += @{"dockerFilePath"=$dockerFilePath;
237+
"dockerBuildDir"=$dockerBuildDir;
238+
"scenario"=$scenario}
237239
}
238240
}
239241
if ($pkg.Dockerfile -or $pkg.DockerBuildDir) {
@@ -256,8 +258,15 @@ function DeployStressPackage(
256258
Write-Host "Building and pushing stress test docker image '$imageTag'"
257259
$dockerFile = Get-ChildItem $dockerFilePath
258260

259-
Run docker build -t $imageTag -f $dockerFile $dockerBuildFolder
261+
$dockerBuildCmd = "docker", "build", "-t", $imageTag, "-f", $dockerFile
262+
foreach ($buildArg in $dockerBuildConfig.scenario.GetEnumerator()) {
263+
$dockerBuildCmd += "--build-arg"
264+
$dockerBuildCmd += "'$($buildArg.Key)'='$($buildArg.Value)'"
265+
}
266+
$dockerBuildCmd += $dockerBuildFolder
260267

268+
Run @dockerBuildCmd
269+
261270
Write-Host "`nContainer image '$imageTag' successfully built. To run commands on the container locally:" -ForegroundColor Blue
262271
Write-Host " docker run -it $imageTag" -ForegroundColor DarkBlue
263272
Write-Host " docker run -it $imageTag <shell, e.g. 'bash' 'pwsh' 'sh'>" -ForegroundColor DarkBlue

0 commit comments

Comments
 (0)