diff options
author | Stan Hu <stanhu@gmail.com> | 2018-01-28 22:07:06 -0800 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-01-28 22:07:06 -0800 |
commit | f10ca3feb958424e60936b3beed706f6975ae847 (patch) | |
tree | ad8e3a7b2a73ded4e614d4e4880d8f4f5830364e | |
parent | 3444b7b0571808ac0ee48333b90313ee1482a75e (diff) | |
download | gitlab-ce-sh-api-cancel-pipelines.tar.gz |
Update API endpoint to cancel all pipelines for a projectsh-api-cancel-pipelines
-rw-r--r-- | lib/api/pipelines.rb | 2 | ||||
-rw-r--r-- | spec/requests/api/pipelines_spec.rb | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/api/pipelines.rb b/lib/api/pipelines.rb index 23ee6b439c9..9ff85264849 100644 --- a/lib/api/pipelines.rb +++ b/lib/api/pipelines.rb @@ -101,7 +101,7 @@ module API end desc 'Cancel all builds in all pipelines of the project' do - detail 'This feature was introduced in GitLab 10.1' + detail 'This feature was introduced in GitLab 10.5' end post ':id/pipelines/:cancel' do authorize! :update_pipeline, user_project diff --git a/spec/requests/api/pipelines_spec.rb b/spec/requests/api/pipelines_spec.rb index 51e7ba36ab8..ad43ed4dc50 100644 --- a/spec/requests/api/pipelines_spec.rb +++ b/spec/requests/api/pipelines_spec.rb @@ -412,7 +412,7 @@ describe API::Pipelines do let!(:build) { create(:ci_build, :running, pipeline: pipeline) } context 'authorized user' do - it 'retries failed builds' do + it 'cancels builds' do post api("/projects/#{project.id}/pipelines/#{pipeline.id}/cancel", user) expect(response).to have_gitlab_http_status(200) @@ -443,6 +443,12 @@ describe API::Pipelines do ref: project.default_branch, status: :running) end + let!(:finished_pipelines) do + create(:ci_empty_pipeline, + project: project, sha: project.commit.id, + ref: project.default_branch, status: :success) + end + let!(:build) { create(:ci_build, :running, pipeline: pipelines[0]) } let!(:build2) { create(:ci_build, :running, pipeline: pipelines[1]) } @@ -460,7 +466,7 @@ describe API::Pipelines do let!(:reporter) { create(:user) } before do - project.team << [reporter, :reporter] + project.team.add_reporter(reporter) end it 'rejects the action' do |