Natalie Perret
Natalie Perret

Reputation: 8997

How to get the merge request information in a gitlab-ci pipeline?

I recently got to know Dockup and while I really love this kind of integration in Github, I am wondering if the same thing can be achieved in Gitlab, for free.

Basically, what I would like to achieve is:

It seems that since Gitlab 11.6 it is possible to have Pipelines for merge requests but I don't really see how to get the information of the merge request or even who has submitted the merge request to use it for creating the dedicated deployment environment in my pipeline script?

How can I get that?

Note: It seems only a webhook can provide the information about the user and all the details.

Upvotes: 3

Views: 2696

Answers (1)

Natalie Perret
Natalie Perret

Reputation: 8997

Found the information I wanted in https://docs.gitlab.com/ee/ci/variables

  • CI_MERGE_REQUEST_TITLE
  • CI_MERGE_REQUEST_PROJECT_URL
  • GITLAB_USER_NAME
  • CI_MERGE_REQUEST_ASSIGNEES

Probably won't even need to create a webservice for the webhook since everything can be found in the environment variables when running the pipeline script, this is pretty awesome!

Upvotes: 4

Related Questions