Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Send mail after Jenkins is built

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Let's first install the Jenkins mail extension "Email Extension Plugin".

How to install Jenkins and plug-ins can be found in the previous article: http://qicheng0211.blog.51cto.com/3958621/1918912

I. system configuration

1. Enter Manage Jenkins- > Configure System, and find the configuration segment "Jenkins Location":

The access address of Jenkins URL:jenkins, based on which jenkins displays pictures in the email or creates a hyperlink.

System Admin e-mail address: the email address of the system administrator, that is, the sender of the header.

2. Find the "Extended E-mail Notification" configuration segment:

The SMTP server:SMTP server, such as the SMTP server of Tencent enterprise mailbox, is smtp.exmail.qq.com.

Default Content Type: email content format, optional Plain text and HTML.

Default Recipients: default recipient list, separated by commas. CC or BCC A recipient can precede his or her mailbox with cc: or bcc:.

Default Subject: the default message title.

Default Content: the default message content.

Enable Debug Mode: turn on the plug-in's Debug mode and we'll see more information in the log.

Other configurations can be kept by default.

3. Click "Advanced" to configure SMTP authentication:

User Name:SMTP authenticated user name

Password:SMTP authentication password

Use SSL: some mail servers require SSL to be enabled

SMTP port: default port 25. The SSL port is generally 465.

Charset: character set

Finally, click save to save the configuration.

II. Project configuration

Next, let's enter the project configuration and send an email to the project staff after the build is completed.

1. In the "Post-build Actions" configuration section of the project, click "Add post-build action" and select "Editable Email Notification" in the list.

Configurable options include recipient, email title, email content, etc., which are all configured in the system configuration and can be inherited from the default configuration. Of course, you can also personalize each project.

The "Attach Build Log" option does not send build logs by default, and we can also choose to send build logs or compress them.

2. Open the advanced setting "Advanced Settings" and add Triggers as follows:

"Always" means to send an email after each build, regardless of whether the build is successful or not.

We can also choose other trigger methods, to give a few examples:

Before Build: sent before building

Failure-Any: sent when a build fails

Failure-1st: sent when the build changes from success to failure (the previous build was successful, but this one failed)

Success: sent when the build is successful

Then select the recipient corresponding to Trigger:

Recipient List: default recipient list for the project

Requestor: the initiator of this build (mailbox needs to be configured for users; tested for manual build only)

Finally, save the project configuration.

3. Let's test it next. Make a build of the project and view the mail delivery section of the build log:

The log shows that it was sent successfully, then check the email, and the build log is also sent:

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report