当前位置:网站首页>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
边栏推荐
- STL -- function object
- How to use the official documents of pytorch and torchvision
- Atlas conflict Remote Code Execution Vulnerability (cve-2022-26134) vulnerability recurrence
- The R language uses the tabpct function of the epidisplay package to generate a two-dimensional contingency table, and uses the mosaic diagram to visualize the contingency table (two-dimensional conti
- latex表格 在线生成
- \Begin{algorithm} notes
- Sudo of uabntu
- 卖疯了的临期产品:超低价、大混战与新希望
- Quick start sweep crawler framework
- R语言使用plot函数可视化数据散点图,使用font.axis参数指定坐标轴刻度标签的字体类型为斜体字体(italic)
猜你喜欢

Fiddler抓包几种常用功能介绍(停止抓包、清空会话窗内容、过滤请求、解码、设置断点......)

idea如何设置导包不带*号

记录使用yolov5进行旋转目标的检测

性能优化之编译优化

快速入门scrapy爬虫框架

Idea displays services on the console to uniformly manage all jetty services,

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

Nebula's practice of intelligent risk control in akulaku: training and deployment of graph model

ShardingJDBC 分库分表详解

redis.clients.jedis.exceptions.JedisDataException: NOAUTH Authentication required
随机推荐
(六)控制语句if/else switch
The R language uses the tabpct function of the epidisplay package to generate a two-dimensional contingency table, and uses the mosaic diagram to visualize the contingency table (two-dimensional conti
(八)goto关键字
Google browser debugging skills
Différence entre le mode grand et le mode petit
借助SpotBugs将程序错误扼杀在摇篮中
The R language uses the pyramid function of epidisplay package to visualize the pyramid graph and the pyramid graph based on the existing summary data (table data)
从50亿图文中提取中文跨模态新基准Zero,奇虎360全新预训练框架超越多项SOTA
大端模式和小端模式的區別
ShardingJDBC 分库分表详解
博士申请 | 新加坡国立大学Xinchao Wang老师招收图神经网络方向博士/博后
Swin Transformer代码讲解
男神女神投票源码 v5.5.21 投票源码
Idea displays services on the console to uniformly manage all jetty services,
力扣今日题926. 将字符串翻转到单调递增
Recommend 6 open source projects of yyds
反馈式编译
使用ubantu时,遇见的一些小毛病和解决方法
\Begin{algorithm} notes
C#期末复习编程题(老师猜的)










