Jenkins and the mysterious use of Choice Parameter Dropdown and bash

Hi all. I wonder if someone can shed some light on an issue which I’ve run into with a project i have setup… Any help is greatfully appreciated. [ I’m a techie, consider myself an experienced guy in my early 50’s now and work professionally in a PS org ]

Jenkins version 2.401.2CentOS Linux 7 Jenkins server hostCentOS Linux 8.1 agent.

I have a project [internal to my team] which is configured to take input from a number of the built in choice Parameter drop down boxes. The build part of the project invokes a bash script which gets pulled from a Github repo and runs the script and does ‘things’ by way of some API calls to another product etc.

Up until recently, everything worked fine. I have one particular parameter choice drop down - we’ll call it “inputA” that contains a list of six items. When i select one of the parmeters (there’s six in total and a combination of choice dropdowns, boolean and freeform dialogs ) and click build, my script takes those variables and exectutes.

The project executes correctly and i noticed that Jenkins is capturing the value provided in “input A” where it’s value is a literal string, such as "/PathNameTwo" - that gets parsed to the Jenkins agent which the project is designated to run on, it retains it’s value which my script accepts and executes on. The querky bit is that when my script runs, it parses the value into an API call contained within a JSON payload and is sent to applicationX.ApplicationX takes that value and processes it but states that InputA’s value of “/PathNameTwo” is not recognised.

On investigating using bash -xe and debug from the Swagger UI on the applicationX i can see that “/PathNameTwo” is infact valid and exists.

Furthermore to validate my own code (which is nearly 1400 lines of bash) I can run the script which my jenkins project runs from my laptop directly and it executes cleanly without issues from a bash wrapper script (essentally the same one which the Jenkins run shell command uses)

I’ve managed to wittle down this issue by editing the Choices parameter drop down box with only one value inside it -which works - all my Options are all valid and worked but when i had to edit “InputA” dropdown a few days ago things went pear shaped. I believed that it looks like it’s either a white space issue or hidden control code in one or more of the strings :?

To fix, i’ve tried the following :

  • removing the “inputA” drop box from my project , saving the project, then going back in to edit and adding the drop box again as “inputA”, entering a value, then saving - retesting only works with one value and not any more.

  • removing all the values in the list and creating them all by hand typing in - no joy.- copying the contents of the drop box, dropping them into vi and using :set lines to identify any control/whitespaces - none are found.

  • updating the version of jenkins and jenkins agent version - no joy. Even though i feel that it’s the jenkins server dropdown box in question that’s causing this issue but could be the jenkins agent also.

The project contains two other Choices parameter drop down box and i don’t get issues with those at all

As a workaround i’ve found the Active Choices plugin which has worked taking my list as groovy array, but I’d like to resolve this.

Any ideas/thoughts are greatfully appreciated.