8

I know there is $BUILD_STATUS and &BUILD_URL variables in Email-ext plugin. But I cant find anywhere what are all variables available to me... Where can I find them all, like duration time, date etc.?

Dim
  • 4,527
  • 15
  • 80
  • 139
  • 1
    Possible duplicate of [Jenkins Email-ext plugin - tokens](http://stackoverflow.com/questions/10832486/jenkins-email-ext-plugin-tokens) – nwinkler Aug 12 '16 at 12:53

3 Answers3

11

Well, email-ext has access to all the Jenkins environment variables for jobs. Below is a list in the Jenkins documentation. Some plugins also add their own variables

https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-below

Edit:

The wiki page says this about tokens: To see a list of all available email tokens and what they display, you can click the "?" (question mark) associated with the Content Token Reference at the top bottom of the email-ext section on the project configuration screen.

Dakota Brown
  • 730
  • 7
  • 20
  • That is not it... I know this table. I know I can use BUILD_STATUS but its nowhere in this table, so may others the same. – Dim Jun 29 '16 at 12:31
  • 1
    The wiki page says this about tokens: To see a list of all available email tokens and what they display, you can click the "?" (question mark) associated with the Content Token Reference at the top bottom of the email-ext section on the project configuration screen. – Dakota Brown Jun 29 '16 at 12:46
  • Oh... There it is. Thank you.Please post it as an answer – Dim Jun 29 '16 at 13:41
5

YourURL/env-vars.html/

lists all available variables (not including plug-ins).

tkosinski
  • 1,631
  • 13
  • 17
2

I encounter this issue in my project. Environment variable defined in pipeline cannot be accessed in emailext body.

Try ${ENV,var="xxx"}, ${xxx} and ${env.xxx}, no one works.

Finally, use following way to fix it.

pipeline {
  agent any
  environment {
    xxx = sh(script: "echo `date -Iseconds`", returnStdout: true).trim()
  }
  stages {
    stage('Test') {
      steps {
        writeFile file: 'env.properties', text: "xxx=${xxx}"
        emailext body: '''${PROPFILE,file="env.properties",property="xxx"}
'''
      }
    }
  }
}
Ren Weibo
  • 97
  • 1
  • 3