diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-07-16 20:10:22 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-07-16 20:25:30 +0200 |
commit | 9912ad261f696ef92657171396774607af7f1893 (patch) | |
tree | 9268e628db419c2c88b5bb64a6ce478b6bfe3163 /app/models/ci/build.rb | |
parent | 50abec8ca36c5cbdb1f7878b3ac956211fc67d3d (diff) | |
download | gitlab-ce-9912ad261f696ef92657171396774607af7f1893.tar.gz |
Store when and yaml variables in builds table
Diffstat (limited to 'app/models/ci/build.rb')
-rw-r--r-- | app/models/ci/build.rb | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index e189dbac285..8c18f7ceb12 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.save MergeRequests::AddTodoWhenBuildFailsService.new(build.project, nil).close(new_build) @@ -117,7 +120,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 @@ -394,30 +402,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 } |