From 847f1667c89831213859d62ca66fbd55181fb129 Mon Sep 17 00:00:00 2001
From: Grzegorz Bizon <grzesiek.bizon@gmail.com>
Date: Fri, 6 Apr 2018 10:41:58 +0200
Subject: [PATCH] Document unsupported variables for dynamic environments

---
 doc/ci/environments.md     | 15 ++++++++++++---
 doc/ci/variables/README.md |  4 ++++
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/doc/ci/environments.md b/doc/ci/environments.md
index 58c4a71cef..b3d9f0bc96 100644
--- a/doc/ci/environments.md
+++ b/doc/ci/environments.md
@@ -247,10 +247,19 @@ declaring their names dynamically in `.gitlab-ci.yml`. Dynamic environments is
 the basis of [Review apps](review_apps/index.md).
 
 >**Note:**
-The `name` and `url` parameters can use any of the defined CI variables,
+The `name` and `url` parameters can use most of the defined CI variables,
 including predefined, secure variables and `.gitlab-ci.yml`
-[`variables`](yaml/README.md#variables).
-You however cannot use variables defined under `script` or on the Runner's side.
+[`variables`](yaml/README.md#variables). You however cannot use variables
+defined under `script` or on the Runner's side. There are other variables that
+are unsupported in environment name context:
+- `CI_JOB_ID`
+- `CI_JOB_TOKEN`
+- `CI_BUILD_ID`
+- `CI_BUILD_TOKEN`
+- `CI_REGISTRY_USER`
+- `CI_REGISTRY_PASSWORD`
+- `CI_REPOSITORY_URL`
+- `CI_ENVIRONMENT_URL`
 
 GitLab Runner exposes various [environment variables][variables] when a job runs,
 and as such, you can use them as environment names. Let's add another job in
diff --git a/doc/ci/variables/README.md b/doc/ci/variables/README.md
index 381405a9db..4a504a9890 100644
--- a/doc/ci/variables/README.md
+++ b/doc/ci/variables/README.md
@@ -547,6 +547,9 @@ You can find a full list of unsupported variables below:
 - `CI_REPOSITORY_URL`
 - `CI_ENVIRONMENT_URL`
 
+These variables are also not supported in a contex of a
+[dynamic environment name][dynamic-environments].
+
 [ce-13784]: https://gitlab.com/gitlab-org/gitlab-ce/issues/13784 "Simple protection of CI secret variables"
 [eep]: https://about.gitlab.com/products/ "Available only in GitLab Premium"
 [envs]: ../environments.md
@@ -558,3 +561,4 @@ You can find a full list of unsupported variables below:
 [triggers]: ../triggers/README.md#pass-job-variables-to-a-trigger
 [subgroups]: ../../user/group/subgroups/index.md
 [builds-policies]: ../yaml/README.md#only-and-except-complex
+[dynamic-environments]: ../environments.md#dynamic-environments
-- 
2.30.9