Skip to content

Commit

Permalink
Merge pull request #54 from slide/windows_tag_updates
Browse files Browse the repository at this point in the history
Windows tag updates
  • Loading branch information
slide authored Apr 14, 2020
2 parents f6e162d + f5e74dc commit 78f05e4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
12 changes: 5 additions & 7 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,11 @@ pipeline {
}
}

if (env.TAG_NAME != null) {
def tagItems = env.TAG_NAME.split('-')
if(tagItems.length == 2) {
// we need to build and publish the tag version
infra.withDockerCredentials {
powershell "& ./make.ps1 -PushVersions -Tag ${env.TAG_NAME} publish"
}
def tagName = "${env.TAG_NAME}"
if (tagName ==~ '\\d\\.\\d\\.\\d') {
// we need to build and publish the tag version
infra.withDockerCredentials {
powershell "& ./make.ps1 -PushVersions -VersionTag ${tagName} publish"
}
}
}
Expand Down
22 changes: 11 additions & 11 deletions make.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Param(
[String] $Target = "build",
[String] $AdditionalArgs = '',
[String] $Build = '',
[String] $Tag = '1.0-1',
[String] $VersionTag = '1.0-1',
[switch] $PushVersions = $false
)

Expand Down Expand Up @@ -47,9 +47,9 @@ if(![System.String]::IsNullOrWhiteSpace($Build) -and $builds.ContainsKey($Build)
Invoke-Expression $cmd

if($PushVersions) {
$buildTag = "$Tag-$tag"
$buildTag = "$VersionTag-$tag"
if($tag -eq 'latest') {
$buildTag = "$Tag"
$buildTag = "$VersionTag"
}
Write-Host "Building $Build => tag=$buildTag"
$cmd = "docker build -t {0}/{1}:{2} {3} {4}" -f $Organization, $Repository, $buildTag, $AdditionalArgs, $builds[$Build]['Folder']
Expand All @@ -66,9 +66,9 @@ if(![System.String]::IsNullOrWhiteSpace($Build) -and $builds.ContainsKey($Build)
Invoke-Expression $cmd

if($PushVersions) {
$buildTag = "$Tag-$tag"
$buildTag = "$VersionTag-$tag"
if($tag -eq 'latest') {
$buildTag = "$Tag"
$buildTag = "$VersionTag"
}
Write-Host "Building $Build => tag=$buildTag"
$cmd = "docker build -t {0}/{1}:{2} {3} {4}" -f $Organization, $Repository, $buildTag, $AdditionalArgs, $builds[$b]['Folder']
Expand All @@ -95,14 +95,14 @@ if($Target -eq "test") {

if(![System.String]::IsNullOrWhiteSpace($Build) -and $builds.ContainsKey($Build)) {
$env:FOLDER = $builds[$Build]['Folder']
$env:VERSION = "$RemotingVersion-$BuildNumber"
$env:VERSION = "$VersionTag"
Invoke-Pester -Path tests -EnableExit
Remove-Item env:\FOLDER
Remove-Item env:\VERSION
} else {
foreach($b in $builds.Keys) {
$env:FOLDER = $builds[$b]['Folder']
$env:VERSION = "$RemotingVersion-$BuildNumber"
$env:VERSION = "$VersionTag"
Invoke-Pester -Path tests -EnableExit
Remove-Item env:\FOLDER
Remove-Item env:\VERSION
Expand All @@ -118,9 +118,9 @@ if($Target -eq "publish") {
Invoke-Expression $cmd

if($PushVersions) {
$buildTag = "$RemotingVersion-$BuildNumber-$tag"
$buildTag = "$VersionTag-$tag"
if($tag -eq 'latest') {
$buildTag = "$RemotingVersion-$BuildNumber"
$buildTag = "$VersionTag"
}
Write-Host "Publishing $Build => tag=$buildTag"
$cmd = "docker push {0}/{1}:{2}" -f $Organization, $Repository, $buildTag
Expand All @@ -135,9 +135,9 @@ if($Target -eq "publish") {
Invoke-Expression $cmd

if($PushVersions) {
$buildTag = "$RemotingVersion-$BuildNumber-$tag"
$buildTag = "$VersionTag-$tag"
if($tag -eq 'latest') {
$buildTag = "$RemotingVersion-$BuildNumber"
$buildTag = "$VersionTag"
}
Write-Host "Publishing $Build => tag=$buildTag"
$cmd = "docker push {0}/{1}:{2}" -f $Organization, $Repository, $buildTag
Expand Down

0 comments on commit 78f05e4

Please sign in to comment.