• Icon: Improvement Improvement
    • Resolution: Not A Defect
    • Icon: Major Major
    • email-ext-plugin
    • None
    • Hudson Setenv Plugin 1.1
      Hudson Email Extension Plugin 2.5
      hudson 1.346

      It seems like this should work after JENKINS-3605 was fixed so I followed the documented reference format as clarified in JENKINS-2413 and JENKINS-5322 (i.e. ${ENV, var="VERSION"}

      I can get access to the default variables, but not ones set by setenv plugin or by any build steps.

      When this is fixed we should make sure that the recipients can be set as well as the email content.

      There are a couple of related patches out there.
      http://n4.nabble.com/Email-notification-recipients-as-a-variable-td1578247.html#a1578247
      Access to node env variables: JENKINS-5465

      I'm not sure if this should be opened against email-ext or setenv plugin.
      http://wiki.jenkins-ci.org/display/JENKINS/Setenv+Plugin
      http://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin

      There is not currently a setenv component in jira so I'm opening this against email-ext.

      A recent discussion of this issue: http://n4.nabble.com/How-to-use-environment-variables-td1012822.html#a1012822

          [JENKINS-5942] setenv variables not available to email-ext

          Alan Harder added a comment -

          See JENKINS-5580 for how this same problem was resolved for Batch Tasks plugin.. perhaps you can submit a patch based on that.

          Alan Harder added a comment - See JENKINS-5580 for how this same problem was resolved for Batch Tasks plugin.. perhaps you can submit a patch based on that.

          Zachary Young added a comment - - edited

          I am having mixed results with ver. 2.6:

          An env var like `Major' or `MAJOR' declared as a build parameter always returns a value of `1', but an env var like `MAJOR_NO' returns the actual/correct value. I have another build parameter with an underscore and it works, and any other system env vars look good too.

          Thank you,
          Zach

          Zachary Young added a comment - - edited I am having mixed results with ver. 2.6: An env var like `Major' or `MAJOR' declared as a build parameter always returns a value of `1', but an env var like `MAJOR_NO' returns the actual/correct value. I have another build parameter with an underscore and it works, and any other system env vars look good too. Thank you, Zach

          Alan Harder added a comment -

          This may also be related to JENKINS-7075.. I'm not sure if the vars provided by setenv plugin are among those not currently available to post-build actions.

          Alan Harder added a comment - This may also be related to JENKINS-7075 .. I'm not sure if the vars provided by setenv plugin are among those not currently available to post-build actions.

          Noah Sussman added a comment - - edited

          Fwiw, this is the workaround I am using in order to generate text and then email it using the Extended Email plugin. Basically I prefix certain lines of the console log with a token, and then I use the Extended Email plugin's BUILD_LOG_REGEX feature to filter for lines that contain that token.

          Let's say my build generates a logfile called my_logfile, which is what I want to include. What I do is cat out the file and prefix each line with the token "EMAIL:"

          cat my_logfile | perl -lpe '$_=qq{EMAIL:\t $_}'
          

          Then in "Default Content" field of the Extended Email plugin I can say:

          ${BUILD_LOG_REGEX, regex="EMAIL:\\t (.*)", substText="$1", showTruncatedLines=false}
          

          And that results in sending an email that contains the content of my_logfile

          Noah Sussman added a comment - - edited Fwiw, this is the workaround I am using in order to generate text and then email it using the Extended Email plugin. Basically I prefix certain lines of the console log with a token, and then I use the Extended Email plugin's BUILD_LOG_REGEX feature to filter for lines that contain that token. Let's say my build generates a logfile called my_logfile , which is what I want to include. What I do is cat out the file and prefix each line with the token "EMAIL:" cat my_logfile | perl -lpe '$_=qq{EMAIL:\t $_}' Then in "Default Content" field of the Extended Email plugin I can say: ${BUILD_LOG_REGEX, regex="EMAIL:\\t (.*)", substText="$1", showTruncatedLines=false} And that results in sending an email that contains the content of my_logfile

          Alex Earl added a comment -

          Is this still an issue with the latest plugin and Jenkins?

          Alex Earl added a comment - Is this still an issue with the latest plugin and Jenkins?

          Max Andersen added a comment -

          This is still not working in mail-ext.

          Max Andersen added a comment - This is still not working in mail-ext.

          Alex Earl added a comment -

          Since setenv is deprecated, have you tried EnvInject?

          Alex Earl added a comment - Since setenv is deprecated, have you tried EnvInject?

          Max Andersen added a comment -

          No, how would one do that ?

          Max Andersen added a comment - No, how would one do that ?

          Alex Earl added a comment -

          Install the EnvInject plugin and setup the injection of the environment variables, then see if the variables are available via the $ENV_VAR or ${ENV, var="ENV_VAR"} syntax.

          Alex Earl added a comment - Install the EnvInject plugin and setup the injection of the environment variables, then see if the variables are available via the $ENV_VAR or ${ENV, var="ENV_VAR"} syntax.

          Alex Earl added a comment -

          This is not a defect in the email-ext plugin.

          Alex Earl added a comment - This is not a defect in the email-ext plugin.

            Unassigned Unassigned
            jminne jminne
            Votes:
            6 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: