Make CI_MERGE_REQUEST_* variables always available

Summary

The CI_MERGE_REQUEST_* variables are only exposed when only:merge_requests is set. Because of this, we cannot easily have only one job for both merge requests and non-merge requests pipelines.

A work-around would be to create a YAML template to do that, but it is quite ugly and the fix in Gitlab is simple.

Steps to reproduce

Don't set only:merge_requests when using CI_MERGE_REQUEST_* variables.

Example Project

pluggi/ci-mr-variables!1

What is the current bug behavior?

CI_MERGE_REQUEST_* variables are exposed only when only:merge_requests is set.

What is the expected correct behavior?

Expose CI_MERGE_REQUEST_* variables even when only:merge_requests is not set.

Relevant logs and/or screenshots

If you look at the screenshots below, you can see that Gitlab is able to detect that the two pipelines are created for a merge request but only sets the variable when only:merge_requests is set.

only:merge_requests is not set notset

only:merge_requests is set set

Output of checks

This bug happens on GitLab.com

Possible fixes

Just removing this line should do the trick: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23398/diffs#b22732e5f39e176c7c719fe485847d0fb0564275_615_616

This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.

Edited by 🤖 GitLab Bot 🤖