blob: ad078ef926cf4fce38d2ace9ae42add1e984e274 [file] [log] [blame]
/*
* Copyright 2012 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.
*/
ext {
// Target registry to be used to publish docker images needed for deployment
targetReg = project.hasProperty('targetReg') ? project.getProperty('targetReg') : 'localhost:5000'
// The tag used to tag the docker images push to the target registry
targetTag = project.hasProperty('targetTag') ? project.getProperty('targetTag') : 'candidate'
cordTesterPath = project.hasProperty('cordTesterPath') ? project.getProperty('cordTesterPath') : './src/test/setup'
dockerPath = project.hasProperty('dockerPath') ? project.getProperty('dockerPath') : '/usr/bin'
cordTesterAptDeps = [ 'python', 'python-dev', 'python-pip', 'python-setuptools' ]
cordTesterPipDeps = [ 'scapy', 'nose', 'monotonic', 'configObj', 'docker-py', 'pyyaml', 'nsenter', 'pyroute2', 'netaddr', 'scapy-ssl_tls' ]
}
// ~~~~~~~~~~~~~~~~~~~ Global tasks ~~~~~~~~~~~~~~~~~~~~~~~
task aptFetch() {
// fetch the dependencies for cord tester
cordTesterAptDeps.each {
String pkg ->
exec {
executable 'apt-get'
args "install", "-y", pkg
}
}
}
task pipFetch() {
// fetch the dependencies for cord tester
dependsOn aptFetch
cordTesterPipDeps.each {
String pkg ->
exec {
executable 'pip'
args "install", "-U", pkg
}
}
}
// To be used to fetch upstream binaries, clone repos, etc.
task fetch (type: Exec) {
dependsOn pipFetch
commandLine "$cordTesterPath/onos_pull.sh", 'latest'
}
// 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 "$cordTesterPath/cord-test.py", 'build', 'all'
}
// 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 publish {
println "$targetTag"
}