Handle skipping docker build when PushImages is set and there is no dockerfile (#3174)

Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
This commit is contained in:
Azure SDK Bot 2022-01-06 14:25:52 -08:00 committed by GitHub
parent 4f8f96eb88
commit 12bae6e64b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -156,9 +156,10 @@ function DeployStressPackage(
}
$imageTag += "/$($pkg.Namespace)/$($pkg.ReleaseName):${deployId}"
if ($pushImages) {
$dockerFilePath = "$($pkg.Directory)/Dockerfile"
if ($pushImages -and (Test-Path $dockerFilePath)) {
Write-Host "Building and pushing stress test docker image '$imageTag'"
$dockerFile = Get-ChildItem "$($pkg.Directory)/Dockerfile"
$dockerFile = Get-ChildItem $dockerFilePath
Run docker build -t $imageTag -f $dockerFile.FullName $dockerFile.DirectoryName
if ($LASTEXITCODE) { return }
Run docker push $imageTag