Jenkins, a 1400-word article teaches you to build automation tasks step by step [nanny-level tutorial]

Foreword:

Jenkins is an open source software project. It is a continuous integration tool developed based on Java. It is used to monitor continuous repetitive work. It aims to provide an open and easy-to-use software platform to make continuous software integration possible.


1. Environment configuration

1. Switch to the directory where jenkins.jar is stored, enter the following command:
java -jar jenkins.war --httpPort=8081
Then enter localhost:8080 in the browser, localhost can be the ip of the machine or the computer name. You can open jenkins.

2. Open with tomcat.
Unzip tomcat to a certain directory, such as /usr/local, enter the /bin directory under tomcat, start tomcat and
put the jenkins.war file in the webapps directory under tomcat. When you start tomcat, it will automatically log in webapps Create a jenkins directory in the directory, and enter localhost:8080/jenkins in the address bar.


2. New task

After logging in to Jenkins, in the function list of the left view, click New Task:

Enter the creation page, enter the task name, select [Build a free-style software project], and click the OK button.


 3. Project configuration

1. In the General section, you can configure [Discard old builds], which can also be ignored. This time, the number of days to keep builds is 7 days, and the maximum number of builds to keep is 20.

2. Select [Git] for source code management. After adding the Repository URL at this time, an error will be reported below, showing that the authentication is allowed, and the authentication can be done (this problem is encountered in other installations). If the authentication fails, please download the authentication Github Authentication plugin Plugins, this one searches and installs in the optional plugins in the plugin management.

3. To build the trigger, select Build periodically, that is, to configure the timing execution of the project. This time it is set to [H/15 * * * *], which means it will be executed every 15 minutes. The current execution time and the next execution time will be displayed below the input box.

The format of the cron task here follows the syntax of cron (it can be slightly different from the syntax of cron). Specific format, each line contains five fields, separated by Tab or space.

To specify multiple values ​​for a field, you can use the following operators, in order.
Specify all values
​​MN specifies a range of values
​​MN/X or */X Steps at intervals of X within the specified range or the entire valid range
A,B,...,Z enumerates multiple values

4. Build, choose to add the build step [Execute shell], and enter the shell statement to be executed.

5. After construction, select [E-mail Notification] to configure the recipient's mailbox.


4. Build Now

After the project is successfully created, go to the project details page and click Build Now. The build history can be seen in the Build History list.


5. Mail configuration

Go to System Management - System Settings - Email Notifications section

1. If you set up QQ mailbox, the password must be an authorization code. The method is: log in to QQ mailbox, open "POP3/SMTP" in "Account" and obtain the authorization code. (Otherwise, an error of 535 will be reported)
2. [Use SMTP authentication] must be checked
. 3. The user name must be the same as the system administrator's email address. (Otherwise, an error of 501 will be reported)
4. Set the recipients (Recipients). Separate multiple recipients with English spaces.
5. Check [Test configuration by sending a test email] to verify the mailbox configuration.


The above~ Finally, I would like to thank everyone who read my article seriously. Watching the rise and attention of fans all the way, there is always a need for gift exchanges. Although it is not a very valuable thing, if you can use it, you can take it directly.

These materials should be the most comprehensive and complete preparation warehouse for friends who do [software testing]. This warehouse has also accompanied me through the most difficult journey. I hope it can also help you! Everything should be done as early as possible, especially in the technology industry, and the technical foundation must be improved. I hope to be helpful…….

Guess you like

Origin blog.csdn.net/jiangjunsss/article/details/124213727