#!groovy
// Copyright 2017 Open Networking Foundation (ONF)
//
// Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
// the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
// or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
//
//     TestON is free software: you can redistribute it and/or modify
//     it under the terms of the GNU General Public License as published by
//     the Free Software Foundation, either version 2 of the License, or
//     (at your option) any later version.
//
//     TestON is distributed in the hope that it will be useful,
//     but WITHOUT ANY WARRANTY; without even the implied warranty of
//     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//     GNU General Public License for more details.
//
//     You should have received a copy of the GNU General Public License
//     along with TestON.  If not, see <http://www.gnu.org/licenses/>.

// This is the Jenkins script for all-pipeline-trigger

// read the dependency functions
funcs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy' )

// get current time and send the notification of starting the test.
def now = funcs.getCurrentTime()
print now.toString()
today = now[ Calendar.DAY_OF_WEEK ]

// read the passed parameters from the Jenkins.
machines = params.machines
manually_run = params.manual_run
if ( !manually_run ){
    slackSend( color: '#03CD9F',
               message: ":sparkles:" * 16 + "\n" +
                        "Starting tests on : " + now.toString() +
                        "\n" + ":sparkles:" * 16 )
}

// store the list of the machines into the dictionary.
machineList = machines.tokenize( "\n;, " )
machineOn = [ : ]

// save the triggering job function as a dictionary.
for ( machine in machineList ){
    print( machine )
    machineOn[ machine ] = triggerJob( machine )
}

// run the triggering jobs concurrently.
parallel machineOn

// function that will trigger the specific jobs from current pipeline.
def triggerJob( on ){
    return {
        jobToRun = on + "-pipeline-trigger"
        build job: jobToRun, propagate: false
    }
}
