CI_ENVIRONMENT_SLUG should be stable in the scope of an MR
Description
The CI_ENVIRONMENT_SLUG
is constructed with a 24 character limit in mind, and a random suffix in most cases.
Problem
By adding the random suffix we can ensure uniqueness but not stableness. Which means that if the CI_ENVIRONMENT_SLUG
is used in an environment URL for a review app, with every push the job is run again and the URL changes. In a real world example, you can see that the gitlab-docs project has a lot of branches that many of them are from the same upstream merge request https://gitlab.com/gitlab-com/gitlab-docs/branches/active.
From https://gitlab.slack.com/archives/C0SFP840G/p1530696822000021:
remember that there is no error checking to see if the environment is actually persisted. This may account for why the suffix is new each time. https://gitlab.com/gitlab-org/gitlab-ce/blob/935969be250435b482863e42684fdd7cef7d37c0/lib/gitlab/ci/pipeline/chain/create.rb#L17
Proposal
I would expect the CI_ENVIRONMENT_SLUG
to at least stay the same in the scope of an MR (based on branch name?).
Discussion in chat https://gitlab.slack.com/archives/C0SFP840G/p1530696158000180.