Skip to content

Commit

Permalink
Sync eng/common directory with azure-sdk-tools for PR 4713 (#24023)
Browse files Browse the repository at this point in the history
* stress matrix docker args

* github pr update

Co-authored-by: Albert Cheng <[email protected]>
  • Loading branch information
azure-sdk and ckairen authored Nov 29, 2022
1 parent 1447a75 commit f97dc41
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,9 @@ function DeployStressPackage(
$dockerBuildDir = Split-Path $dockerFilePath
}
$dockerBuildDir = [System.IO.Path]::GetFullPath($dockerBuildDir).Trim()
$dockerBuildConfigs += @{"dockerFilePath"=$dockerFilePath; "dockerBuildDir"=$dockerBuildDir}
$dockerBuildConfigs += @{"dockerFilePath"=$dockerFilePath;
"dockerBuildDir"=$dockerBuildDir;
"scenario"=$scenario}
}
}
if ($pkg.Dockerfile -or $pkg.DockerBuildDir) {
Expand All @@ -256,8 +258,15 @@ function DeployStressPackage(
Write-Host "Building and pushing stress test docker image '$imageTag'"
$dockerFile = Get-ChildItem $dockerFilePath

Run docker build -t $imageTag -f $dockerFile $dockerBuildFolder
$dockerBuildCmd = "docker", "build", "-t", $imageTag, "-f", $dockerFile
foreach ($buildArg in $dockerBuildConfig.scenario.GetEnumerator()) {
$dockerBuildCmd += "--build-arg"
$dockerBuildCmd += "'$($buildArg.Key)'='$($buildArg.Value)'"
}
$dockerBuildCmd += $dockerBuildFolder

Run @dockerBuildCmd

Write-Host "`nContainer image '$imageTag' successfully built. To run commands on the container locally:" -ForegroundColor Blue
Write-Host " docker run -it $imageTag" -ForegroundColor DarkBlue
Write-Host " docker run -it $imageTag <shell, e.g. 'bash' 'pwsh' 'sh'>" -ForegroundColor DarkBlue
Expand Down

0 comments on commit f97dc41

Please sign in to comment.