Add some minor improvements to pipeline creation chain

This commit is contained in:
Grzegorz Bizon 2017-09-27 11:45:16 +02:00
parent 057a8b7093
commit 26e73c2e8f
3 changed files with 5 additions and 14 deletions

View File

@ -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")

View File

@ -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

View File

@ -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