summaryrefslogtreecommitdiff
path: root/app/models/ci/pipeline.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-05-18 11:28:32 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-05-18 11:28:32 +0200
commit9f7deb85b5d6937e6cf7068b864f49693b4a2623 (patch)
tree7d6805454a87d5f187086180c3bcd03e61556610 /app/models/ci/pipeline.rb
parent769c4a6197dfd72aca06abd20fa1ffe5c568ed24 (diff)
downloadgitlab-ce-9f7deb85b5d6937e6cf7068b864f49693b4a2623.tar.gz
Do not allow to use `CI_PIPELINE_ID` in environment name
Diffstat (limited to 'app/models/ci/pipeline.rb')
-rw-r--r--app/models/ci/pipeline.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index c26f0b6dcdc..7d7349b04bc 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -523,9 +523,14 @@ module Ci
strong_memoize(:legacy_trigger) { trigger_requests.first }
end
+ def persisted_variables
+ Gitlab::Ci::Variables::Collection.new.tap do |variables|
+ variables.append(key: 'CI_PIPELINE_ID', value: id.to_s) if persisted?
+ end
+ end
+
def predefined_variables
- Gitlab::Ci::Variables::Collection.new
- .append(key: 'CI_PIPELINE_ID', value: id.to_s)
+ persisted_variables
.append(key: 'CI_CONFIG_PATH', value: ci_yaml_file_path)
.append(key: 'CI_PIPELINE_SOURCE', value: source.to_s)
.append(key: 'CI_COMMIT_MESSAGE', value: git_commit_message)