8

There is any way to trigger a pipeline job from another pipeline with parameters, i already tried

build job: '/myjob', parameters: [string(name: 'param1', value:'val1')], wait: false 

also tried

build job: 'myjob', parameters: [string(name: 'param1', value:'val1')], wait: false 

and

build job: 'myjob', parameters: [[$class: 'StringParameterValue', name: 'param1', value: 'val1']], wait: false 

with no luck, it says:

Item type does not support parameters

5
  • Are you sur your pipeline 'myjob' is located at root path ? if both pipelines are in same view you can build the second just with the name : build job: 'myjob' Commented Dec 28, 2017 at 12:57
  • i tried both ways, using myjob and /myjob on every scenario it always says Item type does not support parameters even when i have the 'myjob' pipeline parameterized Commented Dec 28, 2017 at 13:05
  • try this line : build job: 'myjob', parameters: [[$class: 'StringParameterValue', name: 'param1', value: 'val1']] Commented Dec 28, 2017 at 13:11
  • also tried didnt work, will update main question to reflect all tries, thanks Commented Dec 28, 2017 at 13:19
  • can you show me a screenshot of your pipeline with parameters declaration ? and a screenshot of the "build with params" page. Commented Dec 28, 2017 at 13:40

3 Answers 3

17

Since the subjob was another multibranch pipeline project i needed to specify the branch i wanted to run so with

build job: 'myjob/master', parameters: [string(name: 'param1', value:'val1')], wait: false 

it now works

Sign up to request clarification or add additional context in comments.

2 Comments

can this work with boolean parameters? can't seem to get that working
upvote for multibranch detail! i was struggling on that.
1

The below worked for me in order to pass parameters "test_1" and "test_2" from pipeline "master" to pipeline "sub-1"

In the master pipeline

build job: 'sub-1', parameters: [[$class: 'StringParameterValue', name: 'test_1', value: 'nameValue'], [$class: 'StringParameterValue', name: 'test_2', value: 'valueValue']], wait: true 

In the sub pipeline "sub-1" use by referencing the "params" variable

node { echo params.test_1 echo params.test_2 } 

Reference:

https://support.cloudbees.com/hc/en-us/articles/221400287-How-to-pass-parameter-to-downstream-job-in-Pipeline-job-

Comments

0

Depending on your Jenkins job / pipeline structure, you should prefix the job with "../" e.g.:

build job: '../myjob/master', parameters: [string(name: 'param1', value:'val1')], wait: false 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.