summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-09-27 11:45:16 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-09-27 11:45:16 +0200
commit26e73c2e8fa3d6cdd85ba82628981d3334445aeb (patch)
tree67b1a286e243253961c84c1a6e9d113869820804
parent057a8b709346a89e2ccdfe6e9b352ce5f93e71c7 (diff)
downloadgitlab-ce-26e73c2e8fa3d6cdd85ba82628981d3334445aeb.tar.gz
Add some minor improvements to pipeline creation chainbackstage/gb/refactor-pipeline-create-service
-rw-r--r--app/services/ci/create_pipeline_service.rb12
-rw-r--r--lib/gitlab/ci/pipeline/chain/sequence.rb5
-rw-r--r--lib/gitlab/ci/pipeline/chain/validate/repository.rb2
3 files changed, 5 insertions, 14 deletions
diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb
index df5b32d97ca..31a712ccc1b 100644
--- a/app/services/ci/create_pipeline_service.rb
+++ b/app/services/ci/create_pipeline_service.rb
@@ -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")
diff --git a/lib/gitlab/ci/pipeline/chain/sequence.rb b/lib/gitlab/ci/pipeline/chain/sequence.rb
index c80d583939c..015f2988327 100644
--- a/lib/gitlab/ci/pipeline/chain/sequence.rb
+++ b/lib/gitlab/ci/pipeline/chain/sequence.rb
@@ -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
diff --git a/lib/gitlab/ci/pipeline/chain/validate/repository.rb b/lib/gitlab/ci/pipeline/chain/validate/repository.rb
index 9d328c9cedb..70a4cfdbdea 100644
--- a/lib/gitlab/ci/pipeline/chain/validate/repository.rb
+++ b/lib/gitlab/ci/pipeline/chain/validate/repository.rb
@@ -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