Article 5EN4H How to use if conditionals under stages in DSL pipeline

How to use if conditionals under stages in DSL pipeline

by
parpande
from LinuxQuestions.org on (#5EN4H)
I want to call a function under my pipeline , the function name is CMList and the arguments eList and pLists are in the format of email address .

Quote:
def eList ="${emailAddress}"
def pLists = "${POEmailList}"


Below are the choice parameter added , so that the entries appear in the Jenkins UI and value needs to be input for both
eList and pLists .

Quote:
properties([
parameters([
text(description: 'Provide Email Address of the PO ', name: 'POEmailList'),
text(description: 'Provide Email Address of the people to be notified', name: 'emailAddress'),
])
])


Below snippet describes the function call:

Quote:
node(windowsNode) {
nslookup()
CMList() // Calling CMList function under `windowsnode`.
}

The function CMList is defined as below:

Quote:
void CMList(String eList,String pLists)
stage('Generate Email List To Be Notified') {
if(!((currentBuild.currentresult).contains('UNSTABLE'))){
eList = eList + ";" + pLists
}
echo 'Notify to users - '+ eList
}

I want to create a function as CMList that consists of a stage in groovy . But this function throws the error as:

Quote:
'No such DSL method 'createEmailList' found among steps [ArtifactoryGradleBuild, MavenDescriptorStep, addBadge'....
latest?d=yIl2AUoC8zA latest?i=-9F1Ghus_Rs:8fFfTIzE4xM:F7zBnMy latest?i=-9F1Ghus_Rs:8fFfTIzE4xM:V_sGLiP latest?d=qj6IDK7rITs latest?i=-9F1Ghus_Rs:8fFfTIzE4xM:gIN9vFw-9F1Ghus_Rs
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments