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 .
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 .
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:
node(windowsNode) {
nslookup()
CMList() // Calling CMList function under `windowsnode`.
}
The function CMList is defined as below:
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
'No such DSL method 'createEmailList' found among steps [ArtifactoryGradleBuild, MavenDescriptorStep, addBadge'....
What I have tried:
I tried not to mention the datatype in arguments of function and also tried not to use if conditional as start , rather I prepended `script{} ` block before if conditional but no luck
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
}