Jenkins Webhooks
General Information
Setting up webhooks which trigger a Jenkins job upon commit to a repo.
Checklist
- Jenkins server setup
- GitLab repo available (GitHub may be similar)
Jobs with Webhooks
Creating a Jenkins job that is triggered upon push to a gitlab project.
- Create Jenkins job
- Under “Build Triggers”
- Check: 'Build when a change is pushed to GitLab. GitLab webhook URL:….'
- Click 'Advanced'
- Under Secret token, click 'Generate'
- Configure GitLab project settings
- Settings > Integrations
- Copy/paste webhook url from Jenkins job into URL field
- Copy/paste secret token from Jenkins job into Secret Token field
- Check the Triggers that you want to send a notification to Jenkins about
- Optionally, uncheck 'Enable SSL Verification'
- Click “Add webhook”
- Configure GitLab project members
- Go to Settings > Members
- Ensure that the user configured to clone the project in the Jenkins job has “Developer” permissions to the project.
- This will ensure that the job can write back job status to the gitlab commit (job running, success, failed, etc)