diff options
author | Valery Sizov <vsv2711@gmail.com> | 2015-04-10 15:39:16 +0300 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2015-04-10 15:43:22 +0300 |
commit | c7123b5e66073f530744b870a59c87a2b2d1740f (patch) | |
tree | 0d545c5f174fa04a7866c56e69028b77146136c1 /app | |
parent | fa1d7aaa99d13278a83d955804077811bb65c553 (diff) | |
download | gitlab-ci-c7123b5e66073f530744b870a59c87a2b2d1740f.tar.gz |
skip commit creation if there is no appropriate job
Diffstat (limited to 'app')
-rw-r--r-- | app/models/job.rb | 2 | ||||
-rw-r--r-- | app/models/project.rb | 5 | ||||
-rw-r--r-- | app/services/create_commit_service.rb | 4 |
3 files changed, 10 insertions, 1 deletions
diff --git a/app/models/job.rb b/app/models/job.rb index 005a778..82dac8f 100644 --- a/app/models/job.rb +++ b/app/models/job.rb @@ -33,7 +33,7 @@ class Job < ActiveRecord::Base end def run_for_ref?(ref) - if !refs.blank? + if refs.present? refs.split(",").map(&:strip).each do |refs_val| return true if File.fnmatch(refs_val, ref) end diff --git a/app/models/project.rb b/app/models/project.rb index 10916ab..247824c 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -179,6 +179,11 @@ ls -la end end + def create_commit_for_tag?(tag) + jobs.where(build_tags: true).active.parallel.any? || + jobs.active.deploy.any?{ |job| job.run_for_ref?(tag)} + end + def coverage_enabled? coverage_regex.present? end diff --git a/app/services/create_commit_service.rb b/app/services/create_commit_service.rb index 1d1d3dc..0671a70 100644 --- a/app/services/create_commit_service.rb +++ b/app/services/create_commit_service.rb @@ -15,6 +15,10 @@ class CreateCommitService return false end + if origin_ref.start_with?('refs/tags/') && !project.create_commit_for_tag?(ref) + return false + end + if project.skip_ref?(ref) return false end |