Are setenv hudson plugin variables accessible in status email?

雨燕双飞 提交于 2019-12-03 21:44:05

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

Check their "Content token reference" for specifics but in short you get much more sophisticated substitution. Heres a few I use regularly:

  • ${ENV, var} - Displays an environment variable.
  • ${BUILD_LOG_REGEX, regex, linesBefore, linesAfter, maxMatches, showTruncatedLines} - Displays lines from the build 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 failing unit test information, if any tests have failed.

The plugin makes it easy to define a base "global" template in the Hudson configuration then sort of "extend" that template in your job configuration- adding additional detail. It also allows you to route notifications more granularly based on the build status/outcome.

This is possible already. It looks like you're using the wrong syntax. As mentioned previously, the email-ext plugin has a specific method for accessing environment variables. Try putting this in the email body instead:

${ENV, var=VARNAME}

An alternative method would be to use Hudson's execute shell feature to echo the environment variable during the build and parsing for it using BUILD_LOG_REGEX.

For example, you could have this in the Execute Shell part:

echo "Output: ${VARNAME}"

and parse it in the email using

${BUILD_LOG_REGEX, regex="^Output:", showTruncatedLines=false, substText=""}

It looks like I will have to wait for this:

http://wiki.hudson-ci.org/display/HUDSON/The+new+EMailer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!