Jenkins Pipeline: Build using parameters

0 votes

I'm trying to execute an existing job ('jenkins-test-project-build') using the build method with Jenkins pipeline.

 build('jenkins-test-project-build', param1 : 'some-value')

When I try to execute this I get te following error:

java.lang.IllegalArgumentException: Expected named arguments but got [{param1=some-value}, jenkins-test-project-build]
at org.jenkinsci.plugins.workflow.cps.DSL.parseArgs(DSL.java:442)
at org.jenkinsci.plugins.workflow.cps.DSL.parseArgs(DSL.java:380)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:156)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
...

Jul 10, 2018 in Jenkins by Tyrion anex
• 8,280 points
843 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

This error occurs because you havent passed the name of the attribute which should store 'jenkins-test-project-build'.

In your case you should pass job attribute,

build(job: 'jenkins-test-project-build', param1 : 'some-value')
answered Jul 10, 2018 by Sophie may
• 9,050 points

Related Questions In Jenkins

0 votes
1 answer

Jenkins Pipeline using Openshift

Create a new service account in openshift ...READ MORE

answered Aug 8, 2018 in Jenkins by Kalgi
• 35,800 points
27 views
0 votes
1 answer

Program to execute Dockerfile using Jenkins declarative pipeline

Hey @Nishant, you can use something like ...READ MORE

answered Apr 15 in Jenkins by Kalgi
• 35,800 points
20 views
0 votes
1 answer
0 votes
1 answer

Why is it displaying Jenkins build failure for Android app

I think you should try this. Try Uninstalling ...READ MORE

answered Apr 12, 2018 in Jenkins by shubham
• 6,500 points
160 views
+13 votes
2 answers
0 votes
1 answer
0 votes
1 answer

Jenkins: Build Pipeline Plugin Scheduled Trigger

This can be done by setting the ...READ MORE

answered Jul 10, 2018 in Jenkins by Sophie may
• 9,050 points
120 views
0 votes
1 answer

How to trigger a Jenkins pipeline A in another Jenkins pipeline B?

You can run the following code, its ...READ MORE

answered Jul 5, 2018 in Jenkins by Sophie may
• 9,050 points
828 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.