CLI command to start jenkins job with default and overriden parameters

24 views
Skip to first unread message

Vicki Kozel

unread,
Jan 9, 2019, 10:37:16 PM1/9/19
to Jenkins Users
Hello,
I am having trouble with combining default and overriden parameters when invoking jenkins jobs through remote CLI command.  

It  looks like the following invocation passes command line parameters to a job just fine, but ignores the default parameters:
curl -v https://jenkins/job/JobName/build -F json='{"parameter": [{"name": "targ_env", "value": "dev"}]}' --user userName:userToken


and the invocation on buildWithParameters api does the opposite - ignores the passed parameters and sets all the defaults correctly:

curl -v https://jenkins/job/JobName/buildWithParameters -F json='{"parameter": [{"name": "targ_env", "value": "dev"}]}' --user userName:userToken

Is there an API that can combine two sets of parameters?

Thank you!!

Daniel Butler

unread,
Jan 10, 2019, 4:51:03 AM1/10/19
to jenkins...@googlegroups.com

Hi Vicki,

According to https://wiki.jenkins.io/display/JENKINS/Parameterized+Build, for buildWithParameters you should use URL query params to pass the values.

 

To use your example:

curl -v https://jenkins/job/JobName/buildWithParameters?targ_env=dev  --user userName:userToken

 

 

Regards,

Daniel

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/27053cad-e82f-4053-b76c-ebfdf5781877%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

Vicki Kozel

unread,
Jan 10, 2019, 3:41:53 PM1/10/19
to Jenkins Users
Thank you Daniel! Do you know if there is a way to pass a file parameter this way?
Reply all
Reply to author
Forward
0 new messages