blob: 2062f8535b53aa0b5ef6e39ba9dc7d1e0f0a39df [file] [log] [blame]
Zsolt Haraszti19592c12016-09-08 13:52:23 -07001/*
Zsolt Haraszti3d163532016-09-08 15:57:32 -07002 * Copyright 2016 the original author or authors.
Zsolt Haraszti19592c12016-09-08 13:52:23 -07003 *
Zsolt Haraszti3d163532016-09-08 15:57:32 -07004 * 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.
Zsolt Haraszti19592c12016-09-08 13:52:23 -070015 */
16
Zsolt Haraszti3d163532016-09-08 15:57:32 -070017allprojects {
18 apply plugin: 'base'
Zsolt Haraszti19592c12016-09-08 13:52:23 -070019}
20
Zsolt Haraszti3d163532016-09-08 15:57:32 -070021ext {
Zsolt Haraszti19592c12016-09-08 13:52:23 -070022
Zsolt Haraszti3d163532016-09-08 15:57:32 -070023 // Target registry to be used to publish docker images needed for deployment
24 targetReg = project.hasProperty('targetReg') ? project.getProperty('targetReg') : 'localhost:5000'
25
26 // The tag used to tag the docker images push to the target registry
27 targetTag = project.hasProperty('targetTag') ? project.getProperty('targetTag') : 'candidate'
28
29 // Deployment target config file (yaml format); this can be overwritten from the command line
30 // using the -PdeployConfig=<file-path> syntax.
31 deployConfig = project.hasProperty('deployConfig') ? project.getProperty('deployConfig') : './config/default.yml'
32
Zsolt Haraszti19592c12016-09-08 13:52:23 -070033}
Zsolt Haraszti3d163532016-09-08 15:57:32 -070034
35// ~~~~~~~~~~~~~~~~~~~ Global tasks ~~~~~~~~~~~~~~~~~~~~~~~
36
37// To be used to fetch upstream binaries, clone repos, etc.
Zsolt Harasztib71c2a02016-09-12 13:12:07 -070038task fetch(type: Exec) {
Zsolt Haraszti4ca1ef72016-09-27 13:57:26 -070039 commandLine ".", "env.sh", "&&", "make", "fetch"
Zsolt Haraszti3d163532016-09-08 15:57:32 -070040}
41
42// To be used to generate all needed binaries that need to be present on the target
43// as docker images in the local docker runner.
44task buildImages(type: Exec) {
Zsolt Haraszti4ca1ef72016-09-27 13:57:26 -070045 commandLine ".", "env.sh", "&&", "make"
Zsolt Haraszti3d163532016-09-08 15:57:32 -070046}
47
48task tagImage(type: Exec) {
49 dependsOn buildImages
Zsolt Haraszti57c3dc32016-09-08 16:21:49 -070050 commandLine "docker", 'tag', 'cord/voltha', "$targetReg/cord/voltha:$targetTag"
Zsolt Haraszti3d163532016-09-08 15:57:32 -070051}
52
53// Publish image(s) built during the build step into targetReg registry using the targetTag
54// tag. See maas subproject for examples on how to do this.
55task publishImages(type: Exec) {
56 dependsOn tagImage
Zsolt Haraszti57c3dc32016-09-08 16:21:49 -070057 commandLine "docker", 'push', "$targetReg/cord/voltha:$targetTag"
Zsolt Haraszti3d163532016-09-08 15:57:32 -070058}
59
60task publish {
61 dependsOn publishImages
62}