How to read the environment variables in groovy email template 邮件模板中读取系统环境变量
来源:互联网 发布:python读取json文件 编辑:程序博客网 时间:2024/05/29 08:11
down vote
If you are using the email-ext Jenkins plugin to send out emails, there is a "build" object that contains a lot of information about your Jenkins job.
I would do the following:
Print out the properties inside this object by adding the following code to your template:
<% println build.properties.collect{it}.join('<br />') %>
View the email template output. You can either use the Jenkins "Email Template Testing" feature or just run your job. You should see a whole bunch of "KEY=VALUE" print outs.
Look for the environment variable you are interested in. If your environment variable is listed in
environment={BUILD_NUMBER=45, BUILD_DISPLAY_NAME=#45...}
, you can just callbuild.environment['BUILD_NUMBER']
to get 45.If you want to inject custom environment variables I would suggest installing the Env Inject Plugin, defining your variables through that plugin and then looking for the variable in build.envVars
<% println build.environment['BUILD_NUMBER'] %>
<%=build.environment['BUILD_NUMBER']%>
- How to read the environment variables in groovy email template 邮件模板中读取系统环境变量
- How to read email headers
- How to build the environment of MSYS in the windows?
- How to Set and Unset Local, User and System Wide Environment Variables in Linux
- How to build the environment of XPCOM in Windows XP
- 7.9.环境变量(Environment Variables)
- environment variables - 环境变量
- How to organize the Template Files in C++
- How to delete all email in the mail server using telnet & WCScript - 如何用 Telnet 删除邮件服务器上的所有邮件
- C获取linux系统环境变量方法(Environment Variables)
- How to Read and Analyze the Email Header Fields and Information about SPF, DKIM, SpamAssassin
- Ubuntu Environment Variables Setup (环境变量)
- Salesforce: How to Send Email with Default Template?
- How To Add/Increase The Size Of Redo Log Files In Rac Environment? (文档 ID 779306.1)
- Springer LNCS LaTeX投稿模板使用方法 How to use the Springer LNCS LaTeX template
- 如何Eclipse改变模板中${user}变量,How to change the variable ${user} used in the eclipse templates.
- PropertyPlaceholderConfigurer will also read system environment variables
- How to find child controls that are located in the template of a parent control
- TCP/IP协议详解笔记——ARP协议和RARP协议
- 用js方式获取时间
- 2017上海市高校程序设计邀请赛_C
- 运算符和表达式
- 【淘淘】---选择类目
- How to read the environment variables in groovy email template 邮件模板中读取系统环境变量
- Android解压ZIP文件
- 初学ui设计的一些注意事项
- 剑指offer:数组中的逆序对
- 《深入分析javaweb技术内幕》之一——SpringMVC的工作机制与设计模式
- hive查过的函数
- 008_WaitForSingleObject应用
- 循环结构(while、do…while、for)
- Android app安装常见错误描述