blob: dbe3ac53e8c796e1219992b6f91fddfd8e11ae72 [file] [log] [blame]
/*
* Copyright 2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
allprojects {
apply plugin: 'base'
}
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.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 ~~~~~~~~~~~~~~~~~~~~~~~
// To be used to fetch upstream binaries, clone repos, etc.
task fetch(type: Exec) {
commandLine ".", "env.sh", "&&", "make", "fetch"
}
// To be used to generate all needed binaries that need to be present on the target
// as docker images in the local docker runner.
task buildImages(type: Exec) {
commandLine ".", "env.sh", "&&", "make"
}
task tagImage(type: Exec) {
dependsOn buildImages
commandLine "docker", 'tag', 'cord/voltha', "$targetReg/cord/voltha:$targetTag"
}
// Publish image(s) built during the build step into targetReg registry using the targetTag
// tag. See maas subproject for examples on how to do this.
task publishImages(type: Exec) {
dependsOn tagImage
commandLine "docker", 'push', "$targetReg/cord/voltha:$targetTag"
}
task publish {
dependsOn publishImages
}