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