You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何获取处于运行状态的任务最新构建的构建参数?

获取Jenkins任务最新构建的参数(含运行中构建)

如果需要获取Jenkins任务的最新构建参数——哪怕该构建还在运行中,可使用以下Groovy代码实现:

def buildParameter = currentJob.getAction(ParametersAction.class)
paramValue = buildParameter.getParameter("modificationDate").getValue()
println(paramValue)

代码说明:

  • 通过currentJob.getAction(ParametersAction.class)获取当前任务关联的参数动作实例
  • 调用getParameter("modificationDate")定位到指定名称的参数(示例中参数名为modificationDate)
  • 用getValue()提取参数的实际值,最后打印输出

内容的提问来源于stack exchange,提问作者Juveria Iram

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.07 02:37:34