I am trying to add Jenkins approval stage before the deployment of MuleSoft API in CloudHub. I installed Email extension plugin and used below script in my pipeline. I am able to get approval pop-up in Jenkins dashboard but is unable to send approval email link on my approval’s mail id. Also, In the console logs I able to see that mail is sending to required approver’s mail Id. Currently I am using Jenkins version 2.440.1.
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building...'
// Add your build steps here
}
}
stage('Approval') {
steps {
script {
// Send email notification
emailext(
subject: "Approval Needed for Job ${env.JOB_NAME}",
body: "Please approve the build by clicking on the following link: ${env.BUILD_URL}input/",
to: "[email protected]"
)
// Wait for approval
input message: 'Do you approve this build?', submitter: '[email protected]'
}
}
}
stage('Deploy') {
steps {
echo 'Deploying...'
// Add your deployment steps here
}
}
}
}
And Strange thing is that I used Post Deployment Email stage as well to notify the build status and that is working fine and we are getting the Email as well based on the build status. Used below script in Jenkinsfile.
post {
failure {
mail to: '[email protected]',
cc: '[email protected]',
subject: "Failed: Build ${env.JOB_NAME}",
body: "Build failed ${env.JOB_NAME} and Build number: ${env.BUILD_NUMBER} .nn View the logs at : n ${env.BUILD_URL}"
}
success {
mail to: '[email protected]',
cc: '[email protected]',
subject: "Successful : Build ${env.JOB_NAME}",
body: "Build Successful ${env.JOB_NAME} and Build number: ${env.BUILD_NUMBER} .nn View the logs at : n ${env.BUILD_URL}"
}
}
Anyone’s input is much appreciated.
I am trying to add Jenkins approval stage before the deployment of MuleSoft API in CloudHub. I installed Email extension plugin and used below script in my pipeline. I am able to get approval pop-up in Jenkins dashboard but It is unable to send approval email link on my approval’s mail id. Currently I am using Jenkins version 2.440.1
user25929797 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.