updated to calculate default values for targetRef and targetTag as other projects
Change-Id: I7cd45486b87f7110044c8ed2e5e75b9fd28a33ae
diff --git a/build.gradle b/build.gradle
index 2062f85..dbe3ac5 100644
--- a/build.gradle
+++ b/build.gradle
@@ -19,17 +19,33 @@
}
ext {
-
- // Target registry to be used to publish docker images needed for deployment
- targetReg = project.hasProperty('targetReg') ? project.getProperty('targetReg') : 'localhost:5000'
-
- // The tag used to tag the docker images push to the target registry
- targetTag = project.hasProperty('targetTag') ? project.getProperty('targetTag') : 'candidate'
-
- // Deployment target config file (yaml format); this can be overwritten from the command line
+ // Deployment target config file (yaml format); this can be overwritten from the command line
// using the -PdeployConfig=<file-path> syntax.
deployConfig = project.hasProperty('deployConfig') ? project.getProperty('deployConfig') : './config/default.yml'
+ println "Using deployment config: $deployConfig"
+ File configFile = new File(deployConfig)
+ def yaml = new Yaml()
+ config = yaml.load(configFile.newReader())
+
+ // Upstream registry to simplify filling out the comps table below
+ upstreamReg = project.hasProperty('upstreamReg') ? project.getProperty('upstreamReg') : 'docker.io'
+
+ // Target registry to be used to publish docker images needed for deployment
+ targetReg = project.hasProperty('targetReg')
+ ? project.getProperty('targetReg')
+ : config.docker && config.docker.registry
+ ? config.docker.registry
+ : config.seedServer.ip
+ ? config.seedServer.ip + ":5000"
+ : 'localhost:5000'
+
+ // The tag used to tag the docker images push to the target registry
+ targetTag = project.hasProperty('targetTag')
+ ? project.getProperty('targetTag')
+ : config.docker && config.docker.imageVersion
+ ? config.docker.imageVersion
+ : 'candidate'
}
// ~~~~~~~~~~~~~~~~~~~ Global tasks ~~~~~~~~~~~~~~~~~~~~~~~