Чтобы сделать файл определения конвейера моего jenkins более настраиваемым, я стараюсь использовать максимум переменных.Переменная в трубе дженкинсов
Когда я пытаюсь использовать переменную в почте или шаг Дженкинс инструкции бросить эту ошибку:
java.lang.NoSuchMethodError: No such DSL method '$' found among [archive, bat, build, catchError, checkout, deleteDir, dir, echo, emailext, emailextrecipients, error, fileExists, git, input, isUnix, load, mail, node, parallel, properties, pwd, readFile, readTrusted, retry, sh, sleep, stage, stash, step, svn, timeout, timestamps, tool, unarchive, unstash, waitUntil, withCredentials, withEnv, wrap, writeFile, ws]
Это мой Дженкинс файл определения pipleline:
#!groovy
node {
//Define job context constants
def projectName = "JenkinsPipelineTest"
def notificationEmailRecipients = "[email protected]"
def notificationEmailSender = "[email protected]"
currentBuild.result = "SUCCESS"
//Handle error that can occur in every satge
try {
//Some others stage...
stage 'Finalization'
step([$class: 'ArtifactArchiver', artifacts: '*.zip, *.tar, *.exe, *.html', excludes: null])
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: ${notificationEmailRecipients}, sendToIndividuals: false])
}
catch (err) {
//Set built state to error
currentBuild.result = "FAILURE"
//Send error notification mail
mail body: ${err},
charset: 'UTF-8',
from: ${notificationEmailSender},
mimeType: 'text/plain',
replyTo: ${notificationEmailSender},
subject: '"${projectName}" meet an error',
to: ${notificationEmailRecipients}
throw err
}
}
Это нормально или это я имею ошибку в моем файле определения?