diff --git a/eng/common/scripts/stress-testing/find-all-stress-packages.ps1 b/eng/common/scripts/stress-testing/find-all-stress-packages.ps1 index 7a68de0fe4a7..73731e4104c3 100644 --- a/eng/common/scripts/stress-testing/find-all-stress-packages.ps1 +++ b/eng/common/scripts/stress-testing/find-all-stress-packages.ps1 @@ -7,6 +7,8 @@ class StressTestPackageInfo { [string]$Namespace [string]$Directory [string]$ReleaseName + [string]$Dockerfile + [string]$DockerBuildDir } function FindStressPackages([string]$directory, [hashtable]$filters = @{}, [switch]$CI) { @@ -52,6 +54,8 @@ function NewStressTestPackageInfo([hashtable]$chart, [System.IO.FileInfo]$chartF Namespace = $namespace.ToLower() Directory = $chartFile.DirectoryName ReleaseName = $chart.name + Dockerfile = $chart.annotations.dockerfile + DockerBuildDir = $chart.annotations.dockerbuilddir } } diff --git a/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 b/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 index 2e1bf5747790..a3edc3ba956e 100644 --- a/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 +++ b/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 @@ -150,11 +150,24 @@ function DeployStressPackage( } $imageTag += "/$($pkg.Namespace)/$($pkg.ReleaseName):${deployId}" - $dockerFilePath = "$($pkg.Directory)/Dockerfile" + $dockerFilePath = if ($pkg.Dockerfile) { + Join-Path $pkg.Directory $pkg.Dockerfile + } else { + "$($pkg.Directory)/Dockerfile" + } + $dockerFilePath = [System.IO.Path]::GetFullPath($dockerFilePath) + if ($pushImages -and (Test-Path $dockerFilePath)) { Write-Host "Building and pushing stress test docker image '$imageTag'" $dockerFile = Get-ChildItem $dockerFilePath - Run docker build -t $imageTag -f $dockerFile.FullName $dockerFile.DirectoryName + $dockerBuildFolder = if ($pkg.DockerBuildDir) { + Join-Path $pkg.Directory $pkg.DockerBuildDir + } else { + $dockerFile.DirectoryName + } + $dockerBuildFolder = [System.IO.Path]::GetFullPath($dockerBuildFolder).Trim() + + Run docker build -t $imageTag -f $dockerFile $dockerBuildFolder if ($LASTEXITCODE) { return } Run docker push $imageTag if ($LASTEXITCODE) {