Can a GitLab Webhook be stopped from triggering build in Jenkins

1.1k views Asked by At

I have a GitLab project with a WebHook which triggers a Jenkins job. As of now, I have enabled Push Events to trigger the Jenkins job. So, whenever I push code from my local computer to remote repository, the Jenkins job is automatically triggered and the job successfully builds my codebase by checking out the code from GitLab's master branch.

Is there an option using which I can have the Webhook trigger Jenkins build only on such push events whose commit message contains a specified string like "build jenkins"?

I assume the answer to above to be No as the Webhook has already been configured and can't be stopped. However, I read slightly about creating custom hooks on the remote repository which can help me in above. If that is true, how can I do that and where do I need to write the custom hook and how to use it?

Thanks

1

There are 1 answers

0
ben5556 On BEST ANSWER

Recommend using Generic Webhook Trigger Plugin - https://wiki.jenkins.io/display/JENKINS/Generic+Webhook+Trigger+Plugin