1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Jenkinsfile で 成功/エラーメールを送る方法

1
Posted at

Jenkinsfile で SUCCESS/ERROR メールを送る方法

def MAIL_FROM    = '送り元メアド'
def MAIL_TO      = '送り先メアド'
def MAIL_SUBJECT = 'タイトル'
def MAIL_BODY    = '本文'

node {

  try {

    ・・・処理・・・

  } catch (e) {

    stage 'error mail'
    mail from: "${MAIL_FROM}",
           to: "${MAIL_TO}",
      subject: "【失敗】 ${MAIL_SUBJECT}",
         body: "${MAIL_BODY}",
           cc: '',
          bcc: '',
      replyTo: ''

    throw e;

  }

  stage 'success mail'
  mail from: "${MAIL_FROM}",
         to: "${MAIL_TO}",
    subject: "【成功】 ${MAIL_SUBJECT}",
       body: "${MAIL_BODY}",
         cc: '',
        bcc: '',
    replyTo: ''

}
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?