jenkinsci / gitlab-plugin

A Jenkins plugin for interfacing with GitLab
https://plugins.jenkins.io/gitlab-plugin/
GNU General Public License v2.0
1.43k stars 613 forks source link

add merge_commit_sha to Cause #645

Open evgeni opened 6 years ago

evgeni commented 6 years ago

Issue

Context

Logs & Traces

None

Problem description

When merging an MR, GitLab sends the merge_commit_sha as part of the WebHook:

{
  "object_kind": "merge_request",
  …
  "object_attributes": {
    …
    "merge_commit_sha": "eaafb2a11e5cbd08ba46dee9540275136c86e590",
  },
  …
}

It would be awesome if that would be available as part of the injected environment variables.

omehegan commented 6 years ago

@evgeni is merge_commit_sha not equivalent to the gitlabAfter env var?

evgeni commented 6 years ago

@omehegan nope. As far as I can see, gitlabAfter comes from the after keyword in the push/tag_push hook, but not in the merge_request hook. So while I think the hash would be the same, it is part of a different webhook (and in our setup we only look at merge_request and note hooks).

omehegan commented 6 years ago

@evgeni ok, noted. I will look at adding this, it should be possible.

xingyuzhe commented 5 years ago

One year passed, this 'merge_commit_sha' is still not available in the environment variables. It's very impotant because it's the base key to tell the differences in a merge.

ricka commented 4 years ago

@omehegan Any update here? We could also use this as our flow currently only looks at Merge Requests. We could make the flow include pushes, but that requires extra filtering and logic, whereas this would just be nice and simple.

rufik commented 3 years ago

ok, noted. I will look at adding this, it should be possible.

@omehegan I need this feature so I'd like to implement it - could you briefly point me places where should I do it, please? It would be very helpful.