blob: 6ef8a8379ed885fff1b7785cf86409b60511752d [file] [log] [blame]
Zsolt Haraszti56700cd2016-06-01 16:02:05 -07001/*
Zsolt Harasztid5fa9ed2016-06-01 16:07:16 -07002 * Copyright 2012 the original author or authors.
Zsolt Haraszti56700cd2016-06-01 16:02:05 -07003 *
Zsolt Harasztid5fa9ed2016-06-01 16:07:16 -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 Haraszti56700cd2016-06-01 16:02:05 -070015 */
16
Zsolt Harasztid5fa9ed2016-06-01 16:07:16 -070017ext {
Zsolt Haraszti56700cd2016-06-01 16:02:05 -070018
Zsolt Harasztid5fa9ed2016-06-01 16:07:16 -070019 // Target registry to be used to publish docker images needed for deployment
20 targetReg = project.hasProperty('targetReg') ? project.getProperty('targetReg') : 'localhost:5000'
21
22 // The tag used to tag the docker images push to the target registry
23 targetTag = project.hasProperty('targetTag') ? project.getProperty('targetTag') : 'candidate'
24
ChetanGaonker5979e212016-06-03 09:30:49 -070025 cordTesterPath = project.hasProperty('cordTesterPath') ? project.getProperty('cordTesterPath') : './src/test/setup'
26
27 dockerPath = project.hasProperty('dockerPath') ? project.getProperty('dockerPath') : '/usr/bin'
A R Karthick577520a2016-06-07 14:40:12 -070028
A.R Karthick490f51f2016-06-09 21:29:13 -070029 cordTesterImages = [ 'cord-test/radius:latest' : 'Dockerfile.radius', 'cord-test/quagga:latest' : 'Dockerfile.quagga', 'cord-test/nose:latest' : 'Dockerfile.tester' ]
Zsolt Haraszti56700cd2016-06-01 16:02:05 -070030}
31
Zsolt Harasztid5fa9ed2016-06-01 16:07:16 -070032// ~~~~~~~~~~~~~~~~~~~ Global tasks ~~~~~~~~~~~~~~~~~~~~~~~
Zsolt Haraszti56700cd2016-06-01 16:02:05 -070033
Zsolt Harasztid5fa9ed2016-06-01 16:07:16 -070034// To be used to fetch upstream binaries, clone repos, etc.
A.R Karthick490f51f2016-06-09 21:29:13 -070035task fetch {
36 //commandLine "$cordTesterPath/onos_pull.sh", 'latest'
Zsolt Haraszti56700cd2016-06-01 16:02:05 -070037}
Zsolt Harasztid5fa9ed2016-06-01 16:07:16 -070038
39// To be used to generate all needed binaries that need to be present on the target
40// as docker images in the local docker runner.
A.R Karthick490f51f2016-06-09 21:29:13 -070041task buildImages {
Zsolt Harasztid5fa9ed2016-06-01 16:07:16 -070042 // ...
A.R Karthick490f51f2016-06-09 21:29:13 -070043 cordTesterImages.each { tag, dockerfile ->
44 println "Building Docker image ${tag} using ${dockerfile}"
45 exec {
46 executable "$dockerPath/docker"
47 args "build", "-t", "${tag}", "-f", "${dockerfile}", "."
48 }
49 }
Zsolt Harasztid5fa9ed2016-06-01 16:07:16 -070050}
51
52// Publish image(s) built during the build step into targetReg registry using the targetTag
53// tag. See maas subproject for examples on how to do this.
54task publish {
55 println "$targetTag"
56}