diff init20.gradle @ 210:068d09f5b627

improve deploy name
author smith@nwoca.org
date Tue, 22 Dec 2015 16:45:33 +0000
parents 07baf02b6034
children 908950abd490
line wrap: on
line diff
--- a/init20.gradle	Sat Dec 19 15:30:52 2015 +0000
+++ b/init20.gradle	Tue Dec 22 16:45:33 2015 +0000
@@ -66,6 +66,7 @@
 println "$gradle.runtimeInfo"
 println gradle.branch
 println gradle.branch.imageId
+println gradle.branch.deployName
 
 loadEnvironments()
 
@@ -573,7 +574,7 @@
 
 
 
-@ToString(includes=['name','shortName','buildVersion','imageId'],includeNames= true)
+@ToString(includes=['name','shortName','buildVersion','imageId','deployName'],includeNames= true)
 class BranchInfo {
     def name
     def stream = "none"
@@ -598,9 +599,15 @@
 	}
 	
 	def getImageId() {
-		(buildVersion ?:  shortName.take(20)) + (buildNumber ? "-${buildNumber}" : "")
+		(buildVersion ?:  shortName.take(25)) + (buildNumber ? "-${buildNumber}" : "-0")
 	}
 
+	def getDeployName() {
+		(buildVersion ?:  shortName.take(25)).toLowerCase().collectReplacements {
+			('a'..'z').contains(it) || ('0'..'9').contains(it) || it == "-" ? null : '-'
+		}
+	}
+	
     def getHash() {
         generateMD5(name)
     }