我正在尝试使用 env 参数来自定义电子邮件正文。但我无法实现它。
String parameter1 : NAMESPACE = abcd
詹金斯管道:
agent{ label 'apps' }
stages {
stage("Checkout Sourcecode") {
xxxxxx
}
stage('Create namespace'){
steps {
sh """kubectl create namespace ${env.NAMESPACE}"""
}
}
stage ("Clearing Workspace"){
steps{
cleanWs()
}
}
}
post {
success {
emailext body: '''Hi,
${env.NAMESPACE} is created.
Build is ${currentBuild.currentResult}
Regards,
DT''', subject: 'Build ${BUILD_STATUS} - Build #${BUILD_NUMBER}', to: 'abc@xyz.com'
}
}
}
电子邮件输出:
Subject: Build Success - Build #8
Hi,
${env.NAMESPACE} is created.
Build is ${currentBuild.currentResult}
Regards,
DT
预期的输出是获取 NAMESPACE 和 currentBuild.currentResult 的值。我究竟做错了什么?