Add method new_pipeline
This commit is contained in:
parent
2566c89a32
commit
003526e2ee
1 changed files with 6 additions and 4 deletions
|
@ -13,6 +13,8 @@ module Ci
|
||||||
raise RuntimeError, 'Insufficient permissions to create a new pipeline'
|
raise RuntimeError, 'Insufficient permissions to create a new pipeline'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
pipeline = new_pipeline
|
||||||
|
|
||||||
Ci::Commit.transaction do
|
Ci::Commit.transaction do
|
||||||
unless pipeline.config_processor
|
unless pipeline.config_processor
|
||||||
raise ArgumentError, pipeline.yaml_errors || 'Missing .gitlab-ci.yml file'
|
raise ArgumentError, pipeline.yaml_errors || 'Missing .gitlab-ci.yml file'
|
||||||
|
@ -27,6 +29,10 @@ module Ci
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def new_pipeline
|
||||||
|
project.ci_commits.new(sha: commit.id, ref: params[:ref], before_sha: Gitlab::Git::BLANK_SHA)
|
||||||
|
end
|
||||||
|
|
||||||
def ref_names
|
def ref_names
|
||||||
@ref_names ||= project.repository.ref_names
|
@ref_names ||= project.repository.ref_names
|
||||||
end
|
end
|
||||||
|
@ -34,9 +40,5 @@ module Ci
|
||||||
def commit
|
def commit
|
||||||
@commit ||= project.commit(params[:ref])
|
@commit ||= project.commit(params[:ref])
|
||||||
end
|
end
|
||||||
|
|
||||||
def pipeline
|
|
||||||
@pipeline ||= project.ci_commits.new(sha: commit.id, ref: params[:ref], before_sha: Gitlab::Git::BLANK_SHA)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue