In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Description
Jenkins provides an email notification by default, which can send mail after build failure, build instability, and so on. But it has many limitations, such as its email notification can not provide detailed email content, unable to define the format of sending mail, unable to define flexible email receiving configuration, and so on. The Jenkins Email Extension Plugin plug-in allows you to customize email notifications, such as who you send email to, what content to send, and so on. Please refer to the previous blog post for plug-in installation.
1. Default Mail Notification Settings
In the system settings of Jenkins, find the Jenkins Location location first.
Jenkins URL: the login address of jenkins
System administrator email address: the sender of the message
You can fill in according to the situation. You can use a self-built mail delivery service or a third-party mail service, as long as you fill in the appropriate information. I use self-built mail delivery service.
Note: the e-mail address of the system administrator must be the same as the shipping address of SMTP, otherwise an error will be reported.
2. Mail extension Settings
It mainly consists of two parts: global configuration and project configuration.
2.1 Global configuration
Find the location of "Extended E-mail Notification" and you can configure some global email-ext properties.
Individual options for different plug-in versions are different. Based on the information, similar to the information of the default mail notification, this plug-in can completely replace the default mail notification.
Refer to a configuration on the Internet
Default Subject: build Notification: $PROJECT_NAME-Build # $BUILD_NUMBER-$BUILD_STATUS!
Default Content:
This email is sent automatically by the program, please do not reply!
Project name: $PROJECT_NAME
Build number: $BUILD_NUMBER
Svn version number: ${SVN_REVISION}
Build status: $BUILD_STATUS
Trigger reason: ${CAUSE}
Build log address: ${BUILD_URL} console
Build address: $BUILD_URL
Changeset: ${JELLY_SCRIPT,template= "html"}
A good template is attached.
Default Subject: build Notification: ${BUILD_STATUS}-${PROJECT_NAME}-Build # ${BUILD_NUMBER}! Default Content:$ {ENV, var= "JOB_NAME"}-the ${BUILD_NUMBER} build log (this email is automatically sent by the program, please do not reply!) Build result-${BUILD_STATUS} build Information Project name: ${PROJECT_NAME} build number: ${BUILD_NUMBER} Build SVN version: ${SVN_REVISION} trigger cause: ${CAUSE} build log: ${BUILD_URL} console build Url: ${BUILD_URL} working directory: ${PROJECT_URL} ws Project Url: ${PROJECT_URL} Changes Since Last Successful Build: historical change record: ${PROJECT_URL} changes ${CHANGES_SINCE_LAST_SUCCESS Reverse=true, format= "Changes for Build #% nvv% c", showPaths=true,changesFormat= "[% a]% m" PathFormat= "% p"} Failed Test Results $FAILED_TESTS build log (last 100 lines): ${BUILD_LOG, maxLines=100}
2.2.1 basic configuration of the project
When the plug-in is activated, you can edit the following fields (list only commonly used fields):
Project Recipient List: this is a list of email addresses of recipient messages separated by commas (or spaces). Allows you to specify a separate list for each message. Ps: if you want to add the recipient to the default recipient: $DEFAULT_RECIPIENTS
Default Subject: allows you to configure the subject of this project message.
Default Content: it does the same thing as Default Subject, but replaces the content of the message.
Attach Build Log: attachment build log.
Compress Build Log before sending: compress the generated log before sending (zip format).
2.2.1.1 Project Advanced configuration
To view the advanced configuration of the plug-in, click the Advanced button. This option allows you to specify recipients for various types of mail triggers. By default, there are no configured triggers, so messages are not sent by default. To add more triggers, select the type in the drop-down list next to "Add a Trigger" (as shown below). After adding the trigger, an option box will be added to configure who the mail can be sent to.
Send to Recipient List: if checked, the mail will be sent to all email addresses in "Project Recipient List".
Send to Committers: this email is sent to the person who checked the code during the last build, and the plug-in generates an email address based on the submitter's ID and the (default email suffix) default email suffix of the appended Jenkins configuration page. For example, if the person who submitted the code last time was "first.last" and the default e-mail suffix is "@ somewhere.com", the e-mail will be sent to "first.last@ somewhere.com".
Send To Requester: if checked, the email will be sent to the build trigger.
Include Culprits: if checked, and "Send To Committers" is checked, the email will contain the submitter of the last successful build.
More Configuration: you can make more individual settings for each mail trigger by clicking Advanced.
Recipient List: this is a list of acceptable email addresses separated by commas (or spaces). If triggered, send an email to the list. The list is appended to "Global Recipient List".
Subject: specifies the subject of the selected message. Note: the mail trigger type in the advanced options can override the configuration for it.
Content: specifies the content body of the selected message. Note: the mail trigger type in the advanced options can override the configuration for it.
Remove you can delete a trigger by clicking the "Delete" button that specifies the current row of the trigger.
2.2.1.2 trigger type
Note: all triggers can only be configured once.
Failure: send emails that fail to build immediately. If the "Still Failing" trigger is configured and the status of the last build was "Failure", the "Still Failing" trigger will send an email instead.
Unstable: instantly send emails that are not firmly built. If the "Still Unstable" trigger is configured and the status of the last build was "Unstable", the "Still Unstable" trigger will send an email instead.
Still Failing: if the status of two or more consecutive builds is "Failure", send this message.
Success: send mail if the status of the build is "Successful". If "Fixed" is configured and the status of the last build is "Failure" or "Unstable", the "Fixed" trigger will send an email instead.
Fixed: sends a message when the build status changes from "Failure" or "Unstable" to "Successful".
Still Unstable: if the status of two or more consecutive builds is "Unstable", send this message.
Before Build: send an email when the build begins.
2.2.1.3 Project mail variables
Note: only the missing variables on the global configuration page are explained here.
${DEFAULT_SUBJECT}: this is the message subject configured by default on the Jenkins system configuration page
${DEFAULT_CONTENT}: this is the mail content body configured by default on the Jenkins system configuration page
${PROJECT_DEFAULT_SUBJECT}: this is the default email subject for the project. The result of using this token in the advanced configuration takes precedence over the Default Subject field. Warning: do not use this token in Default Subject or Default Content, it will produce an unknown result.
${PROJECT_DEFAULT_CONTENT}: this is the default mail content body for the project. The result of using this token in the advanced configuration takes precedence over the Default Content field. Warning: do not use this token in Default Subject or Default Content, it will produce an unknown result.
Attach a screenshot of the email notification
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.