blob: 9d4e42014f905ab44d4a86b00476ecebd4bfc87a [file] [log] [blame]
Devin Lime1346f42018-05-15 15:41:36 -07001#!groovy
Devin Limf5175192018-05-14 19:13:22 -07002// Copyright 2017 Open Networking Foundation (ONF)
3//
4// Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
5// the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
6// or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
7//
8// TestON is free software: you can redistribute it and/or modify
9// it under the terms of the GNU General Public License as published by
10// the Free Software Foundation, either version 2 of the License, or
11// (at your option) any later version.
12//
13// TestON is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with TestON. If not, see <http://www.gnu.org/licenses/>.
20
21// This is the Jenkins script for all-pipeline-trigger
22
Devin Limf5175192018-05-14 19:13:22 -070023// read the dependency functions
Devin Limb734ea52018-05-14 14:13:05 -070024funcs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy' )
Devin Lim1cb87512018-05-10 14:44:18 -070025
Devin Limf5175192018-05-14 19:13:22 -070026// get current time and send the notification of starting the test.
Devin Lim1cb87512018-05-10 14:44:18 -070027def now = funcs.getCurrentTime()
28print now.toString()
Devin Limf5175192018-05-14 19:13:22 -070029
30// read the passed parameters from the Jenkins.
Devin Lim1cb87512018-05-10 14:44:18 -070031machines = params.machines
32manually_run = params.manual_run
Jon Hall6af749d2018-05-29 12:59:47 -070033if ( !manually_run ){
34 slackSend( color: '#03CD9F',
35 message: ":sparkles:" * 16 + "\n" +
36 "Starting tests on : " + now.toString() +
37 "\n" + ":sparkles:" * 16 )
Devin Lim1cb87512018-05-10 14:44:18 -070038}
39
Devin Limf5175192018-05-14 19:13:22 -070040// store the list of the machines into the dictionary.
Devin Lim1cb87512018-05-10 14:44:18 -070041machineList = machines.tokenize( "\n;, " )
Jon Hall6af749d2018-05-29 12:59:47 -070042machineOn = [ : ]
Devin Lim1cb87512018-05-10 14:44:18 -070043
Devin Limf5175192018-05-14 19:13:22 -070044// save the triggering job function as a dictionary.
Jon Hall6af749d2018-05-29 12:59:47 -070045for ( machine in machineList ){
Devin Limb91bf792018-05-10 15:09:52 -070046 print( machine )
Devin Lim1cb87512018-05-10 14:44:18 -070047 machineOn[ machine ] = triggerJob( machine )
48}
49
Devin Limf5175192018-05-14 19:13:22 -070050// run the triggering jobs concurrently.
Devin Lim1cb87512018-05-10 14:44:18 -070051parallel machineOn
52
Devin Limf5175192018-05-14 19:13:22 -070053// function that will trigger the specific jobs from current pipeline.
Devin Lim2edfcec2018-05-09 17:16:21 -070054def triggerJob( on ){
Jon Hall6af749d2018-05-29 12:59:47 -070055 return {
Devin Limb91bf792018-05-10 15:09:52 -070056 jobToRun = on + "-pipeline-trigger"
57 build job: jobToRun, propagate: false
58 }
Devin Lim61657e42017-10-09 17:24:40 -070059}