在Active Choice反应参数中使用groovy脚本检索Jenkins作业名称 [英] Retrieving Jenkins job name using groovy script in Active Choice Reactive Parameter

查看:437
本文介绍了在Active Choice反应参数中使用groovy脚本检索Jenkins作业名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使用下面的groovy脚本检索作业名称.即使当我在执行系统Groovy构建步骤"中运行此脚本时,它也会给我带来错误. 错误:

I am unable to retrieve the Job name using groovy script below. Even when I run this script in the Execute System Groovy Build Step, it gives me the error as. Error:

groovy.lang.MissingPropertyException: No such property: jenkinsProject for class: groovy.lang.Binding

----
def jobName = this.binding.jenkinsProject.name
----

我在下面的链接中发现它已为某人使用,但不知为何对我没有用.有人可以帮忙吗?

I found in the below link that it has worked for someone, but somehow not working for me. Can anyone help please?

如何获取Jenkins中具有动态特性的作业名称

推荐答案

v1.3和v1.4(手动测试完成后几天发布)都应支持此功能.只需在您的代码中使用jenkinsProject,就可以正常工作.其他明智的做法是通过issue.jenkins-ci.org,component = active-choices-plugin告诉我们.

The v1.3 and v1.4 (released in a couple of days once manual testing is done) both should support this feature. Just use jenkinsProject in you code and that should work fine. Other wise just let us know via issues.jenkins-ci.org, component=active-choices-plugin.

v1.4的一个错误修复程序使您也可以将此变量与Matrix项目一起使用.

The v1.4 has a bug fix that allows you to use this variable with Matrix projects as well.

希望有帮助, 布鲁诺

这篇关于在Active Choice反应参数中使用groovy脚本检索Jenkins作业名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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