当前位置:网站首页>Gerrit+2 triggers Jenkins task
Gerrit+2 triggers Jenkins task
2022-06-12 17:06:00 【@TangXin】
List of articles
1.Linux Create secret key
cd /var/lib/jenkins
without .ssh Catalog , Manual creation required
mkdir .ssh
Create secret key
ssh-keygen -m PEM -t rsa -C “[email protected]” -f /var/lib/jenkins/.ssh/id-rsa
Modify the permissions
chmod -R 777 .ssh
2.Gerrit Create user
Gerrit establish zhangsan user
[[email protected] /]# htpasswd -m /gerrit.password zhangsan
Use zhangsan user Sign in Gerrit Set up SSH Keys
The contents to be filled in are /var/lib/jenkins/.ssh/id-rsa.pub What's in it
HTTP Credentials,CREATE NEW PASSWORD, The secret key here is very useful , Keep in mind
SL1rsmf6WIcvnYqEgHhajS2cZL+IqrLLEJQ8OA2dJg
Authorized user zhangsan Yes test1 The project has permission
3.Jenkins To configure Gerrit Trigger
Gerrit Trigger – Add New Server –



4.Jenkins Create a project test_gerrit_sonarqube
4.1 General
Discard old builds
Strategy :Log Rotation
Days to keep building :180 # This item can be configured freely , No coercion
Keep the maximum number of builds :180 # This item can be configured freely , No coercion
4.2 Source code management
Multiple SCMs
Git
Repositories
Repository URL: Fill in user zhangsan Corresponding HTTP Connection address :http://[email protected]:8080/a/test1
Credentials: Fill in zhangsan User and corresponding HTTP Secret key SL1rsmf6WIcvnYqEgHhajS2cZL+IqrLLEJQ8OA2dJg Create credentials for
Refspec: Fill inrefs/changes/*:refs/changes/*
Branches to build
Specify Branch ( If it is empty, it means any): Fill in $GERRIT_REFSPEC
Source code library browser :( Automatically )
Additional Behaviours
Strategy for choosing what to build
Choosing strategy: Fill in Gerrit Trigger
Check out to subdirectories
Local subdirectories of the warehouse : Fill in ${WORKSPACE}/test , Namely Gerrit Code in the repository clone To the local storage path , If this is a fixed value , The code pulls the latest code every time , If it's a variable , Then the complete project code will be pulled every time the code is pulled , therefore , It is suggested that this is a fixed value , This will only pull new code each time
Advanced cloning behavior
Choose Fetch tags
Timeout for clone and pull operations ( minute ): Fill in 60 , If the amount of project code is too large , Need to fill in , otherwise jenkins When the task is executed , Pull code timeout
4.3 Build trigger
Gerrit event
Gerrit Trigger
Choose a Server: Fill in Jenkins Set up Gerrit Trigger name :Gerrit-2
Trigger on: This option is Gerrit Trigger Jenkins The conditions of the task
Comment Added Verdict Category:Code Review
Value:2 Meaning is Gerrit +2 when , Trigger Jenkins Task execution , whenever +2 Execute once when , Other methods are not implemented
Dynamic Trigger Configuration
Gerrit Project
Type: Plain # Choose
Pattern: test1 # Fill in the project name
Branches
Type:Path # If Pattern Select all branches **, Then... Must be selected here Path, Otherwise, it cannot be triggered Jenkins Task execution
Pattern:** # Indicates that all branches of the item are selected
4.4 Constructing environment
No modification
4.5 structure
ls -l ${WORKSPACE}/test

4.6 Post-build operation
No modification
5. Project submission code
5.1 commit

5.2 push

5.3 Gerrit


There is no trigger at this time Jenkins Task execution , When in Gerrit Middle alignment code +2 operation
Jenkins The mission will be carried out , You can click on the g34, Jump to Gerrit Submitted code display page
When Jenkins After task execution ,Gerrit You can see the prompt message
6. follow-up
The above steps are completed Jenkins and Gerrit The connection between the two tools .
If you want to do it later SonarQube scanning 、 Unit tests, etc , You can set it in the build or post build steps
边栏推荐
猜你喜欢

Installation and use of rolabelimg

多种Qt的开发方式,你选择哪种?

MySQL transaction introduction and transaction isolation level

redis.clients.jedis.exceptions.JedisDataException: NOAUTH Authentication required
![[MySQL] internal connection, external connection and self connection (detailed explanation)](/img/3f/9b88c2f27455f2ddd73808fbb44f8e.jpg)
[MySQL] internal connection, external connection and self connection (detailed explanation)

CVPR 2022 | meta learning performance in image regression task

Uniapp壁纸小程序源码/双端微信抖音小程序源码

图片在线收款发货系统源码

Preprocessing command section 3

Su directly switches to super administrator mode, so that many error reports can be avoided
随机推荐
1723. 完成所有工作的最短时间
PAT甲级 1142 最大团
修改自己电脑连接的路由器的配置网址192.168.1.1
Cloud development kunkun chicken music box wechat applet source code
How to play the map with key as assertion
博士申請 | 新加坡國立大學Xinchao Wang老師招收圖神經網絡方向博士/博後
Idea how to set the guide package without * sign
Recommend 6 open source projects of yyds
Pat class a 1142 largest regiment
Sudo of uabntu
Google浏览器调试技巧
Basic knowledge of stock introduction: is fixed increase good or bad?
CVPR 2022 | meta learning performance in image regression task
R语言使用ggplot2可视化dataframe数据中特定数据列的密度图(曲线)、并使用xlim参数指定X轴的范围
Analysis of CA certificate with high value
(四)Golang运算符
(七)循环语句for
Unit sshd. service could not be found
Microsoft Office MSDT Code Execution Vulnerability (cve-2022-30190) vulnerability recurrence
pytorch和torchvision官方文档使用方法










