Jenkinsfile and parameters

25 views
Skip to first unread message

Alfredo De Luca

unread,
Apr 7, 2020, 6:46:02 AM4/7/20
to jenkins...@googlegroups.com
Hi all. 

I have a Jenkinsfile with some text parameters for inputs. 
In one of them I would like to have multiple words with a comma separation like
10.10.10.10,10.10.10.20,10.10.10.30

then my question is:
How can i split those inputs in different variables? 
Any idea/clue? 

cheers

--
Alfredo

Antonio Gomez

unread,
Apr 7, 2020, 7:30:46 AM4/7/20
to Jenkins Users
Hello,
I have the  same case and I have solved it lke this:

def ParamServer = "${params.Server}".tokenize(",")
 
Recover values from parameter and I separate them by commas, after yo can acces that a simple array

for (Server in ParamServer)  {
echo "foo"

Antonio Gomez

unread,
Apr 7, 2020, 7:32:31 AM4/7/20
to Jenkins Users
for (Server in ParamServer)  {
echo Server
}

Sorry I have made a mistake in the above

Alfredo De Luca

unread,
Apr 7, 2020, 11:11:43 AM4/7/20
to jenkins...@googlegroups.com
Thanks Antonio. 
I will try that asap. 
Appreciated. 

/Alfredo

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/40b37647-75cd-435e-bcb0-ef88be50c825%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages