summaryrefslogtreecommitdiff
path: root/app/models/ci/build.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/ci/build.rb')
-rw-r--r--app/models/ci/build.rb34
1 files changed, 9 insertions, 25 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index b24527247e0..ffac3a22efc 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -5,6 +5,7 @@ module Ci
belongs_to :erased_by, class_name: 'User'
serialize :options
+ serialize :yaml_variables
validates :coverage, numericality: true, allow_blank: true
validates_presence_of :ref
@@ -52,6 +53,8 @@ module Ci
new_build.stage = build.stage
new_build.stage_idx = build.stage_idx
new_build.trigger_request = build.trigger_request
+ new_build.yaml_variables = build.yaml_variables
+ new_build.when = build.when
new_build.user = user
new_build.environment = build.environment
new_build.save
@@ -118,7 +121,12 @@ module Ci
end
def variables
- predefined_variables + yaml_variables + project_variables + trigger_variables
+ variables = []
+ variables += predefined_variables
+ variables += yaml_variables if yaml_variables
+ variables += project_variables
+ variables += trigger_variables
+ variables
end
def merge_request
@@ -395,30 +403,6 @@ module Ci
self.update(erased_by: user, erased_at: Time.now, artifacts_expire_at: nil)
end
- def yaml_variables
- global_yaml_variables + job_yaml_variables
- end
-
- def global_yaml_variables
- if pipeline.config_processor
- pipeline.config_processor.global_variables.map do |key, value|
- { key: key, value: value, public: true }
- end
- else
- []
- end
- end
-
- def job_yaml_variables
- if pipeline.config_processor
- pipeline.config_processor.job_variables(name).map do |key, value|
- { key: key, value: value, public: true }
- end
- else
- []
- end
- end
-
def project_variables
project.variables.map do |variable|
{ key: variable.key, value: variable.value, public: false }