0

I am trying to configure Jenkins integration in GitLab, as it is recommended in favor of webhooks.

On the input form ([Gitlab project url]/-/integrations/jenkins/edit), I can check: Merge request, which has this note:

Trigger event when a merge request is created, updated, or merged.

I would like to distinguish between merge requests being created or updated on one hand and being merged on the other hand. Only when they are being merged, I want Jenkins to perform a deployment.

Can I detect in Jenkins what type of merge request event triggered the pipeline?

R. Schreurs
  • 8,587
  • 5
  • 43
  • 62

1 Answers1

0

You should be able to figure this out with the variables the Gitlab plugin exposes after the Webhook request. Here is the list of variables available.

gitlabBranch
gitlabSourceBranch
gitlabActionType
gitlabUserName
gitlabUserUsername
gitlabUserEmail
gitlabSourceRepoHomepage
gitlabSourceRepoName
gitlabSourceNamespace
gitlabSourceRepoURL
gitlabSourceRepoSshUrl
gitlabSourceRepoHttpUrl
gitlabMergeRequestTitle
gitlabMergeRequestDescription
gitlabMergeRequestId
gitlabMergeRequestIid
gitlabMergeRequestState
gitlabMergedByUser
gitlabMergeRequestAssignee
gitlabMergeRequestLastCommit
gitlabMergeRequestTargetProjectId
gitlabTargetBranch
gitlabTargetRepoName
gitlabTargetNamespace
gitlabTargetRepoSshUrl
gitlabTargetRepoHttpUrl
gitlabBefore
gitlabAfter
gitlabTriggerPhrase
ycr
  • 12,828
  • 2
  • 25
  • 45