jenkins-email-ext

Send email on jenkins pipeline failure

喜你入骨 提交于 2020-01-11 15:37:31
问题 How can i add to a jenkins pipeline an old-style post-build task which sends email when the build fails? I cannot find "Post-build actions" in the GUI for a pipeline. I know that i can wrap the entire build script try/catch, however this seems ugly when the build script is large and continues to send emails even when the job was aborted manually. I would like to achive the same functionality as with the previouse email-ext based post-build action. try { // Do sth } catch(e) { emailext body: '

Send email on jenkins pipeline failure

巧了我就是萌 提交于 2020-01-11 15:37:15
问题 How can i add to a jenkins pipeline an old-style post-build task which sends email when the build fails? I cannot find "Post-build actions" in the GUI for a pipeline. I know that i can wrap the entire build script try/catch, however this seems ugly when the build script is large and continues to send emails even when the job was aborted manually. I would like to achive the same functionality as with the previouse email-ext based post-build action. try { // Do sth } catch(e) { emailext body: '

Jenkins: Can't send zip archive via email

泄露秘密 提交于 2019-12-24 09:28:20
问题 I want to fetch project source code from GitLab, archive it and send it via email. Jenkinsfile: def gitlabRepo = 'http://repository.vrpconsulting.com/roman.skaskevich/koshcheck-copy.git' deleteDir() dir('koshcheck-copy') { stage 'Fetch' def curdir = pwd() echo curdir git url: "${gitlabRepo}", branch: 'master' stage 'Archive' zip archive: true, dir: './src', glob: '', zipFile: 'src.zip' def savedZip = archive 'src.zip' echo savedZip stage 'Notify' emailext ( to: 'roman.skaskevich@gmail.com',

How to invoke email-ext plugin from Jenkins declarative script?

荒凉一梦 提交于 2019-12-12 12:26:36
问题 I am writing a simple Jenkins declarative script to run 'make' and send an email with the result (success/failure). I can send a simple email using: post { success { mail to:"myname@me.com", subject:"${currentBuild.fullDisplayName} - Failed!", body: "Success!" } failure { mail to:"myname@me.com", subject:"${currentBuild.fullDisplayName} - Failed!", body: "Failure!" } } The resulting email is rather simplistic. How can I call the email-ext plugin from the script to send an old-style post-build

Access custom environment variables in jelly template

独自空忆成欢 提交于 2019-12-12 12:15:27
问题 With Jenkins pipeline you are able to set any environment variable through Global Variable called - env . Jelly template in it's turn gives you ability to access Jenkins API including hudson.model.AbstractBuild and hudson.model.AbstractProject objects. Here are the snippets that I use: Jenkinsfile: node { env.MYVAR = 'My variable' emailext body: ${JELLY_SCRIPT, template="myTemplate"}, subject: 'MySubject', to: 'me' } Jelly template (myTemplate): <?jelly escape-by-default='true'?> <!DOCTYPE