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
1,175 views

1 answer to this question.

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,430 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
• 37,430 points
41 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
• 37,430 points
46 views
+1 vote
1 answer
0 votes
0 answers

Developing Continuous Delivery Pipeline using Git, Jenkins, Maven & Tomcat - join link. Registered today but not geeting link to joinin

Developing Continuous Delivery Pipeline using Git, Jenkins, ...READ MORE

Jul 4 in Jenkins by Mukul

closed Jul 5 by Vardhan 33 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,430 points
235 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,430 points
2,264 views