summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-05-14 19:47:16 -0500
committerKamil Trzcinski <ayufan@ayufan.eu>2016-05-14 19:47:16 -0500
commit003526e2ee408bc6be3596436288213cc57d1bcd (patch)
treed5aa7286d449a1cd898fe74739b69881ba6cb38b /app
parent2566c89a3232d6d4d5aa5d77821819e86424548d (diff)
downloadgitlab-ce-003526e2ee408bc6be3596436288213cc57d1bcd.tar.gz
Add method new_pipeline
Diffstat (limited to 'app')
-rw-r--r--app/services/ci/create_pipeline_service.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb
index 223514968fc..e13f4fce13d 100644
--- a/app/services/ci/create_pipeline_service.rb
+++ b/app/services/ci/create_pipeline_service.rb
@@ -13,6 +13,8 @@ module Ci
raise RuntimeError, 'Insufficient permissions to create a new pipeline'
end
+ pipeline = new_pipeline
+
Ci::Commit.transaction do
unless pipeline.config_processor
raise ArgumentError, pipeline.yaml_errors || 'Missing .gitlab-ci.yml file'
@@ -27,6 +29,10 @@ module Ci
private
+ def new_pipeline
+ project.ci_commits.new(sha: commit.id, ref: params[:ref], before_sha: Gitlab::Git::BLANK_SHA)
+ end
+
def ref_names
@ref_names ||= project.repository.ref_names
end
@@ -34,9 +40,5 @@ module Ci
def commit
@commit ||= project.commit(params[:ref])
end
-
- def pipeline
- @pipeline ||= project.ci_commits.new(sha: commit.id, ref: params[:ref], before_sha: Gitlab::Git::BLANK_SHA)
- end
end
end