2
ジョブが正常に実行されたら、Jenking DSL Plugin/Groovyを使用して電子メールを送信しています。コンテンツセクションで Jenkinsジョブからの電子メールの内容としてのビルドログの送信
static void sendEmail(Job job, String jobName) {
job.with {
publishers {
extendedEmail {
recipientList('[email protected]')
defaultSubject("Jenkins Job started : ${jobName}")
defaultContent("See the latest build in the jenkins job here https://jenkins.xyz.com/job/${jobName}/")
contentType('text/html')
triggers {
failure {
content("See the latest build in the jenkins job here https://jenkins.xyz.com/job/${jobName}/")
contentType('text/html')
recipientList('[email protected]')
subject("Build Failed in Jenkins: ${jobName}")
}
success {
content('See the latest build in the jenkins job here https://jenkins.xyz.com/job/${jobName}/ <pre> ${BUILD_LOG, maxLines=30, escapeHtml=false} </pre>')
contentType('text/html')
recipientList('[email protected]')
subject("Build Success in Jenkins: ${jobName}")
}
}
}
}
}
}
content('See the latest build in the jenkins job here https://jenkins.xyz.com/job/${jobName}/ <pre> ${BUILD_LOG, maxLines=30, escapeHtml=false} </pre>')
私は、焦がす引用を使用する場合、私は、電子メールの内容が、やジョブ名としてログオン印刷できると私はその後、二重引用符を使用する場合、私ができジョブ名は印刷しますが、ビルドログは印刷しません。
電子メールにジョブ名とビルドログの両方を印刷するにはどうすればよいですか?
- このように、あなたが使用することができます '「」'と '「」 '必要に応じて。これらの式を使用しているBTWは、せいぜい問題になるようです([here](https://stackoverflow.com/questions/32697156/jenkins-build-log-maxlines-escapehtml-not-working)を参照))。 –