gitlab-plugin icon indicating copy to clipboard operation
gitlab-plugin copied to clipboard

add merge_commit_sha to Cause

Open evgeni opened this issue 8 years ago • 6 comments

Issue

Context

  • Gitlab plugin version: 1.4.6
  • Gitlab version: 9.3.10
  • Jenkins version: 1.6.x
  • Job type: Pipeline

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.

evgeni avatar Oct 24 '17 13:10 evgeni

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

omehegan avatar Jan 16 '18 07:01 omehegan

@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).

evgeni avatar Jan 16 '18 08:01 evgeni

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

omehegan avatar Jan 16 '18 23:01 omehegan

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.

xingyuzhe avatar Nov 02 '18 08:11 xingyuzhe

@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.

ricka avatar May 05 '20 15:05 ricka

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.

rufik avatar Feb 02 '21 20:02 rufik