Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup(Windows): remove obsolete Build build.ps1 script argument #549

Merged
merged 6 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pipeline {
./build.sh -r ${remotingVersion} -b ${buildNumber} -d publish
"""
} else {
powershell "& ./build.ps1 -PushVersions -RemotingVersion $remotingVersion -BuildNumber $buildNumber -DisableEnvProps publish"
powershell "& ./build.ps1 -RemotingVersion $remotingVersion -BuildNumber $buildNumber -DisableEnvProps publish"
}
}
} else {
Expand Down
61 changes: 10 additions & 51 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
Param(
[Parameter(Position=1)]
[String] $Target = "build",
[String] $Build = '',
[String] $RemotingVersion = '3192.v713e3b_039fb_e',
[String] $BuildNumber = '1',
[switch] $PushVersions = $false,
[switch] $DisableEnvProps = $false,
[switch] $DryRun = $false
)
Expand Down Expand Up @@ -111,19 +109,13 @@ Invoke-Expression "$baseDockerCmd config --services" 2>$null | ForEach-Object {
Write-Host "= PREPARE: List of $Organization/$Repository images and tags to be processed:"
ConvertTo-Json $builds

$dockerBuildCmd = $baseDockerBuildCmd
$current = 'all images'
if(![System.String]::IsNullOrWhiteSpace($Build) -and $builds.ContainsKey($Build)) {
$current = "$Build image"
$dockerBuildCmd = '{0} {1}' -f $baseDockerBuildCmd, $Build
}
Write-Host "= BUILD: Building ${current}..."
Write-Host "= BUILD: Building all images..."
if ($DryRun) {
Write-Host "(dry-run) $dockerBuildCmd"
Write-Host "(dry-run) $baseDockerBuildCmd"
} else {
Invoke-Expression $dockerBuildCmd
Invoke-Expression $baseDockerBuildCmd
}
Write-Host "= BUILD: Finished building ${current}"
Write-Host "= BUILD: Finished building all images."

if($lastExitCode -ne 0) {
exit $lastExitCode
Expand Down Expand Up @@ -190,13 +182,9 @@ if($target -eq "test") {
$configuration.Output.Verbosity = 'Diagnostic'
$configuration.CodeCoverage.Enabled = $false

if(![System.String]::IsNullOrWhiteSpace($Build) -and $builds.ContainsKey($Build)) {
Test-Image $Build
} else {
Write-Host "= TEST: Testing all images..."
foreach($image in $builds.Keys) {
Test-Image $image
}
Write-Host "= TEST: Testing all images..."
foreach($image in $builds.Keys) {
Test-Image $image
}

# Fail if any test failures
Expand Down Expand Up @@ -229,41 +217,12 @@ function Publish-Image {
if($target -eq "publish") {
# Only fail the run afterwards in case of any issues when publishing the docker images
$publishFailed = 0
if(![System.String]::IsNullOrWhiteSpace($Build) -and $builds.ContainsKey($Build)) {
foreach($tag in $Builds[$Build]['Tags']) {
Publish-Image "$Build" "${Organization}/${Repository}:${tag}"
foreach($b in $builds.Keys) {
foreach($tag in $Builds[$b]['Tags']) {
Publish-Image "$b" "${Organization}/${Repository}:${tag}"
if($lastExitCode -ne 0) {
$publishFailed = 1
}

if($PushVersions) {
if($tag -eq 'latest') {
$buildTag = "$RemotingVersion-$BuildNumber"
Publish-Image "$Build" "${Organization}/${Repository}:${buildTag}"
if($lastExitCode -ne 0) {
$publishFailed = 1
}
}
}
}
} else {
foreach($b in $builds.Keys) {
foreach($tag in $Builds[$b]['Tags']) {
Publish-Image "$b" "${Organization}/${Repository}:${tag}"
if($lastExitCode -ne 0) {
$publishFailed = 1
}

if($PushVersions) {
if($tag -eq 'latest') {
$buildTag = "$RemotingVersion-$BuildNumber"
Publish-Image "$b" "${Organization}/${Repository}:${buildTag}"
if($lastExitCode -ne 0) {
$publishFailed = 1
}
}
}
}
}
}

Expand Down