1

我正在使用 Build Flow 插件来执行并行构建。我需要将选择参数(branch_name)从父作业传递给子作业。我不确定如何让这个工作。选择参数有多个分支名称。我怎样才能做到这一点?

这是代码示例,

// Here's where I set the variable for the choice parameter (branch_name)

branch_name = ${branch_name}

// Here's where I call the variable to pass to the other jobs

 parallel (
  { build("build1", branch_name:params["branch_name"], },
  { build("build2", branch_name:params["branch_name"], },
  { build("build3", branch_name:params["branch_name"], },
  { build("build4", branch_name:params["branch_name"], },
)    

我究竟做错了什么?请帮忙。谢谢。

4

1 回答 1

3

假设你有这个工作?对于未来的谷歌人,我认为应该是这样的:

// Get the parameter of the parent, flow job - should be available as environment variable
def branch = build.environment.get("PARENT_PARAM_NAME")

parallel (
    // pass to child job
    { build("build1", CHILD_PARAM_NAME: branch)},
    // repeat as required
)
于 2015-09-29T11:15:55.363 回答