Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-70046

Using Environment Parameters like BUILD_TAG produces unknown character when passed in as parameter in jobs organized in folders

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • core

      Passing in this string to shell execution works:

      ./tosca_execution_client.sh  --creator $BUILD_NUMBER 

      Passing in this string to shell execution fails:

      ./tosca_execution_client.sh  --creator $BUILD_TAG 

      This results in an error in the job execution console - hidden illegal characters appear to be in the folder path part of the $BUILD_TAG response:

      2022-11-08 17:00:20 -0600 [ERR] Unknown parameter passed: *Folder-PPT*

       

      The Full project name: PPT Folder/PPT KGEN Login

      It appears spaces in the folder & job name are not escaped properly in the folder path response of the BUILD_TAG environment variable?

      Using JOB_NAME caused similar problems

       

          [JENKINS-70046] Using Environment Parameters like BUILD_TAG produces unknown character when passed in as parameter in jobs organized in folders

          Replacing spaces in the folder name with underscores appears to be a viable workaround

          William Ballard added a comment - Replacing spaces in the folder name with underscores appears to be a viable workaround

          Markus Winter added a comment -

          How about quoting the parameter when you pass it to your shell script?

          ./tosca_execution_client.sh --creator "$BUILD_TAG"

          I don't think this is an issue in Jenkins itself.

          Markus Winter added a comment - How about quoting the parameter when you pass it to your shell script? ./tosca_execution_client.sh --creator "$BUILD_TAG" I don't think this is an issue in Jenkins itself.

          I tried every permutation possible spending about six hours on it. Double Quotes. Single Quotes. Escaping quotes. No quotes. The only thing that worked was removing the space from the folder name and the job name. 

          I thought folders were native functionality to Jenkins, looks like it's a plugin. 

          Close the ticket if you want. I've worked around it by using underscores. I do believe a space in the name renders an illegal hidden character (  ) surfacing in the folder names when exposed through relevant environment variables. 

          William Ballard added a comment - I tried every permutation possible spending about six hours on it. Double Quotes. Single Quotes. Escaping quotes. No quotes. The only thing that worked was removing the space from the folder name and the job name.  I thought folders were native functionality to Jenkins, looks like it's a plugin.  Close the ticket if you want. I've worked around it by using underscores. I do believe a space in the name renders an illegal hidden character (  ) surfacing in the folder names when exposed through relevant environment variables. 

          Markus Winter added a comment -

          The output

           

          2022-11-08 17:00:20 -0600 [ERR] Unknown parameter passed: *Folder-PPT*

           

          looks like it's ansi colored output from the tosca_execution_client.sh script  . And it clearly indicates that your script interpreted the things after the first blank as the next argument and not as part of the value of the "--creator" argument. I would look at this script if it is maybe passing the values further to some other executable without proper escaping.

          Markus Winter added a comment - The output   2022-11-08 17:00:20 -0600 [ERR] Unknown parameter passed: *Folder-PPT*   looks like it's ansi colored output from the tosca_execution_client.sh script  . And it clearly indicates that your script interpreted the things after the first blank as the next argument and not as part of the value of the "--creator" argument. I would look at this script if it is maybe passing the values further to some other executable without proper escaping.

          Agree with the comments this issue was a result from the shell script being called, not the input from Jenkins

          William Ballard added a comment - Agree with the comments this issue was a result from the shell script being called, not the input from Jenkins

            Unassigned Unassigned
            wpballard William Ballard
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: