Skip to content

Commit b84b425

Browse files
committed
move Test-Image function higher
1 parent f094c03 commit b84b425

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

make.ps1

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -48,37 +48,6 @@ if([String]::IsNullOrWhiteSpace($env:WAR_URL)) {
4848
$env:WAR_URL = 'https://get.jenkins.io/{0}/{1}/jenkins.war' -f $releaseLine, $env:JENKINS_VERSION
4949
}
5050

51-
$items = $ImageType.Split('-')
52-
$env:WINDOWS_FLAVOR = $items[0]
53-
$env:WINDOWS_VERSION = $items[1]
54-
55-
# Retrieve the sha256 corresponding to the war file
56-
$warShaURL = '{0}.sha256' -f $env:WAR_URL
57-
$webClient = New-Object System.Net.WebClient
58-
$env:WAR_SHA = $webClient.DownloadString($warShaURL).Split(' ')[0]
59-
60-
$env:COMMIT_SHA=$(git rev-parse HEAD)
61-
62-
$baseDockerCmd = 'docker-compose --file=build-windows.yaml'
63-
$baseDockerBuildCmd = '{0} build --parallel --pull' -f $baseDockerCmd
64-
65-
Write-Host "= PREPARE: List of $Organisation/$Repository images and tags to be processed:"
66-
Invoke-Expression "$baseDockerCmd config"
67-
68-
if($target -eq 'build') {
69-
Write-Host '= BUILD: Building all images...'
70-
switch ($DryRun) {
71-
$true { Write-Host "(dry-run) $baseDockerBuildCmd" }
72-
$false { Invoke-Expression $baseDockerBuildCmd }
73-
}
74-
Write-Host '= BUILD: Finished building all images.'
75-
76-
if($lastExitCode -ne 0 -and !$DryRun) {
77-
Write-Error "= BUILD: failed!"
78-
exit $lastExitCode
79-
}
80-
}
81-
8251
function Test-Image {
8352
param (
8453
$ImageName
@@ -110,6 +79,37 @@ function Test-Image {
11079
return $failed
11180
}
11281

82+
$items = $ImageType.Split('-')
83+
$env:WINDOWS_FLAVOR = $items[0]
84+
$env:WINDOWS_VERSION = $items[1]
85+
86+
# Retrieve the sha256 corresponding to the war file
87+
$warShaURL = '{0}.sha256' -f $env:WAR_URL
88+
$webClient = New-Object System.Net.WebClient
89+
$env:WAR_SHA = $webClient.DownloadString($warShaURL).Split(' ')[0]
90+
91+
$env:COMMIT_SHA=$(git rev-parse HEAD)
92+
93+
$baseDockerCmd = 'docker-compose --file=build-windows.yaml'
94+
$baseDockerBuildCmd = '{0} build --parallel --pull' -f $baseDockerCmd
95+
96+
Write-Host "= PREPARE: List of $Organisation/$Repository images and tags to be processed:"
97+
Invoke-Expression "$baseDockerCmd config"
98+
99+
if($target -eq 'build') {
100+
Write-Host '= BUILD: Building all images...'
101+
switch ($DryRun) {
102+
$true { Write-Host "(dry-run) $baseDockerBuildCmd" }
103+
$false { Invoke-Expression $baseDockerBuildCmd }
104+
}
105+
Write-Host '= BUILD: Finished building all images.'
106+
107+
if($lastExitCode -ne 0 -and !$DryRun) {
108+
Write-Error "= BUILD: failed!"
109+
exit $lastExitCode
110+
}
111+
}
112+
113113
if($target -eq 'test') {
114114
if ($DryRun) {
115115
Write-Host '(dry-run) test'

0 commit comments

Comments
 (0)