gpt4 book ai didi

jenkins - 如何在 Jenkins 管道中设置默认选择?

转载 作者:行者123 更新时间:2023-12-02 03:42:48 25 4
gpt4 key购买 nike

非常令人沮丧,我找不到这样的例子。如何设置默认选择?

parameters {
choice(
defaultValue: 'bbb',
name: 'param1',
choices: 'aaa\nbbb\nccc',
description: 'lkdsjflksjlsjdf'
)
}

defaultValue 在此无效。我希望该选择是可选的,并且如果管道非手动运行(通过提交),则设置默认值。

最佳答案

您无法在选项中指定默认值。根据 choice 输入的文档,第一个选项将是默认选项。

The potential choices, one per line. The value on the first line will be the default.

您可以在 documentation source 中看到这一点,以及如何在 source code 中调用它.

return new StringParameterValue(
getName(),
defaultValue == null ? choices.get(0) : defaultValue, getDescription()
);

关于jenkins - 如何在 Jenkins 管道中设置默认选择?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47873401/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com