[go: up one dir, main page]

Add `$CI_ENVIRONMENT_URL` as a build variable

Description

https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7983 will add $CI_ENVIRONMENT_NAME and $CI_ENVIRONMENT_SLUG build variables. $CI_ENVIRONMENT_URL would be nice to have too, as it would allow .gitlab-ci.yml to be DRYed up, but is out of scope for that issue.

Proposal

We can't use the database column environments.url as the source of this data, as $CI_ENVIRONMENT_URL is the URL the environment will have if the deployment succeeds, and the deployment can't have succeeded until after the build has completed. So this needs adding to app/models/ci/build.rb, and should be calculated from the environment:url in .gitlab-ci.yml. Like $CI_ENVIRONMENT_NAME, it should undergo variable expansion. In particular $CI_ENVIRONMENT_SLUG should be an allowed variable for the environment URL.

Links / references