Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lemeurherve committed Oct 29, 2023
1 parent 68729ec commit fd03442
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,8 @@ $baseDockerBuildCmd = '{0} build --parallel --pull' -f $baseDockerCmd
$compose = Invoke-Expression "$baseDockerCmd config --format=json" 2>$null | ConvertFrom-Json

foreach ($service in $compose.services.PSObject.Properties) {
$value = $service.Value

$builds[$value.image] = @{
'Tags' = $value.build.tags;
$builds[$service.Value.image] = @{
'AdditionalTags' = $service.Value.build.tags;
}
}

Expand Down Expand Up @@ -118,8 +116,7 @@ function Test-Image {
Write-Host "= TEST: Testing image ${ImageName}:"

$env:AGENT_IMAGE = $ImageName
# $serviceName = $ImageName.SubString(0, $ImageName.IndexOf('-'))
$env:BUILD_CONTEXT = './' # Invoke-Expression "$baseDockerCmd config" 2>$null | yq -r ".services.${serviceName}.build.context"
$env:BUILD_CONTEXT = './'
$env:VERSION = "$RemotingVersion-$BuildNumber"

if(Test-Path ".\target\$ImageName") {
Expand All @@ -141,11 +138,10 @@ function Test-Image {
}

if($target -eq "test") {
Write-Host "= TEST: Starting test harness"
if ($DryRun) {
Write-Host "= TEST: (dry-run) test harness"
} else {
Write-Host "= TEST: Starting test harness"

$mod = Get-InstalledModule -Name Pester -MinimumVersion 5.3.0 -MaximumVersion 5.3.3 -ErrorAction SilentlyContinue
if($null -eq $mod) {
Write-Host "= TEST: Pester 5.3.x not found: installing..."
Expand Down Expand Up @@ -182,7 +178,7 @@ if($target -eq "test") {

# Fail if any test failures
if($testFailed -ne $false) {
Write-Error "Test stage failed!"
Write-Error "= TEST: stage failed!"
exit 1
} else {
Write-Host "= TEST: stage passed!"
Expand All @@ -195,9 +191,9 @@ if($target -eq "publish") {
$true { Write-Host "$baseDockerCmd push" }
$false { Invoke-Expression "$baseDockerCmd push" }
}
# Fail if any issues when publising the docker images
# Fail if any issues when publishing the docker images
if($lastExitCode -ne 0) {
Write-Error "Publish failed!"
Write-Error "= PUBLISH: failed!"
exit 1
}
}
Expand Down

0 comments on commit fd03442

Please sign in to comment.