0
votes

So heres the thing ,

We have two webhooks setup on the same repository in Gitlab ,

Webhooks number 1 is set to url : http://jenkins.local/project/job1 (build job from master branch ) Webhooks number 2 is set to url : http://jenkins.local/project/job2 (builds job from branch "1" )

The issue we're trying to overcome is , whenever there is a mergre request being opened Both of those web hooks are being triggered .

Is there a way to "configure" the webhooks to fire only when a merge reuqest is being made into the master / 1 branch ,

i haven't found such settings in settings -> integrations

Webhook settings info

1

1 Answers

0
votes

Currently, the option to restrict webhooks per branch is only available for Push events; for Merge requests events; there isn't a way to restrict/filter.

You have to filter it in your Jenkins job (which job to get fired; if that's also you looking for) as an example of GitLab plugin like this -

Job1:-

triggers {
        gitlabPush {
            buildOnMergeRequestEvents(true)
            targetBranchRegex('master')
        }
    }

Job2:-

triggers {
        gitlabPush {
            buildOnMergeRequestEvents(true)
            targetBranchRegex('branch1')
        }
    }