Commit 97e085fa authored by Matija Čupić's avatar Matija Čupić

Remove artifact searching by job name

Removes artifact searching from this MR. This will be followed up in a
separate issue.
parent c6db352c
......@@ -96,7 +96,7 @@ class Projects::ArtifactsController < Projects::ApplicationController
end
def artifacts_params
params.permit(:sort, :search)
params.permit(:sort)
end
def validate_artifacts!
......
......@@ -8,17 +8,10 @@ class ArtifactsFinder
def execute
artifacts = @project.job_artifacts
artifacts = by_job_name(artifacts)
sort(artifacts)
end
def by_job_name(artifacts)
return artifacts unless @params[:search].present?
artifacts.search_by_job_name(@params[:search])
end
private
def sort_key
......
......@@ -152,10 +152,6 @@ module Ci
self.where(project: project).sum(:size)
end
def self.search_by_job_name(job_name)
joins(:job).where(ci_builds: { name: job_name })
end
def local_store?
[nil, ::JobArtifactUploader::Store::LOCAL].include?(self.file_store)
end
......
......@@ -27,15 +27,5 @@ describe ArtifactsFinder do
expect(subject).to eq(project.job_artifacts.order_by('size_desc'))
end
end
context 'with job_name param' do
let(:params) { { search: 'unique_name' } }
it 'filters the artifacts by job name' do
build = create(:ci_build, :artifacts, project: project, name: 'unique_name')
expect(subject).to contain_exactly(*build.job_artifacts)
end
end
end
end
......@@ -95,17 +95,6 @@ describe Ci::JobArtifact do
end
end
describe '.search_by_job_name' do
subject { described_class.search_by_job_name('unique_name') }
it 'returns only artifacts for specified job name' do
create(:ci_build, :artifacts)
matching_build = create(:ci_build, :artifacts, name: 'unique_name')
expect(subject).to eq(matching_build.job_artifacts)
end
end
describe 'callbacks' do
subject { create(:ci_job_artifact, :archive) }
......
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