summaryrefslogtreecommitdiff
path: root/app/models/ci
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-05-25 22:58:51 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-05-25 23:08:11 +0800
commit88ba7a034be6c2a93c495edd1d1db08ec6d98bb3 (patch)
treed887a6e81da91944756d9cd84ef3b20d7d83a653 /app/models/ci
parent86cd09f5d15d7d97f325e2464de8fc4753d54602 (diff)
downloadgitlab-ce-88ba7a034be6c2a93c495edd1d1db08ec6d98bb3.tar.gz
Pass external_url from environment if job doesn't have one
Also update the document and add a changelog entry
Diffstat (limited to 'app/models/ci')
-rw-r--r--app/models/ci/build.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index e50ea0e566a..5e2f8cda356 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -501,9 +501,15 @@ module Ci
def persisted_environment_variables
variables = persisted_environment.predefined_variables
- variables << { key: 'CI_ENVIRONMENT_URL',
- value: expanded_environment_url,
- public: true } if environment_url
+ if environment_url
+ variables << { key: 'CI_ENVIRONMENT_URL',
+ value: expanded_environment_url,
+ public: true }
+ elsif persisted_environment.external_url.present?
+ variables << { key: 'CI_ENVIRONMENT_URL',
+ value: persisted_environment.external_url,
+ public: true }
+ end
variables
end