Jenkins Multi Select参数将文件发送到多个服务,并通过SSH插件发送

发布于 2025-02-09 22:39:58 字数 627 浏览 5 评论 0原文

我有一个詹金斯(Jenkins)作业,将文件发布给某些服务器。 我创建了一个带有服务器名称的扩展选择参数。 例如: 基本参数类型 - >参数类型[MultiSelect] - >值(Server1,Server2,Server3,Server) - >定界符(,)。 它在作业上正确显示,我能够从选择列表中选择多个服务器。

我已经在“通过SSH”插件中成功配置了这些服务器。

当我仅从列表中选择一台服务器时,它可以正常工作, 但是,当我做出多个选择时,作业失败了,不会向选定的服务器发送任何文件。

控制台输出:

20:01:28 SSH: Skipping [server1] - Label [server1] does not match expression [server1,server3]
20:01:28 SSH: Skipping [server2] - Label [server2] does not match expression [server1,server3]
20:01:28 SSH: Skipping [server3] - Label [server3] does not match expression [server1,server3]

请帮助如何使用插件选择多个选项。

I have a jenkins job which publishes files to some servers.
I have created a extended choice parameter with server names.
Eg:
Basic Parameter Type -> Paramter Type [Multiselect] -> Values (server1,server2,server3,server) -> delimiter (,).
Which shows correctly on job and I am able to select multiple servers from the choice list.

And I have successfully configured these servers in "Publish over SSH" plugin.

When I select only one server from the list, It works fine,
But when I make multiple selections the job fails and doesn't send any files to selected servers.

Console Output :

20:01:28 SSH: Skipping [server1] - Label [server1] does not match expression [server1,server3]
20:01:28 SSH: Skipping [server2] - Label [server2] does not match expression [server1,server3]
20:01:28 SSH: Skipping [server3] - Label [server3] does not match expression [server1,server3]

Please help on how to select multiple options using the plugin.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

随风而去 2025-02-16 22:39:58

帮助页面说

参数化发布

通过将标签与正则表达式匹配到服务器
由参数或环境变量提供。

对于每个服务器,标签将与表达式匹配,并且
如果匹配,发布将继续,否则服务器将是
跳过。如果未为服务器设置标签,则将默认为
空字符串。配置的标签从一开始就删除了空格
和它们的结局,这意味着所有空格标签将是
评估为一个空字符串。相同的标签可以使用多个
时代,例如,对于数据库服务器而言,再次为Web服务器提供。
正则表达语法是Java语法。

标签可以使用标准的詹金斯环境变量
$ node_name,或构建变量,例如矩阵轴。

参数名称

将包含的参数或环境变量的名称
匹配标签的表达式。

这意味着您必须将逗号分隔的列表转换为正则表达式。

您可以尝试在基本参数类型中使用定界符|,在REGEX中表示“或”。

The help page says

Parameterized publishing

Publish to servers by matching labels against a regular expression
provided by a parameter or an environment variable.

For each server the label will be matched against the expression, and
if matched, the publish will continue, otherwise that server will be
skipped. If a label is not set for a server it will default to the
empty string. Configured labels have whitespace removed from the start
and end of them, which means that an all whitespace label will be
evaluated as an empty string. The same label can be used multiple
times, e.g. UAT for a database server and again for the web server.
The regular expression syntax is the java syntax.

The labels can use the standard Jenkins environment variables e.g.
$NODE_NAME, or build variables such as a matrix axis.

Parameter name

The name of the parameter or environment variable that will contain
the expression for matching the labels.

This means you have to convert your comma-separated list into a Regular Expression.

You can try to use delimiter | in the Basic Parameter type, that means "or" in RegEx.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文