From 7327e7c8961c371a6bcb300bda711717e9f00cb6 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Mon, 24 Jan 2022 16:30:36 -0800 Subject: [PATCH] Syncing eng/common (#16904) Co-authored-by: Albert Cheng --- .../stress-testing/find-all-stress-packages.ps1 | 4 ++++ .../stress-test-deployment-lib.ps1 | 17 +++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) 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) {