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

FILE token does not evaluate a path that contains an environment variable

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      When I try the following in the Default Content of the Editable E-mail Notification:

      ${FILE,path="$MY_FILE_PATH"}

      The contents of the file specified by the path do not get displayed. I have MY_FILE_PATH defined as a property in a properties file that is injected into the environment in the "Prepare an environment for the run" option where the full path of the property file is specified.

      The property file defines: MY_FILE_PATH=custom_info.txt

      where "custom_info.txt" is a file in the workspace of the job that contains some text that I would like to display as part of the e-mail.

      What is strange is that when I receive the e-mail, this appears:

      ${FILE,path="custom_info.txt"}

      So the email-ext plugin evaluates the environment variable MY_FILE_PATH, but the FILE token does not evaluate it as a path.

      The ability to have the FILE token evaluate a path that contains an environment variable would be useful for displaying different information depending on which file path is stored in the environment variable.

      I am running Jenkins 1.480.2.

        Attachments

          Activity

          Hide
          slide_o_mix Alex Earl added a comment -

          Added expansion of path parameter.

          Show
          slide_o_mix Alex Earl added a comment - Added expansion of path parameter.
          Hide
          avirosenfeld Avi Rosenfeld added a comment -

          How do I use the "expansion of path parameter" ?

          I tried ${FILE, path="$MY_FILE_PATH"} , it still doesn't work.

          Show
          avirosenfeld Avi Rosenfeld added a comment - How do I use the "expansion of path parameter" ? I tried ${FILE, path="$MY_FILE_PATH"} , it still doesn't work.
          Hide
          slide_o_mix Alex Earl added a comment -

          I think this may have been removed because it was causing issues.

          Show
          slide_o_mix Alex Earl added a comment - I think this may have been removed because it was causing issues.
          Hide
          avirosenfeld Avi Rosenfeld added a comment -

          Thanks Alex for the update.

          So currently the only way to do it is the workaround of coping the $MY_FILE_PATH to a constant name file.
          Right?

          Show
          avirosenfeld Avi Rosenfeld added a comment - Thanks Alex for the update. So currently the only way to do it is the workaround of coping the $MY_FILE_PATH to a constant name file. Right?
          Hide
          slide_o_mix Alex Earl added a comment -

          It would also be easy to do via groovy template, which is my recommended method.

          Show
          slide_o_mix Alex Earl added a comment - It would also be easy to do via groovy template, which is my recommended method.

            People

            • Assignee:
              slide_o_mix Alex Earl
              Reporter:
              trincodog Kavita Tiwari
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: