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
ref: ref,
sha: sha,
before_sha: before_sha,
tag: tag?,
tag: tag_exists?,
trigger_requests: Array(trigger_request),
user: current_user,
pipeline_schedule: schedule,
......@@ -88,20 +88,14 @@ module Ci
params[:ref]
end
def tag?
return @is_tag if defined?(@is_tag)
@is_tag = project.repository.tag_exists?(ref)
def tag_exists?
project.repository.tag_exists?(ref)
end
def ref
@ref ||= Gitlab::Git.ref_name(origin_ref)
end
def valid_sha?
origin_sha && origin_sha != Gitlab::Git::BLANK_SHA
end
def pipeline_created_counter
@pipeline_created_counter ||= Gitlab::Metrics
.counter(:pipelines_created_total, "Counter of pipelines created")
......
......@@ -18,7 +18,7 @@ module Gitlab
break if step.break?
@completed << true
@completed << step
end
@pipeline.tap do
......@@ -27,8 +27,7 @@ module Gitlab
end
def complete?
@completed.size == @sequence.size &&
@completed.all?
@completed.size == @sequence.size
end
end
end
......
......@@ -14,8 +14,6 @@ module Gitlab
## TODO, we check commit in the service, that is why
# there is no repository access here.
#
# Should we validate repository before building a pipeline?
#
unless pipeline.sha
return error('Commit not found')
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