To get build status through environment variable

荒凉一梦 提交于 2019-12-25 05:05:48

问题


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?

Thanks in Advance

varghese


回答1:


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

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.

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.

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




回答2:


The build status is not set until the job has finished running, so there is no easy way to push build status to a process triggered within the build itself. You could pull build status via the API, but this would have to be an externally triggered process due to the constraint mentioned above. Any reason you aren't using the built in email support or one of the excellent email extension plugins such as this one?



来源:https://stackoverflow.com/questions/11630590/to-get-build-status-through-environment-variable

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