Devin Lim | e1346f4 | 2018-05-15 15:41:36 -0700 | [diff] [blame] | 1 | #!groovy |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 2 | // 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 Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 23 | // read the dependency functions |
Devin Lim | b734ea5 | 2018-05-14 14:13:05 -0700 | [diff] [blame] | 24 | funcs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy' ) |
Devin Lim | 1cb8751 | 2018-05-10 14:44:18 -0700 | [diff] [blame] | 25 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 26 | // get current time and send the notification of starting the test. |
Devin Lim | 1cb8751 | 2018-05-10 14:44:18 -0700 | [diff] [blame] | 27 | def now = funcs.getCurrentTime() |
| 28 | print now.toString() |
| 29 | today = now[ Calendar.DAY_OF_WEEK ] |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 30 | |
| 31 | // read the passed parameters from the Jenkins. |
Devin Lim | 1cb8751 | 2018-05-10 14:44:18 -0700 | [diff] [blame] | 32 | machines = params.machines |
| 33 | manually_run = params.manual_run |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame^] | 34 | if ( !manually_run ){ |
| 35 | slackSend( color: '#03CD9F', |
| 36 | message: ":sparkles:" * 16 + "\n" + |
| 37 | "Starting tests on : " + now.toString() + |
| 38 | "\n" + ":sparkles:" * 16 ) |
Devin Lim | 1cb8751 | 2018-05-10 14:44:18 -0700 | [diff] [blame] | 39 | } |
| 40 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 41 | // store the list of the machines into the dictionary. |
Devin Lim | 1cb8751 | 2018-05-10 14:44:18 -0700 | [diff] [blame] | 42 | machineList = machines.tokenize( "\n;, " ) |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame^] | 43 | machineOn = [ : ] |
Devin Lim | 1cb8751 | 2018-05-10 14:44:18 -0700 | [diff] [blame] | 44 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 45 | // save the triggering job function as a dictionary. |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame^] | 46 | for ( machine in machineList ){ |
Devin Lim | b91bf79 | 2018-05-10 15:09:52 -0700 | [diff] [blame] | 47 | print( machine ) |
Devin Lim | 1cb8751 | 2018-05-10 14:44:18 -0700 | [diff] [blame] | 48 | machineOn[ machine ] = triggerJob( machine ) |
| 49 | } |
| 50 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 51 | // run the triggering jobs concurrently. |
Devin Lim | 1cb8751 | 2018-05-10 14:44:18 -0700 | [diff] [blame] | 52 | parallel machineOn |
| 53 | |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 54 | // function that will trigger the specific jobs from current pipeline. |
Devin Lim | 2edfcec | 2018-05-09 17:16:21 -0700 | [diff] [blame] | 55 | def triggerJob( on ){ |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame^] | 56 | return { |
Devin Lim | b91bf79 | 2018-05-10 15:09:52 -0700 | [diff] [blame] | 57 | jobToRun = on + "-pipeline-trigger" |
| 58 | build job: jobToRun, propagate: false |
| 59 | } |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 60 | } |