Commit 4e814c25 authored by Gaetan Semet's avatar Gaetan Semet Committed by Matija Čupić

Multiple pipeline support for Build status

This allows user to specify the pipeline ID
when several pipelines has been triggered
on the same branch and commit.
Signed-off-by: default avatarGaetan Semet <gaetan.semet@renault.com>
parent 4f95a8d7
---
title: Multiple pipeline support for Commit status
merge_request: 21671
author: Gaetan Semet
type: changed
......@@ -581,6 +581,7 @@ POST /projects/:id/statuses/:sha
| `target_url` | string | no | The target URL to associate with this status
| `description` | string | no | The short description of the status
| `coverage` | float | no | The total code coverage
| `pipeline_id` | integer | no | The id of the pipeline to set status. Use in case of several pipeline on same sha.
```bash
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/17/statuses/18f3e63d05582537db6d183d9d557be09e1f90c8?state=success"
......
......@@ -52,6 +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'
end
# rubocop: disable CodeReuse/ActiveRecord
post ':id/statuses/:sha' do
......@@ -72,8 +73,12 @@ 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)
unless pipeline
pipeline = @project.ci_pipelines.create!(
source: :external,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment