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

Environmental variables are always empty in email-ext plugin

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • email-ext-plugin
    • Jenkins version 2.235.1
      Email Extension Plugin version 2.69
      Token Macro Plugin version 2.12
    • 270.v8c2ce50dc4fc

      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

          [JENKINS-63551] Environmental variables are always empty in email-ext plugin

          Erik Hughes created issue -
          Erik Hughes made changes -
          Description Original: 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
          New: 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
          Erik Hughes made changes -
          Description Original: 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
          New: 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
          Erik Hughes made changes -
          Description Original: 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
          New: 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
          Erik Hughes made changes -
          Description Original: 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
          New: 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
          Alex Earl made changes -
          Assignee Original: Alex Earl [ slide_o_mix ]
          Basil Crow made changes -
          Issue Type Original: Bug [ 1 ] New: Improvement [ 4 ]
          Alex Earl made changes -
          Assignee New: Alex Earl [ slide_o_mix ]
          Alex Earl made changes -
          Released As New: 270.v8c2ce50dc4fc
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Fixed but Unreleased [ 10203 ]
          Alex Earl made changes -
          Status Original: Fixed but Unreleased [ 10203 ] New: Resolved [ 5 ]
          Alex Earl made changes -
          Status Original: Resolved [ 5 ] New: Closed [ 6 ]

            slide_o_mix Alex Earl
            seb_erik_hughes Erik Hughes
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: