By selecting Inject environment variables to the build process you will get:
Evaluated Groovy script gives you possibility to set environment variable based on result of executed command:
return [HOSTNAME_SHELL: 'hostname'.execute().text,
DATE_SHELL: 'date'.execute().text,
ECHO_SHELL: 'echo hello world!'.execute().text
]
- or with explicit Groovy code:
return [HOSTNAME_GROOVY: java.net.InetAddress.getLocalHost().getHostName(),
DATE_GROOVY: new Date()