diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-05-21 16:26:51 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-05-21 16:26:51 +0300 |
commit | 723b2471dc3538fd61a05d6251363e6d0ad66394 (patch) | |
tree | e5d94b4372fcf79e7ba4af3cd889e42593bc4c99 /app/models/ci | |
parent | 7100f89f32b9cc95b03ea4e557f969da2b47e121 (diff) | |
parent | cd7702e5cd4ffcb1989d5fe758e3971a8952c5c0 (diff) |
Merge branch 'fix/gb/exclude-persisted-variables-from-environment-name' into 'master'
Do not allow to use `CI_PIPELINE_ID` in environment name
Closes #46443
See merge request gitlab-org/gitlab-ce!19032
Diffstat (limited to 'app/models/ci')
-rw-r--r-- | app/models/ci/build.rb | 1 | ||||
-rw-r--r-- | app/models/ci/pipeline.rb | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 1c42ed4d3e5..495430931aa 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -599,6 +599,7 @@ module Ci break variables unless persisted? variables + .concat(pipeline.persisted_variables) .append(key: 'CI_JOB_ID', value: id.to_s) .append(key: 'CI_JOB_TOKEN', value: token, public: false) .append(key: 'CI_BUILD_ID', value: id.to_s) diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index c26f0b6dcdc..53af87a271a 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) .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) |