Groups
Groups
Sign in
Groups
Groups
Jenkins Users
Conversations
About
Send feedback
Help
terinary operators in declared pipeline
20 views
Skip to first unread message
Rita Morgan
unread,
Jun 1, 2022, 12:48:02 PM
6/1/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Jenkins Users
I know you can do terninary operations. Is it possible to chain them?
so,
if branch = "main" ? "@daily":""
if branch = "master" ?" @hourly":""
and so on?
Message has been deleted
Message has been deleted
Martin Schmude
unread,
Jun 2, 2022, 3:18:43 PM
6/2/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Jenkins Users
You can code
def result = (branch == "main"
? "@daily"
: (branch == "master"
? "@hourly"
: ""))
Maybe you find a switch more readable:
def result
switch(branch) {
case "main":
result = "@daily"
break
case "master":
result = "@hourly"
break
default:
result = ""
}
Reply all
Reply to author
Forward
0 new messages