Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2019-07-17 02:36:49 +0300
committerMatija Čupić <matteeyah@gmail.com>2019-07-23 13:02:07 +0300
commit41b8dca877ba790cd56677dc6405e16b631f9854 (patch)
tree4d76c25f84ebb75b3a62f086ea559921b6f290b9 /lib
parent4e814c257b74ac78a50f54ec57b1e1c7f78d43b7 (diff)
Add specs for specifying pipeline behavior
Adds specs for testing the new behavior of specifying a pipeline when POSTing a status.
Diffstat (limited to 'lib')
-rw-r--r--lib/api/commit_statuses.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/api/commit_statuses.rb b/lib/api/commit_statuses.rb
index 61cf929bcdc..d58a5e214ed 100644
--- a/lib/api/commit_statuses.rb
+++ b/lib/api/commit_statuses.rb
@@ -52,7 +52,7 @@ module API
optional :name, type: String, desc: 'A string label to differentiate this status from the status of other systems. Default: "default"'
optional :context, type: String, desc: 'A string label to differentiate this status from the status of other systems. Default: "default"'
optional :coverage, type: Float, desc: 'The total code coverage'
- optional :pipeline_id, type: Integer, desc: 'An existing pipeline id, when multiple pipelines on the same commit sha have been triggered'
+ optional :pipeline_id, type: Integer, desc: 'An existing pipeline ID, when multiple pipelines on the same commit SHA have been triggered'
end
# rubocop: disable CodeReuse/ActiveRecord
post ':id/statuses/:sha' do
@@ -73,11 +73,8 @@ module API
not_found! 'References for commit' unless ref
name = params[:name] || params[:context] || 'default'
- pipeline = if params[:pipeline_id]
- @project.ci_pipelines.find_by(id: params[:pipeline_id])
- else
- @project.pipeline_for(ref, commit.sha)
- end
+
+ pipeline = @project.pipeline_for(ref, commit.sha, params[:pipeline_id])
unless pipeline
pipeline = @project.ci_pipelines.create!(