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