blob: d5424a6614b8658f1221c7119baea49b1f136097 [file] [log] [blame]
Zsolt Harasztiec7df102016-05-05 13:34:18 -07001/*
2 * Copyright 2012 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Zsolt Haraszti0b790aa2016-05-12 22:33:14 -070017import org.opencord.gradle.rules.*
Zsolt Harasztiec7df102016-05-05 13:34:18 -070018import org.yaml.snakeyaml.Yaml
19
alshabib11b8e5c2016-08-29 15:36:36 -070020buildscript {
21 repositories {
22 maven {
23 url "https://plugins.gradle.org/m2/"
24 }
25 }
26 dependencies {
27 classpath "gradle.plugin.com.dorongold.plugins:task-tree:1.2.1"
28 }
29}
30
31apply plugin: "com.dorongold.task-tree"
32
33evaluationDependsOn(':maas')
34evaluationDependsOn(':platform-install')
35evaluationDependsOn(':onos-apps')
36
Zsolt Harasztiec7df102016-05-05 13:34:18 -070037allprojects {
38 apply plugin: 'base'
39 apply plugin: 'de.gesellix.docker'
40 //apply plugin: 'com.tmiyamon.config'
41
42 docker {
43 // dockerHost = System.env.DOCKER_HOST ?: 'unix:///var/run/docker.sock'
44 // dockerHost = System.env.DOCKER_HOST ?: 'https://192.168.99.100:2376'
45 // certPath = System.getProperty('docker.cert.path') ?: "${System.getProperty('user.home')}/.docker/machine/machines/default"
46 // authConfigPlain = [
47 // "username" : "joe",
48 // "password" : "some-pw-as-needed",
49 // "email" : "joe@acme.com",
50 // "serveraddress" : "https://index.docker.io/v1/"
51 // ]
52 }
53}
54
55ext {
56
57 // Upstream registry to simplify filling out the comps table below
Zsolt Harasztia9f72502016-05-12 16:07:03 -070058 upstreamReg = project.hasProperty('upstreamReg') ? project.getProperty('upstreamReg') : 'docker.io'
Zsolt Harasztiec7df102016-05-05 13:34:18 -070059
60 // Target registry to be used to publish docker images needed for deployment
Zsolt Harasztia9f72502016-05-12 16:07:03 -070061 targetReg = project.hasProperty('targetReg') ? project.getProperty('targetReg') : 'localhost:5000'
Zsolt Harasztiec7df102016-05-05 13:34:18 -070062
63 // The tag used to tag the docker images push to the target registry
Zsolt Harasztia9f72502016-05-12 16:07:03 -070064 targetTag = project.hasProperty('targetTag') ? project.getProperty('targetTag') : 'candidate'
Zsolt Harasztiec7df102016-05-05 13:34:18 -070065
66 // Component table
67 comps = [
David K. Bainbridged54ca702016-07-13 22:27:12 -070068 'onosproject/onos': [
69 'type': 'image',
70 'upstream': upstreamReg,
71 'name': 'onosproject/onos',
72 'digest': 'sha256:6c310b6bc798f745977973c8c883d3dd1eb250fd124ae4d627fd98a69efb5afc'
73 ],
Zsolt Haraszti3dbe6162016-05-12 12:25:56 -070074 'nginx': [
75 'type': 'image',
76 'upstream': upstreamReg,
77 'name': 'nginx',
78 'digest': 'sha256:b555f8c64ab4e85405e0d8b03f759b73ce88deb802892a3b155ef55e3e832806'
79 ],
80 'swarm': [
81 'type': 'image',
82 'upstream': upstreamReg,
83 'name': 'swarm',
84 'digest': 'sha256:6ca9b40980e2fcdcd229900ec8933f3e92c14ead22c9404cb09736cb4f3a9248'
85 ],
Scott Bakera0a0e442016-10-10 20:58:22 -070086 'xosproject/vsg': [
87 'type': 'image',
88 'upstream': upstreamReg,
89 'name': 'xosproject/vsg',
90 'digest': 'sha256:18d1c6ef9767d8a41c9b51948776052d024d4e3294e5d1d6dde1a49112175d91'
91 ],
Scott Bakerbceca9c2016-11-05 18:59:25 -070092 'xosproject/xos-postgres': [
93 'type': 'image',
94 'upstream': upstreamReg,
95 'name': 'xosproject/xos-postgres',
96 'digest': 'sha256:f2d31a50b8af7434ab07b1e54e99c1ff1e10d77d16a46e5d6933d3c0528f4820'
97 ],
98 'xosproject/cord-app-build': [
99 'type': 'image',
100 'upstream': upstreamReg,
101 'name': 'xosproject/cord-app-build',
102 'digest': 'sha256:528c6ac3a87609779035857a7b1cf9fab8e046e7ac259d72cf275f1c46d7416e'
103 ],
104 'redis': [
105 'type': 'image',
106 'upstream': upstreamReg,
107 'name': 'redis',
108 'digest': 'sha256:0fe5a7afa2c2154f37c8ab56a9a6c5023cb0405cc0e85b34d8dcc1de6c3f143e'
109 ],
Zsolt Harasztiec7df102016-05-05 13:34:18 -0700110 ]
111
112 // Deployment target config file (yaml format); this can be overwritten from the command line
113 // using the -PdeployConfig=<file-path> syntax.
Zsolt Harasztia9f72502016-05-12 16:07:03 -0700114 deployConfig = project.hasProperty('deployConfig') ? project.getProperty('deployConfig') : './config/default.yml'
Zsolt Harasztiec7df102016-05-05 13:34:18 -0700115
116}
117
alshabib00c4b5d2016-06-17 17:26:10 -0700118// ---------------- Useful tasks ----------------
119
Zsolt Harasztiec7df102016-05-05 13:34:18 -0700120task fetchUpstreamImages {
Zsolt Haraszti3dbe6162016-05-12 12:25:56 -0700121 comps.each { name, spec -> if (spec.type == 'image') { dependsOn "fetch" + name } }
122}
123
alshabib11b8e5c2016-08-29 15:36:36 -0700124
125task fetch {
126 dependsOn fetchUpstreamImages
Zsolt Harasztiec7df102016-05-05 13:34:18 -0700127}
128
alshabib11b8e5c2016-08-29 15:36:36 -0700129task buildImages {
130 logger.info "Root project has nothing to build"
Zsolt Harasztiec7df102016-05-05 13:34:18 -0700131}
132
133task publishImages {
alshabib11b8e5c2016-08-29 15:36:36 -0700134 comps.each { name, spec -> if (spec.type == 'image') {
135 dependsOn "publish" + name
136 }
137 }
Zsolt Harasztiec7df102016-05-05 13:34:18 -0700138}
139
140task publish {
Zsolt Haraszti3dbe6162016-05-12 12:25:56 -0700141 dependsOn publishImages
Zsolt Harasztiec7df102016-05-05 13:34:18 -0700142}
143
144tasks.addRule(new DockerFetchRule(project))
alshabib11b8e5c2016-08-29 15:36:36 -0700145tasks.addRule(new DockerPublishRule(project, project(':maas').prime))
Zsolt Harasztiec7df102016-05-05 13:34:18 -0700146tasks.addRule(new DockerTagRule(project))
Zsolt Harasztiec7df102016-05-05 13:34:18 -0700147
alshabib11b8e5c2016-08-29 15:36:36 -0700148project('platform-install').deployPlatform.dependsOn project(':maas').deployBase
149project('onos-apps').publishMavenRepoImage.dependsOn project(':maas').prime
alshabibc64cf7f2016-09-07 11:47:01 -0700150project('platform-install').deployPlatform.dependsOn project(':onos-apps').deploy
151project(':onos-apps').deploy.dependsOn project(':maas').deployBase
152
Andy Bavierbeb89c02016-07-07 13:26:55 -0400153
alshabib11b8e5c2016-08-29 15:36:36 -0700154task deploy {
155 dependsOn << project(':platform-install').deployPlatform
Zsolt Harasztiec7df102016-05-05 13:34:18 -0700156}
alshabibb58aeab2016-06-17 16:47:02 -0700157