【发布时间】:2015-03-25 21:24:33
【问题描述】:
我有一个 Jenkins 构建作业,我在触发作业时传递了一些参数。 我需要在 Groovy 脚本中使用其中一些参数。 该怎么做?
我的参数是BUG_ID,它的值是2010
我正在访问如下图
print ('BUILD_NO is '+System.getenv('BUG_ID'))
print ('BUILD_NO is ${BUG_ID}')
print ('BUILD_NO is ${env.BUG_ID}')
全部返回null
【问题讨论】:
-
您是从 shell、Groovy postbuild 插件还是以其他方式将其作为独立的 Groovy 脚本运行?
-
试试
print ('BUILD_NO is ' + BUG_ID)。