diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-07-06 16:11:07 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-07-06 16:11:07 +0300 |
commit | ec3b10e078de03ac32ef85872d3d1518ef8526d5 (patch) | |
tree | 032fc483f456228b19587cafbce8d31c9ab5603a /app/models/ci/build.rb | |
parent | 1bdd295394d115cb88a9b6be7f44851c6e58a491 (diff) | |
parent | d9435d61218f677395f3b53976a41ac5f361f24b (diff) |
Merge branch '34716-environment-specific-variables-ce' into 'master'
Backports for ee-2112
Closes #34716
See merge request !12671
Diffstat (limited to 'app/models/ci/build.rb')
-rw-r--r-- | app/models/ci/build.rb | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 5fb4c7e3cb3..48586ba8910 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -186,6 +186,12 @@ module Ci # Variables whose value does not depend on environment def simple_variables + variables(environment: nil) + end + + # All variables, including those dependent on environment, which could + # contain unexpanded variables. + def variables(environment: persisted_environment) variables = predefined_variables variables += project.predefined_variables variables += pipeline.predefined_variables @@ -194,15 +200,11 @@ module Ci variables += project.deployment_variables if has_environment? variables += yaml_variables variables += user_variables - variables += project.secret_variables_for(ref).map(&:to_runner_variable) + variables += secret_variables(environment: environment) variables += trigger_request.user_variables if trigger_request - variables - end + variables += persisted_environment_variables if environment - # All variables, including those dependent on environment, which could - # contain unexpanded variables. - def variables - simple_variables.concat(persisted_environment_variables) + variables end def merge_request @@ -370,6 +372,11 @@ module Ci ] end + def secret_variables(environment: persisted_environment) + project.secret_variables_for(ref: ref, environment: environment) + .map(&:to_runner_variable) + end + def steps [Gitlab::Ci::Build::Step.from_commands(self), Gitlab::Ci::Build::Step.from_after_script(self)].compact |