当前位置:网站首页>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
边栏推荐
猜你喜欢

初识GO语言

ShardingJDBC 分库分表详解

D. master router setting and 401 networking

Unit sshd. service could not be found

Dongfeng Yueda Kia, Tencent advertising and hero League mobile game professional league cooperate to build a new E-sports ecology

Download PHP source code of leaf sharing station

Gerrit+2触发Jenkins任务

selenium元素定位

Modify the configuration of the router connected to your computer. The website is 192.168.1.1

Some minor problems and solutions encountered when using ubantu
随机推荐
Difference between big end mode and small end mode
MySQL事务简介、事务隔离级别
Swin Transformer代码讲解
博士申请 | 新加坡国立大学Xinchao Wang老师招收图神经网络方向博士/博后
修改自己电脑连接的路由器的配置网址192.168.1.1
890. find and replace mode / Sword finger offer II 080 Combination with k elements
JVM memory model and local memory
添加静态路由
selenium元素定位
5、Embedding
Su directly switches to super administrator mode, so that many error reports can be avoided
The R language uses the tablestack function of epidisplay package to generate statistical analysis tables based on grouped variables (including descriptive statistical analysis, hypothesis test, diffe
启牛开的证券账户安全吗?合法吗?
The safety of link 01 was questioned, and "ultra high strength" became "high strength"_ Publicity_ Steel_ problem
Uniapp壁纸小程序源码/双端微信抖音小程序源码
\Begin{algorithm} notes
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
反馈式编译
Download PHP source code of leaf sharing station
Selenium element positioning









