- Trigger Jenkins build after push to repository
- Show build status on Merge Request page
- Jenkins GitLab Hook plugin
- Git clone access for Jenkins from GitLab repository (via SSH key)
- Install GitLab Hook plugin
- Set up Jenkins project
In GitLab, perform the following steps.
Jenkins needs read access to the GitLab repository. We already specified a private key to use in Jenkins, now we must add a public one to the GitLab project. For that case we need a Deploy key. Read the documentation on how to set up a Deploy key.
Now navigate to GitLab services page and activate Jenkins
Done! When you push to GitLab, it creates a build for Jenkins. You can view the merge request build status with a link to the Jenkins build.
The GitLab Hook plugin in Jenkins supports the automatic creation of a project for each feature branch. After configuration GitLab triggers feature branch builds and a corresponding project is created in Jenkins.
Configure the GitLab Hook plugin in Jenkins. Go to ‘Manage Jenkins’ and then ‘Configure System’. Find the ‘GitLab Web Hook’ section and configure as shown below.