This article mainly introduces Jenkins email notifications,
- Jenkins built-in email Function
- Use the mail function extended by plug-ins
1. first introduce the basic Jenkins Mail Server Configuration1) system config page (take the public 163 email server as an example ):
You can check "Send test mail configuration" to test whether the configuration can be connected. If you receive the following email, congratulations.
This is test email #1 sent from Jenkins
2) Next, add the mail sending steps for the created job,
In this way, after each build, an email will be sent to the recipient. Here, you will find that only fixed objects can be sent, and the format is single (txt)
==== OK, now enter the topic ====
2. Use the plug-in "email extersion plugin" for extension
It sends a build Report to the current committer Based on the build results (using git for code management)
1) this plug-in supports Jenkins 1.5 and later versions, at least 1.486 of which is not supported by me. So please upgrade it ..
Plug-in installation is omitted here. If the page card list of your optional plug-ins is empty, go to the Advanced page to check for updates.
2) The plug-in is used on the job configuration page. After the build is added, the "editable email notification" step is displayed"
The above configuration provides the default receiving list for this project. Of course, if you copy the project, you can directly write CC: [email protected]
For the content, you may have noticed that a 'html. jel' template is called here, which is built-in to the plug-in and can be used directly. (Supports record of each git change, compiled results reports such as MVN and JUnit)
Of course, you can also write your own jelly file to make sure that Jenkins/home/email-template is placed for Jenkins to call.
3) at this point, you may ask if this is still a fixed receiving list (⊙ _ ⊙). Do not worry about seeing the advanced options in the lower right corner. Continue to configure the settings,
I set the build success and failure to send to the default receiver and the guy who is currently submitting code, and send to requester is the user who is currently logged on to Jenkins when the build is manually triggered.
PS:
1. If someone does not set the global name and email when git commit is performed, it will not be sent to the correct email address (Jenkins will send the domain name to the wrong email address based on the machine name)
2. Of course, you can also set individual mailboxes in the Jenkins management user. However, if there are many teams, you will suffer. Therefore, it is necessary to set the real name before submission.