您想尝试使用声明性管道吗?
更改此部分
node('master') {
checkout(scm: [$class: 'GitSCM',
branches: [[name: "*/develop"]],
extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'repo1']],
userRemoteConfigs: [[credentialsId: 'bitbucket.jenkins',
url: 'urlToRepo.git']]],
changelog: true, poll: true)
showChangeLogs()
//currentBuild.result = 'FAILURE'
emailext(
subject: 'Deployment',
body: '${SCRIPT, template="groovy-html.template"}',
to: 'email@address.com')
}
通过这个
pipeline {
agent any
stages {
stage('master') {
steps {
script {
checkout(scm: [$class: 'GitSCM',
branches: [[name: "*/develop"]],
extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'repo1']],
userRemoteConfigs: [[credentialsId: 'bitbucket.jenkins',
url: 'urlToRepo.git']]],
changelog: true, poll: true)
showChangeLogs()
//currentBuild.result = 'FAILURE'
}
}
}
}
post {
always {
emailext(
subject: 'Deployment',
body: '${SCRIPT, template="groovy-html.template"}',
to: 'email@address.com')
}
}
}