代码之家  ›  专栏  ›  技术社区  ›  Brian

如何基于一个选定的参数创建一组Jenkins变量?

  •  0
  • Brian  · 技术社区  · 6 年前

    我在用詹金斯自由泳项目 参数化生成 启用。

    enter image description here

    如何基于所选参数创建一组变量?

    例如:

    当参数 param1 被选中,我希望变量集等于

    CONFIG=config_a.yml
    AWS_PROFILE=aws-profile-aa
    ANT_BUILD_FILE=buildA
    

    什么时候? param2 如果选择,则上述变量集应设置为

    CONFIG=config_b.yml
    AWS_PROFILE=aws-profile-bb
    ANT_BUILD_FILE=buildB
    

    CONFIG , AWS_PROFILE ,和 ANT_BUILD_FILE 变量将在 Execute shell ,和 Invoke Ant .

    enter image description here

    enter image description here

    我不想定义这样的3个参数

    enter image description here

    因为我的詹金斯计划不应该 配置 = config_a.yml AWS U剖面图 = aws-profile-bb 一起。

    2 回复  |  直到 6 年前
        1
  •  0
  •   Andrey Mashukov    6 年前

    你为什么不用蚂蚁?它非常容易为ant编写build.xml文件

    https://ant.apache.org/manual/using.html

        2
  •  0
  •   Brian    6 年前

    我发现了 Active Choices 能够解决我的问题。

    这个插件可以创建4个这样的参数

    enter image description here

    一次 test_choice_parameter 更改为 param2 ,其他3个参数将相应更改。

    enter image description here

    以下是我的活动选项配置:

    enter image description here

    enter image description here

    enter image description here

    enter image description here

    enter image description here