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.
CodePudding user response:
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.