Table of contents
3. Configure triggers for tasks
4. Go to gitlab to set up webhooks
4.2 Go to the source code library of the jenkins corresponding project
4.3.1 Click test -- tag push event
1. Install the plug-in
The first step of continuous deployment needs to check whether the gitlab plug-in is installed: gitlab hook
plug-in and gitlab
plug-in (I am jenkins version 2.397, it seems that only this plug-in is installed)
2. Build tasks
3. Configure triggers for tasks
Set the token, there is such a regular configuration on the Internet, I did not use it, I directly use the second by name main
Allowed branches :
Allow all branches to trigger this job #允许所有分支触发此作业
Filter branches by name #按名称过滤分支
Include :dev #允许触发构建的分支,dev 分支提交会自动构建
Exclude:master #排除触发构建的分支,此时 master 分支提交不会自动构建
Filter branches by regex #通过正则表达式过滤分支
Source Branch Regex: #源分支正则表达式
Target Branch Regex:.*dev #目标分支正则表达式,允许触发构建的 dev 分支
Filter merge request by label #按标签过滤合并请求
Include: #允许触发构建的标签
Exclude: #排除触发自动构建的标签
4. Go to gitlab to set up webhooks
4.1 Setting up the network
This step on the pit, if your gitlab is 10.6+ version first operate this, if the lower version, skip here
报错:Url is blocked: Requests to the local network are not allowed
reason:
Gitlab version 10.6 and later, for security reasons, do not allow sending webhook requests to the local network by default
Solution:
1. to management
2. Settings - Network
3、勾选Allow requests to the local network from webhooks and integrations
English version:
4.2 Go to the source code library of the jenkins corresponding project
4.3 Testing
If the above addition is successful, it will be displayed below
4.3.1 Click test -- tag push event
Go to jenkins to see that the corresponding project is automatically triggered
4.3.2 Click to edit
See also view information