From b92b0ff6b5094fa4cc1a282401d154ef61bea6bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Le=20Meur?= Date: Sun, 14 Jan 2024 20:48:01 +0100 Subject: [PATCH] simplify $builds --- build.ps1 | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/build.ps1 b/build.ps1 index acc27485d..3343125a3 100644 --- a/build.ps1 +++ b/build.ps1 @@ -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..." @@ -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)) }