---
# System prepended metadata

title: GitLab using Webhook to triggered Jenkins build project
tags: [Lab]

---

GitLab using Webhook to triggered Jenkins build project
===

## Create Folder
1. [New Item]
2. Enter an item name
3. Choice [Folder]
4. Press [OK]
5. Select folder on Jenkins view
<kbd>![](https://i.imgur.com/2TQujsT.png)</kbd>


## Create Project
1. [New Item].
2. Enter an item name.
3. Choose [Build Free-Style Project].
4. Press [OK].
5. Select project on Jenkins view.
<kbd>![](https://i.imgur.com/ljrQi81.png)</kbd>

## Configure Project - Jenkins
1. Click [Configure].
<kbd>![](https://i.imgur.com/rFQZ6dr.png)</kbd>
2. ~~Checked [Restrict where this project can be run] and fill in the `appiumACE` string to [Label Expression]~~
3. Select [Git] options as a repository source and enter repository url, finally select credential that log in to the SELab GitLab Server, if not exists, Add it.(The URL must be end with .git).
4. If necessary, specify the branch in [Branch Specifier (blank for 'any')], what you want build.
5. Checked [Build when a change is pushed to GitLab.....]
6. (Option)Choose Post-build action.
7. Apply and saved it.
<kbd>![](https://i.imgur.com/B9GZy3l.png)</kbd>

## Configure Project - GitLab
1. Go to [Webhooks] page.
<kbd>![](https://i.imgur.com/bIX9ENE.png)</kbd>
2. Paste url from Jenkins project.
:::danger
URL some segments must be replaced, take below project url as example：
Before：https://service.selab.ml/ci/job/SE-MOB1/job/backend/
After：https://service.selab.ml/ci/project/SE-MOB1/backend/
<kbd>![](https://i.imgur.com/0e7Kxnd.png)</kbd>
:::
3. Follow the configuration below
<kbd>![](https://i.imgur.com/QCyFPbq.png)</kbd>
4. Click [Test] -> [Push events] to checking the webhooks has already triggered the Jenkins project.
<kbd>![](https://i.imgur.com/lhfx5lN.png)</kbd>
5. Success.
<kbd>![](https://i.imgur.com/SBISK7K.png)</kbd>
