Jenkins Text Parameters Not Being Escaped

Jenkins setup: Jenkins installed on Windows Server, running ANT build file.

When setting up a text paramer on my build, it seems that values that end with the = character, are not escaped correctly.

For example, a text paramater value being supplied of “ABC” results in the following console line:
[Jenkins] $ cmd.exe /C "ant.bat -file manage-instances.xml -DciimsProKey=ABC

However, if the text paramater value being supplied contains special characters like “ABC==” then the results in the console line look as follows:
[Jenkins] $ cmd.exe /C “ant.bat -file manage-instances.xml -DciimsProKey=ABC==”"
When this happens, the property echo’ed in ant displays as “ABC” without teh special chacters.

What I need is for the console line to be something like this:
[Jenkins] $ cmd.exe /C "ant.bat -file manage-instances.xml -DciimsProKey=“ABC==”
When this happens, I woud lthe expect the property being echo’ed in ant to display as “ABC==”

When I manually start and end the text paramater value with the double quotes, it does escape teh quotes.

Any advise on how to get jenkins to inclde teh double-quotes for these text paramters?

Have you tried setting the value as an environment variable and then using that environment variable in the command? Cmd.exe has some really crappy escaping rules.

Thanks Alex, but I need the user to enter these unique parameter values (paramatarized build) manually when starting the build, so env vars are not really an option.

Kind regards

Rudi Minty
072 191 4654

EXTERNAL SENDER - CAUTION: This email originated from outside of the organisation. Do not click on links, or open attachments unless you recognise the sender and know the content is safe.

| slide_o_mix Alex Earl
August 31 |

  • | - |

Have you tried setting the value as an environment variable and then using that environment variable in the command? Cmd.exe has some really crappy escaping rules.

How are you invoking ant? Are you using the ant plugin or are you creating the command line yourself?

Yes, using Ant plugin.

Kind regards

Rudi Minty

EXTERNAL SENDER - CAUTION: This email originated from outside of the organisation. Do not click on links, or open attachments unless you recognise the sender and know the content is safe.

| slide_o_mix Alex Earl
August 31 |

  • | - |

How are you invoking ant? Are you using the ant plugin or are you creating the command line yourself?

Are you specifying the parameter value in the properties section (or are you using pipeline)? Can you share your setup and invocation of the ant plugin?