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

Environmental variables are always empty in email-ext plugin

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: email-ext-plugin
    • Labels:
    • Environment:
      Jenkins version 2.235.1
      Email Extension Plugin version 2.69
      Token Macro Plugin version 2.12
    • Similar Issues:

      Description

      It seems as if environmental variables don't work with the emailext plugin. I am using declarative pipelines, but regardless of what I try the ${ENV, var=""} returns nothing. I can see that the double quoted subject "$VERSION" is correctly replaced and other tokens work such as single quoted '${BUILD_STATUS}' work, but '${ENV, var=""}' and '${ENV, var="VERSION"}' are always replaced empty. Same occurs with variables such as $PATH.

       

      pipeline {
        environment {
          VERSION = "1.0.0"
        }
       
        // ...
        // stages
        // ...
      
        post {
          always {
            emailext (
              to: 'DEFAULT_RECIPIENTS',
              subject: "$VERSION",
              body: '${ENV, var="VERSION"}'
            )
          }
        }
      }
      

       

      Regards

      Erik Hughes

        Attachments

          Activity

          seb_erik_hughes Erik Hughes created issue -
          seb_erik_hughes Erik Hughes made changes -
          Field Original Value New Value
          Description It seems as if environmental variables don't work with the emailext plugin. I am using declarative pipelines, but regardless of what I try the ${ENV, var=""} returns nothing. I can see that the double quoted subject $VERSION is correctly replaced and other tokens work such as '${BUILD_STATUS}' work, but never '${ENV, var=""}'.

           

           
          {code:java}
          pipeline {
            environment {
             VERSION = "1.0.0"
            }
           
            // ...
            // stages
            // ...

            post {
             always {
               emailext (
                 to: 'DEFAULT_RECIPIENTS',
                  subject: "$VERSION",
                  body: '${ENV, var="VERSION"}'
                )
              }
            }
          }
          {code}
           

           

          Regards

          Erik Hughes
          It seems as if environmental variables don't work with the emailext plugin. I am using declarative pipelines, but regardless of what I try the ${ENV, var=""} returns nothing. I can see that the double quoted subject $VERSION is correctly replaced and other tokens work such as '${BUILD_STATUS}' work, but never '${ENV, var=""}'.

           
          {code:java}
          pipeline {
            environment {
             VERSION = "1.0.0"
            }
           
            // ...
            // stages
            // ...

            post {
             always {
               emailext (
                 to: 'DEFAULT_RECIPIENTS',
                  subject: "$VERSION",
                  body: '${ENV, var="VERSION"}'
                )
              }
            }
          }
          {code}
           

          Regards

          Erik Hughes
          seb_erik_hughes Erik Hughes made changes -
          Description It seems as if environmental variables don't work with the emailext plugin. I am using declarative pipelines, but regardless of what I try the ${ENV, var=""} returns nothing. I can see that the double quoted subject $VERSION is correctly replaced and other tokens work such as '${BUILD_STATUS}' work, but never '${ENV, var=""}'.

           
          {code:java}
          pipeline {
            environment {
             VERSION = "1.0.0"
            }
           
            // ...
            // stages
            // ...

            post {
             always {
               emailext (
                 to: 'DEFAULT_RECIPIENTS',
                  subject: "$VERSION",
                  body: '${ENV, var="VERSION"}'
                )
              }
            }
          }
          {code}
           

          Regards

          Erik Hughes
          It seems as if environmental variables don't work with the emailext plugin. I am using declarative pipelines, but regardless of what I try the ${ENV, var=""} returns nothing. I can see that the double quoted subject "$VERSION" is correctly replaced and other tokens work such as single quoted '${BUILD_STATUS}' work, but never '${ENV, var=""}'.

           
          {code:java}
          pipeline {
            environment {
             VERSION = "1.0.0"
            }
           
            // ...
            // stages
            // ...

            post {
             always {
               emailext (
                 to: 'DEFAULT_RECIPIENTS',
                  subject: "$VERSION",
                  body: '${ENV, var="VERSION"}'
                )
              }
            }
          }
          {code}
           

          Regards

          Erik Hughes
          seb_erik_hughes Erik Hughes made changes -
          Description It seems as if environmental variables don't work with the emailext plugin. I am using declarative pipelines, but regardless of what I try the ${ENV, var=""} returns nothing. I can see that the double quoted subject "$VERSION" is correctly replaced and other tokens work such as single quoted '${BUILD_STATUS}' work, but never '${ENV, var=""}'.

           
          {code:java}
          pipeline {
            environment {
             VERSION = "1.0.0"
            }
           
            // ...
            // stages
            // ...

            post {
             always {
               emailext (
                 to: 'DEFAULT_RECIPIENTS',
                  subject: "$VERSION",
                  body: '${ENV, var="VERSION"}'
                )
              }
            }
          }
          {code}
           

          Regards

          Erik Hughes
          It seems as if environmental variables don't work with the emailext plugin. I am using declarative pipelines, but regardless of what I try the ${ENV, var=""} returns nothing. I can see that the double quoted subject "$VERSION" is correctly replaced and other tokens work such as single quoted '${BUILD_STATUS}' work, but '${ENV, var=""}' and '${ENV, var="VERSION"}' are always replaced empty.

           
          {code:java}
          pipeline {
            environment {
             VERSION = "1.0.0"
            }
           
            // ...
            // stages
            // ...

            post {
             always {
               emailext (
                 to: 'DEFAULT_RECIPIENTS',
                  subject: "$VERSION",
                  body: '${ENV, var="VERSION"}'
                )
              }
            }
          }
          {code}
           

          Regards

          Erik Hughes
          seb_erik_hughes Erik Hughes made changes -
          Description It seems as if environmental variables don't work with the emailext plugin. I am using declarative pipelines, but regardless of what I try the ${ENV, var=""} returns nothing. I can see that the double quoted subject "$VERSION" is correctly replaced and other tokens work such as single quoted '${BUILD_STATUS}' work, but '${ENV, var=""}' and '${ENV, var="VERSION"}' are always replaced empty.

           
          {code:java}
          pipeline {
            environment {
             VERSION = "1.0.0"
            }
           
            // ...
            // stages
            // ...

            post {
             always {
               emailext (
                 to: 'DEFAULT_RECIPIENTS',
                  subject: "$VERSION",
                  body: '${ENV, var="VERSION"}'
                )
              }
            }
          }
          {code}
           

          Regards

          Erik Hughes
          It seems as if environmental variables don't work with the emailext plugin. I am using declarative pipelines, but regardless of what I try the ${ENV, var=""} returns nothing. I can see that the double quoted subject "$VERSION" is correctly replaced and other tokens work such as single quoted '${BUILD_STATUS}' work, but '${ENV, var=""}' and '${ENV, var="VERSION"}' are always replaced empty. Same occurs with variables such as $PATH.

           
          {code:java}
          pipeline {
            environment {
             VERSION = "1.0.0"
            }
           
            // ...
            // stages
            // ...

            post {
             always {
               emailext (
                 to: 'DEFAULT_RECIPIENTS',
                  subject: "$VERSION",
                  body: '${ENV, var="VERSION"}'
                )
              }
            }
          }
          {code}
           

          Regards

          Erik Hughes
          slide_o_mix Alex Earl made changes -
          Assignee Alex Earl [ slide_o_mix ]
          basil Basil Crow made changes -
          Issue Type Bug [ 1 ] Improvement [ 4 ]

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            seb_erik_hughes Erik Hughes
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: