diff options
author | Valery Sizov <vsv2711@gmail.com> | 2015-05-29 16:25:04 +0300 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2015-06-03 16:36:54 +0300 |
commit | 85cd3463d6c023aea4441ecbd086c53e93a600cb (patch) | |
tree | fb8f7b3dc1e382c16278156c4cf3a390576aa8c2 /app/models/commit.rb | |
parent | 2999c8b41f8272b239e4364867012c9e3d4a997a (diff) | |
download | gitlab-ci-85cd3463d6c023aea4441ecbd086c53e93a600cb.tar.gz |
Implementation of configuration CI with gitlab-ci.yml
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r-- | app/models/commit.rb | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index b9a5100..14b558f 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -92,8 +92,11 @@ class Commit < ActiveRecord::Base end def create_builds - builds_config.builds.each do |build_attrs| - builds.create!({project: project}.merge(build_attrs)) + filter_param = tag? ? :tags : :branches + config_processor.builds.each do |build_attrs| + if build_attrs[filter_param] + builds.create!({project: project}.merge(build_attrs.extract!(:name, :commands, :tag_list))) + end end end @@ -112,23 +115,11 @@ class Commit < ActiveRecord::Base end def create_deploy_builds - builds_config.deploy_builds.each do |build_attrs| - refs = build_attrs.delete(:refs) - next unless refs.empty? || refs_matches?(refs, ref) + config_processor.deploy_builds_for_ref(ref).each do |build_attrs| builds.create!({project: project}.merge(build_attrs)) end end - # refs - list of refs. Glob syntax is supported. Ex. ["feature*", "bug"] - # ref - ref that should be checked - def refs_matches?(refs, ref) - refs.map(&:strip).each do |ref_pattern| - return true if File.fnmatch(ref_pattern, ref) - end - - false - end - def status if success? 'success' @@ -189,7 +180,7 @@ class Commit < ActiveRecord::Base builds_without_retry.size > 1 end - def builds_config - @builds_config ||= GitlabCiYamlParser.new(push_data[:ci_yaml_file]) + def config_processor + @config_processor ||= GitlabCiYamlProcessor.new(push_data[:ci_yaml_file]) end end |