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

Attachment filepath does not support token reference

    Details

    • Similar Issues:

      Description

      I defined an string parameter named "env".

      email content can retrieve it with token ${ENV, var="env"}.

      However, attachment field cannot solve the filepath with the tocken:

      attachment: logs/${ENV, var="env"}.log

      Is there any suggestion on this behavior ?

        Attachments

          Activity

          Hide
          slide_o_mix Alex Earl added a comment -

          The attachment field does not currently support tokens, it uses the ANT file pattern syntax. Try logs/*.log

          Show
          slide_o_mix Alex Earl added a comment - The attachment field does not currently support tokens, it uses the ANT file pattern syntax. Try logs/*.log
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Alex Earl
          Path:
          src/main/java/hudson/plugins/emailext/AttachmentUtils.java
          src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java
          http://jenkins-ci.org/commit/email-ext-plugin/9c0b9007fc747523e6ee70a66951da0017c49846
          Log:
          Fix JENKINS-13563

          Added support for content tokens in the attachments area. The
          generated string must still be an ANT pattern.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Alex Earl Path: src/main/java/hudson/plugins/emailext/AttachmentUtils.java src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java http://jenkins-ci.org/commit/email-ext-plugin/9c0b9007fc747523e6ee70a66951da0017c49846 Log: Fix JENKINS-13563 Added support for content tokens in the attachments area. The generated string must still be an ANT pattern.
          Hide
          slide_o_mix Alex Earl added a comment -

          Added support for content tokens in the attachment pattern. The built string must still conform to the Ant file pattern format.

          Fixed in 9c0b900

          Show
          slide_o_mix Alex Earl added a comment - Added support for content tokens in the attachment pattern. The built string must still conform to the Ant file pattern format. Fixed in 9c0b900
          Hide
          odklizec Pavel Kudrys added a comment -

          Hi,

          I'm new to Jenkins and I just hit on the same problem, as if some tokens are still not supported in the attachment field? Or maybe I'm using it in a wrong way?

          I'm using this path in the attachment field...
          Reports/Report_$BUILD_NUMBER.rxzlog

          where the $BUILD_NUMBER is supposed to translate to the build number. This variable works OK in other fields, but not in the attachment field. The file is correctly attached only if I replace the $BUILD_NUMBER variable with the number. But as you can imagine, it's not ideal solution as the number of the .rxzlog file changes with every build.

          I'm using Jenkins ver. 1.496. Thanks in advance!

          Show
          odklizec Pavel Kudrys added a comment - Hi, I'm new to Jenkins and I just hit on the same problem, as if some tokens are still not supported in the attachment field? Or maybe I'm using it in a wrong way? I'm using this path in the attachment field... Reports/Report_$BUILD_NUMBER.rxzlog where the $BUILD_NUMBER is supposed to translate to the build number. This variable works OK in other fields, but not in the attachment field. The file is correctly attached only if I replace the $BUILD_NUMBER variable with the number. But as you can imagine, it's not ideal solution as the number of the .rxzlog file changes with every build. I'm using Jenkins ver. 1.496. Thanks in advance!
          Hide
          slide_o_mix Alex Earl added a comment -

          I removed this as normally you would just use an ANT file pattern to match the files. Are your rxzlog files maintained between builds? Meaning, are there multiple rxzlog files in the workspace?

          Show
          slide_o_mix Alex Earl added a comment - I removed this as normally you would just use an ANT file pattern to match the files. Are your rxzlog files maintained between builds? Meaning, are there multiple rxzlog files in the workspace?
          Hide
          odklizec Pavel Kudrys added a comment - - edited

          Hi,

          Thank you for the reply! So the BUILD_NUMBER token is not allowed in the way I used it? Could you please suggest me the correct ANT pattern using the BUILD_NUMBER token?

          Yes, there are multiple rxzlog in the workspace (new rxzlog is created with every build). At the moment, I prefer to keep them all in the Reports folder. Therefore, I can't use path with *.rxzlog or similar wildcard.

          Have a nice day,
          Pavel

          Show
          odklizec Pavel Kudrys added a comment - - edited Hi, Thank you for the reply! So the BUILD_NUMBER token is not allowed in the way I used it? Could you please suggest me the correct ANT pattern using the BUILD_NUMBER token? Yes, there are multiple rxzlog in the workspace (new rxzlog is created with every build). At the moment, I prefer to keep them all in the Reports folder. Therefore, I can't use path with *.rxzlog or similar wildcard. Have a nice day, Pavel
          Hide
          slide_o_mix Alex Earl added a comment -

          I will add the feature back in, I had removed it for some small performance gains since from what I could gather from asking around no one was using it.

          Show
          slide_o_mix Alex Earl added a comment - I will add the feature back in, I had removed it for some small performance gains since from what I could gather from asking around no one was using it.
          Hide
          slide_o_mix Alex Earl added a comment -

          Re-added

          Show
          slide_o_mix Alex Earl added a comment - Re-added
          Hide
          odklizec Pavel Kudrys added a comment -

          Great news! Thanks for your effort.

          Show
          odklizec Pavel Kudrys added a comment - Great news! Thanks for your effort.
          Hide
          odklizec Pavel Kudrys added a comment -

          Hi, I'm sorry for bringing this subject back, but can I ask when we can see this feature back in a release version? Thank you in advance.

          Show
          odklizec Pavel Kudrys added a comment - Hi, I'm sorry for bringing this subject back, but can I ask when we can see this feature back in a release version? Thank you in advance.
          Hide
          slide_o_mix Alex Earl added a comment -

          I'm hoping to release this weekend, just running some more tests.

          Show
          slide_o_mix Alex Earl added a comment - I'm hoping to release this weekend, just running some more tests.
          Hide
          moorthy Moorthy Ramasamy added a comment -

          HI, can you please let me know the Ant format to have the Build Number in the attachment textbox.

          i am trying to send the failure screenshot as the email attachment.

          Show
          moorthy Moorthy Ramasamy added a comment - HI, can you please let me know the Ant format to have the Build Number in the attachment textbox. i am trying to send the failure screenshot as the email attachment.
          Hide
          slide_o_mix Alex Earl added a comment -

          This is not the place to ask questions. Please use the Jenkins User Mailing List.

          Show
          slide_o_mix Alex Earl added a comment - This is not the place to ask questions. Please use the Jenkins User Mailing List.

            People

            • Assignee:
              slide_o_mix Alex Earl
              Reporter:
              sam_he Sam He
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: