Commit 26d063b7 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch '336953-remove-pipeline-finder-by-name' into 'master'

Remove name parameter from pipeline finder

See merge request gitlab-org/gitlab!68997
parents 1cb91081 ba78bb2a
...@@ -25,7 +25,6 @@ module Ci ...@@ -25,7 +25,6 @@ module Ci
items = by_status(items) items = by_status(items)
items = by_ref(items) items = by_ref(items)
items = by_sha(items) items = by_sha(items)
items = by_name(items)
items = by_username(items) items = by_username(items)
items = by_yaml_errors(items) items = by_yaml_errors(items)
items = by_updated_at(items) items = by_updated_at(items)
...@@ -115,17 +114,6 @@ module Ci ...@@ -115,17 +114,6 @@ module Ci
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
# This method is deprecated and will be removed in 14.3
# rubocop: disable CodeReuse/ActiveRecord
def by_name(items)
if params[:name].present?
items.joins(:user).where(users: { name: params[:name] })
else
items
end
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def by_username(items) def by_username(items)
return items unless params[:username].present? return items unless params[:username].present?
......
...@@ -36,7 +36,6 @@ GET /projects/:id/pipelines ...@@ -36,7 +36,6 @@ GET /projects/:id/pipelines
| `ref` | string | no | The ref of pipelines | | `ref` | string | no | The ref of pipelines |
| `sha` | string | no | The SHA of pipelines | | `sha` | string | no | The SHA of pipelines |
| `yaml_errors`| boolean | no | Returns pipelines with invalid configurations | | `yaml_errors`| boolean | no | Returns pipelines with invalid configurations |
| `name`| string | no | _([Deprecated in GitLab 14.2](https://gitlab.com/gitlab-org/gitlab/-/issues/336953))_ The name of the user who triggered pipelines |
| `username`| string | no | The username of the user who triggered pipelines | | `username`| string | no | The username of the user who triggered pipelines |
| `updated_after` | datetime | no | Return pipelines updated after the specified date. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`). | | `updated_after` | datetime | no | Return pipelines updated after the specified date. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`). |
| `updated_before` | datetime | no | Return pipelines updated before the specified date. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`). | | `updated_before` | datetime | no | Return pipelines updated before the specified date. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`). |
......
...@@ -44,7 +44,6 @@ module API ...@@ -44,7 +44,6 @@ module API
optional :ref, type: String, desc: 'The ref of pipelines' optional :ref, type: String, desc: 'The ref of pipelines'
optional :sha, type: String, desc: 'The sha of pipelines' optional :sha, type: String, desc: 'The sha of pipelines'
optional :yaml_errors, type: Boolean, desc: 'Returns pipelines with invalid configurations' optional :yaml_errors, type: Boolean, desc: 'Returns pipelines with invalid configurations'
optional :name, type: String, desc: '(deprecated) The name of the user who triggered pipelines'
optional :username, type: String, desc: 'The username of the user who triggered pipelines' optional :username, type: String, desc: 'The username of the user who triggered pipelines'
optional :updated_before, type: DateTime, desc: 'Return pipelines updated before the specified datetime. Format: ISO 8601 YYYY-MM-DDTHH:MM:SSZ' optional :updated_before, type: DateTime, desc: 'Return pipelines updated before the specified datetime. Format: ISO 8601 YYYY-MM-DDTHH:MM:SSZ'
optional :updated_after, type: DateTime, desc: 'Return pipelines updated after the specified datetime. Format: ISO 8601 YYYY-MM-DDTHH:MM:SSZ' optional :updated_after, type: DateTime, desc: 'Return pipelines updated after the specified datetime. Format: ISO 8601 YYYY-MM-DDTHH:MM:SSZ'
......
...@@ -113,27 +113,6 @@ RSpec.describe Ci::PipelinesFinder do ...@@ -113,27 +113,6 @@ RSpec.describe Ci::PipelinesFinder do
end end
end end
context 'when name is specified' do
let(:user) { create(:user) }
let!(:pipeline) { create(:ci_pipeline, project: project, user: user) }
context 'when name exists' do
let(:params) { { name: user.name } }
it 'returns matched pipelines' do
is_expected.to eq([pipeline])
end
end
context 'when name does not exist' do
let(:params) { { name: 'invalid-name' } }
it 'returns empty' do
is_expected.to be_empty
end
end
end
context 'when username is specified' do context 'when username is specified' do
let(:user) { create(:user) } let(:user) { create(:user) }
let!(:pipeline) { create(:ci_pipeline, project: project, user: user) } let!(:pipeline) { create(:ci_pipeline, project: project, user: user) }
......
...@@ -168,30 +168,6 @@ RSpec.describe API::Ci::Pipelines do ...@@ -168,30 +168,6 @@ RSpec.describe API::Ci::Pipelines do
end end
end end
context 'when name is specified' do
let_it_be(:pipeline) { create(:ci_pipeline, project: project, user: user) }
context 'when name exists' do
it 'returns matched pipelines' do
get api("/projects/#{project.id}/pipelines", user), params: { name: user.name }
expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers
expect(json_response.first['id']).to eq(pipeline.id)
end
end
context 'when name does not exist' do
it 'returns empty' do
get api("/projects/#{project.id}/pipelines", user), params: { name: 'invalid-name' }
expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers
expect(json_response).to be_empty
end
end
end
context 'when username is specified' do context 'when username is specified' do
let_it_be(:pipeline) { create(:ci_pipeline, project: project, user: user) } let_it_be(:pipeline) { create(:ci_pipeline, project: project, user: user) }
......
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