本文介绍了通过环境变量获取构建状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 jenkins 进行持续集成.为了我的构建目的,我使用 Ant 任务触发电子邮件.我无法找到一个环境变量来传递 ant 以发送电子邮件构建状态(成功/失败/稳定).我想知道如何获取构建状态的环境变量?...如果不可用,构建状态的替代选项是什么?

I am using jenkins for continous integration. For my build purpose, i triggering email using Ant task. I am not able to find an environment variable to pass ant for sending email build status(success/failure/stable).i want to know how can i get environment variable for build status?..if not available, what is the alternative option for build status?

提前致谢

变量

推荐答案

当您有两个很棒的插件可以做到这一点时,为什么要使用 ANT 从 Jenkins 发送电子邮件?

Why use ANT to send emails from Jenkins when you have two great plugins that does just that?

默认的邮件通知相当不错,如果你想有更多的控制
我建议使用 Email-ext 插件 非常全面.

The default mail notification is quite good, and if you would like to have more control
I suggest using the Email-ext plugin which is very comprehensive.

如果仍然希望使用 ANT 发送您的邮件通知,包括状态
你必须把你的过程分成两个步骤,
第一部分运行构建,第二部分运行 ANT 脚本以报告状态.

If still wish to use ANT to sent your mail-notifications including the status
you will have to break your process into two steps,
where the first part runs the build and the second one runs the ANT script to report the status.

在这种情况下,您需要通过参数化构建插件从第一个作业触发第二个作业 -
在此处查看我的答案:
触发其他配置并使用 Jenkins 发送当前构建状态

In this case, you will need to trigger the second job from the first job via the Parameterized Build plugin -
see my answer here:
trigger other configuration and send current build status with Jenkins

这篇关于通过环境变量获取构建状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-20 02:42