Skip to content

Commit

Permalink
simplify $builds
Browse files Browse the repository at this point in the history
  • Loading branch information
lemeurherve committed Jan 14, 2024
1 parent 9c0cee4 commit b92b0ff
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -146,20 +146,17 @@ foreach($agentType in $AgentTypes) {
Copy-Item -Path $originalDockerComposeFile -Destination $finalDockerComposeFile
# If it's an "agent" type, add the corresponding target
if($agentType -eq 'agent') {
yq '.services.[].build.target = \"agent\"' $originalDockerComposeFile | Out-File -FilePath $finalDockerComposeFile
yq '.services.[].build.target = "agent"' $originalDockerComposeFile | Out-File -FilePath $finalDockerComposeFile
}

$builds = @{}

$compose = Invoke-Expression "$baseDockerCmd config --format=json" 2>$null | ConvertFrom-Json
foreach ($service in $compose.services.PSObject.Properties) {
$builds[$service.Value.image] = @{
'AdditionalTags' = $service.Value.build.tags;
}
$builds += $service.Value.image
}

Write-Host "= PREPARE: List of $Organisation/$env:DOCKERHUB_REPO images and tags to be processed:"
ConvertTo-Json $builds
Invoke-Expression "$baseDockerCmd config"

Write-Host "= BUILD: Building all images..."
Expand Down Expand Up @@ -206,7 +203,7 @@ foreach($agentType in $AgentTypes) {
Write-Host "= TEST: Testing all ${agentType} images..."
# Only fail the run afterwards in case of any test failures
$testFailed = $false
foreach($image in $builds.Keys) {
foreach($image in $builds) {
$testFailed = $testFailed -or (Test-Image ('{0}|{1}' -f $agentType, $image))
}

Expand Down

0 comments on commit b92b0ff

Please sign in to comment.