summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/commit.rb20
1 files changed, 15 insertions, 5 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index f27a385..7cebf35 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -92,12 +92,12 @@ class Commit < ActiveRecord::Base
end
def create_builds
- return if push_data[:commits].last[:message] =~ /(\[ci skip\])/
+ return if skip_ci?
config_processor.builds_for_ref(ref, tag).each do |build_attrs|
builds.create!({
project: project,
- name: build_attrs[:name],
+ name: build_attrs[:name],
commands: build_attrs[:script],
tag_list: build_attrs[:tags]
})
@@ -119,12 +119,12 @@ class Commit < ActiveRecord::Base
end
def create_deploy_builds
- return if push_data[:commits].last[:message] =~ /(\[ci skip\])/
-
+ return if skip_ci?
+
config_processor.deploy_builds_for_ref(ref, tag).each do |build_attrs|
builds.create!({
project: project,
- name: build_attrs[:name],
+ name: build_attrs[:name],
commands: build_attrs[:script],
tag_list: build_attrs[:tags],
deploy: true
@@ -195,4 +195,14 @@ class Commit < ActiveRecord::Base
def config_processor
@config_processor ||= GitlabCiYamlProcessor.new(push_data[:ci_yaml_file])
end
+
+ def skip_ci?
+ commits = push_data[:commits]
+
+ if commits.present? && commits.last[:message] =~ /(\[ci skip\])/
+ true
+ else
+ false
+ end
+ end
end