Are setenv hudson plugin variables available in email status?

I installed the SetEnv plugin and works great for getting variables during a task.

Unfortunately, when I try to use the env variable in the resulting status message, I have no luck at all. Should this work?

I tried both $ VARNAME and $ {VARNAME} - none of them were correctly replaced in the letter.

+1
source share
3 answers

The easiest way to use environment variables (or any variables) in your email notifications is to use the ext-email plugin .

Check out their “Link to Content Tokens” for specific purposes, but in short you will get a much more complex replacement. Here are a few I use regularly:

  • $ {ENV, var} - Displays the environment variable.
  • $ {BUILD_LOG_REGEX, regex, linesBefore, linesAfter, maxMatches, showTruncatedLines} - displays lines from the assembly log that match the regular expression.
  • $ {CHANGES_SINCE_LAST_SUCCESS, reverse, format, showPaths, changesFormat, pathFormat} - displays the changes since the last successful build.
  • $ {FAILED_TESTS} - Displays unit test error information if any tests fail.

The plugin makes it easy to define the basic "global" template in the Hudson configuration, and then "expand" this template in your job configuration - adding additional information. It also allows you to route notifications in more detail based on build / result status.

+3
source

It is already possible. It looks like you are using the wrong syntax. As mentioned earlier, the email-ext plugin has a special method for accessing environment variables. Instead, try putting this in the body of the message:

${ENV, var=VARNAME} 

An alternative method would be to use the Hudson shell function to repeat the environment variable during assembly and parse it using BUILD_LOG_REGEX.

For example, you can get this in the Execute Shell part:

 echo "Output: ${VARNAME}" 

and analyze it in a letter using

 ${BUILD_LOG_REGEX, regex="^Output:", showTruncatedLines=false, substText=""} 
+2
source
0
source

All Articles