// 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

#!groovy

// 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::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles:\n"
                        + "Starting tests on : " + now.toString()
                        + "\n:sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles:" )
}

// 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
    }
}
