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

provide access to arbitrary environment variables

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • email-ext-plugin
    • None
    • Platform: All, OS: All

      It would be useful to be able to access other environemnt variables, apart from
      the predefined ones. The user should be able to set such variables in a build
      step, and then access them as tokens in the e-mail template.

          [JENKINS-3605] provide access to arbitrary environment variables

          Alan Harder added a comment -

          Implemented in r15326 by againjj.
          Included in email-ext 2.3, released today.

          Alan Harder added a comment - Implemented in r15326 by againjj. Included in email-ext 2.3, released today.

          rajpra added a comment - - edited

          I found a issues with this fix.

          the environment variables displayed are system ones only. So if part of the build script you set a environment variable which you want show in the email, you cant.
          eg.
          If in Linux build script i add.

          export COPY_PATH=/var/app/$BUILD_TAG/

          In the Hudson email config I would like to say:

          Build has been copied to ${ENV, COPY_PATH}
          But when i do this, nothing is displayed.

          rajpra added a comment - - edited I found a issues with this fix. the environment variables displayed are system ones only. So if part of the build script you set a environment variable which you want show in the email, you cant. eg. If in Linux build script i add. export COPY_PATH=/var/app/$BUILD_TAG/ In the Hudson email config I would like to say: Build has been copied to ${ENV, COPY_PATH} But when i do this, nothing is displayed.

          rajpra added a comment -

          same type of issue

          rajpra added a comment - same type of issue

          rajpra added a comment -

          related.

          rajpra added a comment - related.

          mdonohue added a comment -

          That is not the way environment variables work. When you set an environment variable in a child shell, it is not accessible by the parent. You need to have the copy path set as a Hudson parameter.

          mdonohue added a comment - That is not the way environment variables work. When you set an environment variable in a child shell, it is not accessible by the parent. You need to have the copy path set as a Hudson parameter.

          dcoraboe added a comment -

          This case happens also for some parameterised builds.

          Our build is parameterised by a SOURCE_BUILD_NUMBER variable.

          The mail contains the reference ${ENV,SOURCE_BUILD_NUMBER} as indicated in the help, but this value is not replaced.

          dcoraboe added a comment - This case happens also for some parameterised builds. Our build is parameterised by a SOURCE_BUILD_NUMBER variable. The mail contains the reference ${ENV,SOURCE_BUILD_NUMBER} as indicated in the help, but this value is not replaced.

          Alan Harder added a comment -

          reclosing.. export from subshell is invalid, as mentioned, and getting values from parameters is tracked in a separate issue: JENKINS-7075

          Alan Harder added a comment - reclosing.. export from subshell is invalid, as mentioned, and getting values from parameters is tracked in a separate issue: JENKINS-7075

            againjj againjj
            mbetter Marcus Better
            Votes:
            3 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: