blob: 324c55059c94d4d972e4f6dfef247ee6b3edf24b [file] [log] [blame]
import org.yaml.snakeyaml.Yaml
ext {
// 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.headnode.ip
? config.headnode.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'
}
// Pull XOS images that exist on Docker Hub.
// All images will get rebuilt during the buildImages step, but may at least
// be able to use some intermediate images.
task fetch(type: Exec) {
executable = "ansible-playbook"
args = [
"--extra-vars", "@../../build/genconfig/config.yml",
"--extra-vars", "build_docker_tag="+targetTag,
"--extra-vars", "cord_dir=../..",
"pull-xos-playbook.yml" ]
}
// Build all XOS images from source.
task buildImages(type: Exec) {
executable = "ansible-playbook"
args = [
"--extra-vars", "@../../build/genconfig/config.yml",
"--extra-vars", "build_docker_tag="+targetTag,
"--extra-vars", "cord_dir=../..",
"build-xos-playbook.yml" ]
}
// Publish XOS images to the head node registry.
task publish(type: Exec) {
executable = "ansible-playbook"
args = [ "-i", "../../build/genconfig/cord-inv",
"--extra-vars", "@../../build/genconfig/config.yml",
"--extra-vars", "build_docker_tag="+targetTag,
"--extra-vars", "deploy_docker_tag="+targetTag,
"--extra-vars", "deploy_docker_registry="+targetReg,
"publish-xos-playbook.yml" ]
}