触发其它配置和发送与当前詹金斯构建状态 [英] trigger other configuration and send current build status with Jenkins

查看:218
本文介绍了触发其它配置和发送与当前詹金斯构建状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一定詹金斯的配置,我想触发另​​一个配置为发表生成操作。
我想通过作为参数之一的当前构建状态。

In a certain Jenkins config, I wish to trigger another configuration as post build action. I want to pass as one of the parameters the current build status.

IE:一个字符串/ int值重新presents状态(成功/失败/是不稳定的)

IE: a string / int that represents the status (SUCCESS/FAIL/UNSTABLE).

我有2个选项来创建后生成触发器:

I have 2 options to create post build triggers:

使用插件加入

Using the join plugin

在后期使用触发参数构建构建操作

Using the trigger parameterized build in post build actions

我希望有某种形式的访问环境变量在运行结束...

I wish there was some kind of accessible env variable at end of run...

有什么想法?

谢谢!

推荐答案

您可以检查通过的 Groovy的生成后插件可通过的詹金斯的Java API 。该插件提供了具有可变的,可用于访问API的重要组成部分经理的脚本(见的用法的插件文档中的部分)。

You can check for status using Groovy script in post-build step via Groovy Post-Build plugin that can access Jenkins internals via Jenkins Java API. The plugin provides the script with variable manager that can be used to access important parts of the API (see Usage section in the plugin documentation).

例如,你这是怎么能输出构建结果建立控制台:

For example, this is how you can output build result to build console:

def result = manager.build.result
manager.listener.logger.println "And the result is: ${result}"

现在,你可以改用值来创建一个属性文件并通过该文件来触发参数生成后步骤(它有这样一个选项)。

Now, you can instead use that value to create a properties file and pass that file to Parameterized Trigger post-build step (it has such an option).

警告:我不知道是否有可能安排后生成步骤以特定的顺序,以确保Groovy的生成后步骤来执行参数触发步骤之前运行。

One caveat: I am not sure if it is possible to arrange post-build steps to execute in a particular order to ensure that Groovy post-build step runs before the Parameterized Trigger step.

这篇关于触发其它配置和发送与当前詹金斯构建状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