Syncing eng/common (#3271)
Co-authored-by: Albert Cheng <albertcheng@microsoft.com>
This commit is contained in:
parent
f15372a7d1
commit
1a83513ff1
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user