Trigger parameterized jobs with workflow plugin.

60 views
Skip to first unread message

Ohad Basan

unread,
Aug 24, 2015, 10:52:36 AM8/24/15
to Jenkins Users
Hello

I am trying to use the workflow plugin to trigger a build with parameters
I am using the snippet generator but it ignores the parameter and doesn't display it
can anyone plz give me an example for how to use the workflow "build" step to trigger a parameterized job?

thanks!

Francois Marot

unread,
Aug 24, 2015, 11:36:52 AM8/24/15
to Jenkins Users
Here is how I do it for 2 jobs with 3 parameters each. Strange that the "snippet generator" does not work, at least it does for me on jenkins 1.620. Are you sure you point to the correct parametised job ?

String outputDirTimestamp = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(new Date());
// "env.mySoftVersion" has previously been set in env
// "packagingGitBranch" is set elsewhere

parallel(win: {
    build job: 'packaging_win', parameters: [[$class: 'StringParameterValue', name: 'outputDirTimestamp', value: outputDirTimestamp], [$class: 'StringParameterValue', name: 'branchToPackage', value: packagingGitBranch], [$class: 'StringParameterValue', name: 'mySoft.version', value: env.mySoftVersion]]
}, lin: {
    build job: 'packaging_linux', parameters: [[$class: 'StringParameterValue', name: 'outputDirTimestamp', value: outputDirTimestamp], [$class: 'StringParameterValue', name: 'branchToPackage', value: packagingGitBranch], [$class: 'StringParameterValue', name: 'mySoft.version', value: env.mySoftVersion]]
})

Ohad Basan

unread,
Aug 24, 2015, 12:44:43 PM8/24/15
to Jenkins Users
I am using the correct job.
100%. dont know why the snippet generator is missing it

I am using your technique and the job does start but for some reason the parallelism doesn't work

I want to run a job 5 times concurrently

def concurrent=[:]
for (int i = 0; i < 6; i++) {
  concurrent["concurrent${i}"] = {
    build job: 'test_job', parameters: [[$class: 'StringParameterValue', name:'queue', value:     
    'automation_prod.q']]
    }
}
parallel concurrent
Reply all
Reply to author
Forward
0 new messages