Jenkins Remote Parametrized build always uses default parameter values ​​instead of the ones passed

I have a Jenkins job that has one boolean parameter. The default value for this parameter is false. I remotely create it from ANT build script (another job) POST'ing to the build url and passing my token and parameter.

curl -X POST 'MY_JENKINS_SERVER/job/JOB_NAME/buildWithParameters?token=12345;REPORTS=true' --user MY_USERNAME:MY_PASS

      

Note that I have a URL enclosed in single quotes (which should take care of encoding issues) and that the boolean parameter name is REPORTS (capitalized in Jenkins and ANT). Also, I would like to point out that if I use an ampersand (&) to separate a token and another parameter, I get the following error when creating: The object reference "REPORTS" must end with ';' separator.

No matter what the value of the REPORTS parameter is in the URL string, the parameter is always the default value false when it goes to build. I changed the default to true in Jenkins and it is always true regardless of the parameter value passed. Basically, it always uses the default and ignores the passed parameter value . I've also tried skipping the REPORTS parameter and of course it takes the default.

In my work build file (the one I run remotely), I print the parameter as $ {env.REPORTS}

I've looked over similar questions on SO, but none of their solutions work for me. I've tried moving parameters in the url and nothing works. Any ideas?

+3


source to share


1 answer


Based on this line:

A reference to the "REPORTS" object must end with a ';' Separator



&

Try instead&

This is not a problem with Jenkins, but with Ant, which is an XML file. Since it &

is a special character for XML, in order to have the same value &

anywhere, you need to write it as&

+3


source







All Articles