forked from opencord/xos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
65 lines (56 loc) · 2.38 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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" ]
}