Dynamic parameter based on previous string parameter

我与影子孤独终老i 提交于 2021-02-09 10:52:34

问题


In Jenkins I have a string parameter HOST. After this parameter I have a dynamic parameter URL. This parameter needs to be a concatenation of strings, including the previously defined HOST parameter.

I have been unable to find out how to do this.

The motivation for this is subsequent parameters will also use this HOST parameter.


回答1:


Just make sure I understand your requirement correctly: you have two parameters and the later one is depends on the value of the first one?

If it's so I think plugin Parameterized Build is enough for this:

  • Job configuration:

  • Build with specified value:

  • Build result:

  • If you change your HOST value at build, the URL will also changed.

Hope this helps :-)




回答2:


The dynamic parameter plugin might not be the right choice for your task. If you want the URL parameter to be updated according to the changes in the HOST parameter, you should consider using the Active Choices Plugin.

In your case, create a String parameter for the host, and an active choice reactive parameter for the url. this parameter reads the host and updates the url. example:

(you can find another example here: https://stackoverflow.com/a/42871619/947784)



来源:https://stackoverflow.com/questions/42856668/dynamic-parameter-based-on-previous-string-parameter

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!