当前位置:网站首页>How does continuous integration manage Jenkins?
How does continuous integration manage Jenkins?
2022-07-19 07:43:00 【God is the Tao, the Dharma, the natural Tathagata】
One 、 Installing a plug-in
Jenkins Left menu bar —> “Manage Jenkins” —> choice “Manage Plugins” —> “ Optional plug-ins ” —> The plug-in name
Such as :“HTML Publisher”

Two 、 preparation
take The operation is correct , Project code that can generate report Uploaded to the Gitee in .
3、 ... and 、 Use Jenkins management - Build... Manually
1. open Jenkins home page , Click on “ newly build Item” Create a new task .
2. Enter the task name , Such as : LoginAutoTest. choice “Freestyle project”, spot “ determine ”, Jump to “ To configure ” page .

3. “ Source code management ” label . choice “Git”. stay Repository URL Write after The project code is in Gitee Of URL.

4. “ structure ” label .
4. 1. Click on “ Add build steps ”, choice “Execute Windows batch command” Options (macOS choice “Execute shell”
)

4. 2. Enter the command python run_suite.py ( And in pycharm Of Terminal In the implementation of , Same meaning )

5. “ Post-build operation ” label
5.1. Click on “ Add post build steps ”, Click on “Pulish HTML reports” , Click on “ newly added ” Button .


5.2. stay “HTML directory to archive” in write in Where the report is generated . Such as :./report ( Consistent with the project directory )
5.3. Index page[s] After the value of , And run_suite.py In the code , The names of the generated test reports are consistent . Such as :login.html.

6. Click again on the “ Add post build steps ”, choice “Editable Email Notifification” Set up Email test report .

6.1. stay “Project Recipient List” ,$DEFAULT_RECIPIENTS After use english “,” Partition , Add email address .

6.2. below “Content-Type” Value , choice HTML(text/html)
6.3. Copying “ Email test report template ” Code to “Default Content ” in
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>${ENV, var="JOB_NAME"}- The first ${BUILD_NUMBER} Secondary build log </title> </head> <body leftmargin="8" marginwidth="0" topmargin="8" marginheight="4" offset="0"> <div> <h2> Project information </h2> <ul> <li> Project name :${PROJECT_NAME}</li> <li> Log in to the detailed test report :<a href="${PROJECT_URL}HTML_Report/">${PROJECT_URL}HTML_Report/</a></li> <li> trigger :${CAUSE}</li> <li> project Url:<a href="${PROJECT_URL}">${PROJECT_URL}</a></li> </ul> <hr/> <h2> The build log </h2> <div>${JELLY_SCRIPT,template="html"}</div> <hr/> </div> </body> </html>7. Click on the bottom right corner “Advanced Settings” Button . take “Trigger” Original content spot Outermost layer “ Red fork ” Delete .

Click on “Add Trigger” choice Always .

8. Click on “ application ” --> “ preservation ”.
9. Click on “Build Now” Start building manually .


Four 、 Use Jenkins management - An automated build
1. Click on “ To configure ” see , stay “ Build trigger ” label . choice “Build periodically( Regularly )” add to Time to build !

2. “ calendar ” writes :* * * * *( Space separation ) —> They correspond to each other “ branch when Japan month year ”
modify :H 16 * * * Namely Daily 16 spot perform .
3. It can also be in “ Build trigger ” label Choose from “Poll SCM”. write in :*/1 * * * * ( Space separation )

