comparison init20.gradle @ 210:068d09f5b627

improve deploy name
author smith@nwoca.org
date Tue, 22 Dec 2015 16:45:33 +0000
parents 07baf02b6034
children 908950abd490
comparison
equal deleted inserted replaced
209:07baf02b6034 210:068d09f5b627
64 gradle.ext.branchHash = gradle.branch.hash 64 gradle.ext.branchHash = gradle.branch.hash
65 println "${gradle.hgRepositoryUrl} ${gradle.branch}" 65 println "${gradle.hgRepositoryUrl} ${gradle.branch}"
66 println "$gradle.runtimeInfo" 66 println "$gradle.runtimeInfo"
67 println gradle.branch 67 println gradle.branch
68 println gradle.branch.imageId 68 println gradle.branch.imageId
69 println gradle.branch.deployName
69 70
70 loadEnvironments() 71 loadEnvironments()
71 72
72 gradle.environment.put('hgRepositoryUrl', gradle.hgRepositoryUrl) 73 gradle.environment.put('hgRepositoryUrl', gradle.hgRepositoryUrl)
73 gradle.environment.put('branchName', gradle.branch.name) 74 gradle.environment.put('branchName', gradle.branch.name)
571 572
572 } 573 }
573 574
574 575
575 576
576 @ToString(includes=['name','shortName','buildVersion','imageId'],includeNames= true) 577 @ToString(includes=['name','shortName','buildVersion','imageId','deployName'],includeNames= true)
577 class BranchInfo { 578 class BranchInfo {
578 def name 579 def name
579 def stream = "none" 580 def stream = "none"
580 def buildNumber = "" 581 def buildNumber = ""
581 582
596 def getBuildVersion() { 597 def getBuildVersion() {
597 stream in ['release','hotfix'] ? shortName - "v": "" 598 stream in ['release','hotfix'] ? shortName - "v": ""
598 } 599 }
599 600
600 def getImageId() { 601 def getImageId() {
601 (buildVersion ?: shortName.take(20)) + (buildNumber ? "-${buildNumber}" : "") 602 (buildVersion ?: shortName.take(25)) + (buildNumber ? "-${buildNumber}" : "-0")
602 } 603 }
603 604
605 def getDeployName() {
606 (buildVersion ?: shortName.take(25)).toLowerCase().collectReplacements {
607 ('a'..'z').contains(it) || ('0'..'9').contains(it) || it == "-" ? null : '-'
608 }
609 }
610
604 def getHash() { 611 def getHash() {
605 generateMD5(name) 612 generateMD5(name)
606 } 613 }
607 def generateMD5(String s) { 614 def generateMD5(String s) {
608 def digest = java.security.MessageDigest.getInstance("MD5") 615 def digest = java.security.MessageDigest.getInstance("MD5")