Mercurial > public > develkit
diff init20.gradle @ 209:07baf02b6034
add helper for calculating imageid
author | smith@nwoca.org |
---|---|
date | Sat, 19 Dec 2015 15:30:52 +0000 |
parents | cf65e7327fe8 |
children | 068d09f5b627 |
line wrap: on
line diff
--- a/init20.gradle Sat Dec 19 14:26:46 2015 +0000 +++ b/init20.gradle Sat Dec 19 15:30:52 2015 +0000 @@ -64,6 +64,8 @@ gradle.ext.branchHash = gradle.branch.hash println "${gradle.hgRepositoryUrl} ${gradle.branch}" println "$gradle.runtimeInfo" +println gradle.branch +println gradle.branch.imageId loadEnvironments() @@ -571,10 +573,11 @@ -@ToString +@ToString(includes=['name','shortName','buildVersion','imageId'],includeNames= true) class BranchInfo { def name def stream = "none" + def buildNumber = "" BranchInfo(name) { this.name = name @@ -583,7 +586,20 @@ } this.name = this.name.replace('@', '-') determineStream() + buildNumber = System.getenv('bamboo_buildNumber') ?: "" } + + def getShortName() { + def result = name.contains('/') ? name.split('/')[1] : name + } + + def getBuildVersion() { + stream in ['release','hotfix'] ? shortName - "v": "" + } + + def getImageId() { + (buildVersion ?: shortName.take(20)) + (buildNumber ? "-${buildNumber}" : "") + } def getHash() { generateMD5(name)