representative 1 minute check gitee The code on , Check whether there are updates .
4. PyCharm Modify the code Commit、Push, perhaps Directly in Gitee modify , Lead to Gitee The code on has change . Will trigger Jenkins
It will build automatically .
Expand ( Build... On a regular basis , calendar )
This field follows cron The grammar of ( There are nuances ). say concretely , Each line is made up of 5 Fields make up , from TAB Or separated by spaces :
MINUTE HOUR DOM MONTH DOW
| minute | Minutes in an hour (0–59) |
| Hours | Hours of the day (0–23) |
| DOM | One day in the month (1–31) |
| month | month (1–12) |
| dow | What day (0–7), among 0 and 7 It's Sunday . |
To specify multiple values for a field , You can use the following operators . In order of priority ,
*Specify all valid valuesM-NSpecify the range of valuesM-N/Xor*/XPress to specify the whole valid range X Interval step ofA,B,...,ZEnumerate multiple values
In order to allow regularly scheduled tasks to produce a uniform load on the system ,H Symbols... Should be used wherever possible ( be used for “ Hash ”). for example , Use 0 0 * * * A dozen daily tasks will lead to a big peak at midnight . by comparison ,usingH H * * * Each job will still be executed once a day , But not at the same time , Better use of limited resources .
The H Symbols can be used with ranges . for example ,H H(0-7) * * * Express 12:00 AM( The middle of the night ) To 7:59 AM Some time between . You can also use the belt H、 Step interval with or without range .
The H Symbols can be considered as random values in a range , But it is actually a hash of the job name , Not random functions , Therefore, this value remains stable for any given project .
Please note that , For the month field , Due to the different length of months , Short period ( for example */3 or H/3 It will not be consistent at the end of most months ) Work . for example ,*/3 It will be on the day of the month 1、4、...31 Day run , Then run again on the second day of next month . The hash value is always 1-28 Range selection , therefore H/3 There will be 3 To 6 Days apart .( Longer cycles also have inconsistent lengths , But the effect may be relatively less obvious .)
Empty line and with At the beginning # Lines are ignored as comments .
Besides , And support @yearly、@annually、@monthly、 @weekly、@daily、@midnight and @hourly As a convenient alias . These are automatically balanced using a hash system . for example ,@hourly And H * * * * And it may mean the same at any time in an hour . @midnight In fact, it means 12:00 AM To 2:59 AM Some time between .
Example :
# Every fifteen minutes ( May be in :07, :22, :37, :52): H/15 * * * * # Every ten minutes in the first half of every hour (3 Time , May be in :04, :14, :24): H(0-29)/10 * * * * # Every two hours , Every two hours , From the morning 9 spot 45 Point start , Every weekday afternoon 3 spot 45 End of minute , Every hour 45 minute : 45 9-16/2 * * 1-5 # Every weekday in the morning 8 Point to the afternoon 4 Every two hours between points ( Maybe in the morning 9:38、 In the morning 11:38、 Afternoon 1:38、 Afternoon 3:38): HH(8-15)/2 * * 1-5 # except 12 Out of the month , monthly 1 Day and 15 Once a day : HH 1,15 1-11 *
Time zone specification
Periodic tasks usually occur in Jenkins Lord JVM Time zone ( At present for Asia/Shanghai) At the scheduled time . You can choose to change this behavior by specifying an alternate time zone in the first line of the field . The time zone specification is in start TZ=, Followed by time zone ID.
A complete example of a plan with a time zone specification :
TZ= The European / London
# This job needs to be run in the morning of London time
high 8 * * *
# The housekeeper doesn't have five o'clock , So we run the work again
H(0-30) 17 * * *边栏推荐
- 用for循环怎么输出数字菱形啊
- 实操教程:CANoe在CAN总线测试中的应用
- 组件emit基础
- Environment variables and folder placement location
- 2021-10-25 browser compatibility problems
- Xiaodi network security note information collection CDN bypass technology (7)
- Understanding of v2x test series v2x phase II application scenario
- TSN security protocol (802.1qci)
- Redis 详解
- 网络知识-04 网络层-ICMP协议
猜你喜欢

小怿和你聊聊V2X测试系列之 如何实现C-V2X HIL测试(2022版)

Sword finger offer question brushing record - offer 07 Rebuild binary tree

web安全(xss及csrf)

网络知识-04 网络层-IPv6

Xiaodi network security note information collection CDN bypass technology (7)

Introduction to 3D Visualization: see how rendering pipelines work in GPU

Review of 4246 Algorithms for Data Science

Review of 4246 Algorithms for Data Science

解决Mysql (1064) 错误: 1064 - You have an error in your SQL syntax;

Coursera deep learning notes
随机推荐
Hypothesis testing
Spark3.x入门到精通-阶段六(RDD高级算子详解&图解&shuffle调优)
Download, configuration and basic use of C language compiler
What is the difference between SD NAND and nandflash?
Use Altium designer software to draw a design based on stm32
AB Testing Review
I heard that today's blog can get a badge!
Spark3.x入门到精通-阶段三(深度剖析spark处理数据全流程)
网络知识-04 网络层-ICMP协议
Solve MySQL (1064) error: 1064 - you have an error in your SQL syntax;
Where is the future of HMI conceptual design?
Solution to the conflict between security automatic login and anti CSRF attack
Product Case Interviews
RNN卷积神经网络
Component emit Foundation
TSN security protocol (802.1qci)
Promote trust in the digital world
Install SQL developer for Galaxy Kirin desktop operating system v10sp1 (x86)
实时数据仓库-从0到1实时数据仓库设计&实现(SparkStreaming3.x)
MySQL decompression installation steps (Windows)