Commit 26e73c2e authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add some minor improvements to pipeline creation chain

parent 057a8b70
...@@ -15,7 +15,7 @@ module Ci ...@@ -15,7 +15,7 @@ module Ci
ref: ref, ref: ref,
sha: sha, sha: sha,
before_sha: before_sha, before_sha: before_sha,
tag: tag?, tag: tag_exists?,
trigger_requests: Array(trigger_request), trigger_requests: Array(trigger_request),
user: current_user, user: current_user,
pipeline_schedule: schedule, pipeline_schedule: schedule,
...@@ -88,20 +88,14 @@ module Ci ...@@ -88,20 +88,14 @@ module Ci
params[:ref] params[:ref]
end end
def tag? def tag_exists?
return @is_tag if defined?(@is_tag) project.repository.tag_exists?(ref)
@is_tag = project.repository.tag_exists?(ref)
end end
def ref def ref
@ref ||= Gitlab::Git.ref_name(origin_ref) @ref ||= Gitlab::Git.ref_name(origin_ref)
end end
def valid_sha?
origin_sha && origin_sha != Gitlab::Git::BLANK_SHA
end
def pipeline_created_counter def pipeline_created_counter
@pipeline_created_counter ||= Gitlab::Metrics @pipeline_created_counter ||= Gitlab::Metrics
.counter(:pipelines_created_total, "Counter of pipelines created") .counter(:pipelines_created_total, "Counter of pipelines created")
......
...@@ -18,7 +18,7 @@ module Gitlab ...@@ -18,7 +18,7 @@ module Gitlab
break if step.break? break if step.break?
@completed << true @completed << step
end end
@pipeline.tap do @pipeline.tap do
...@@ -27,8 +27,7 @@ module Gitlab ...@@ -27,8 +27,7 @@ module Gitlab
end end
def complete? def complete?
@completed.size == @sequence.size && @completed.size == @sequence.size
@completed.all?
end end
end end
end end
......
...@@ -14,8 +14,6 @@ module Gitlab ...@@ -14,8 +14,6 @@ module Gitlab
## TODO, we check commit in the service, that is why ## TODO, we check commit in the service, that is why
# there is no repository access here. # there is no repository access here.
# #
# Should we validate repository before building a pipeline?
#
unless pipeline.sha unless pipeline.sha
return error('Commit not found') return error('Commit not found')
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment