0

I know, that in general GitLab CI scripts run after every push to the repository. How I can retrieve metainforation about the push and then transfer it to the GitLab CI?

By metainforation I mean:

  • project name,
  • name of the user, who performed this push,
  • name of the branch (branches) affected by push.
VeLKerr
  • 2,995
  • 3
  • 24
  • 47
  • You can put a script in your gitlab ci pipeline that has access to gitlab api and then you can grab the details of merge request and then do whatever you want with those details. I would also say that its not a good approach – Arpit Solanki Jun 19 '17 at 17:51
  • VeLKerr I tried to answer your question below, can you confirm (accept) this answer if it is correct? Or comment it if it is not. – Stefan van Gastel Jun 22 '17 at 09:23
  • Ok, thanks. It's correct. But soon I'll update it because I've studied info about retrieving USER_NAME (in your answer I can see only user_id and email). – VeLKerr Jun 24 '17 at 00:45

1 Answers1

1

You can find an overview of variables available in the CI here: https://docs.gitlab.com/ee/ci/variables/#predefined-variables-environment-variables.

E.g.:

  • CI_COMMIT_REF_NAME | The branch or tag name for which project is built
  • CI_PROJECT_NAME | The project name that is currently being built (actually it is project folder name)
  • GITLAB_USER_ID | The id of the user who started the job
  • GITLAB_USER_EMAIL | The email of the user who started the job
Stefan van Gastel
  • 4,330
  • 23
  • 25