Commit f86783d5 authored by Grant Young's avatar Grant Young Committed by Patrick Bajao

Adjust job artifacts downloads for multiple types

Download call for artifacts now correctly handles if
report has multiple types associated.
parent 07204eaf
......@@ -786,7 +786,9 @@ module Ci
end
def artifacts_file_for_type(type)
job_artifacts.find_by(file_type: Ci::JobArtifact.file_types[type])&.file
file_types = Ci::JobArtifact.associated_file_types_for(type)
file_types_ids = file_types&.map { |file_type| Ci::JobArtifact.file_types[file_type] }
job_artifacts.find_by(file_type: file_types_ids)&.file
end
def coverage_regex
......
---
title: Adjust job report artifacts downloads to handle multiple types
merge_request: 53141
author:
type: fixed
......@@ -1860,7 +1860,7 @@ RSpec.describe Ci::Build do
subject { build.artifacts_file_for_type(file_type) }
it 'queries artifacts for type' do
expect(build).to receive_message_chain(:job_artifacts, :find_by).with(file_type: Ci::JobArtifact.file_types[file_type])
expect(build).to receive_message_chain(:job_artifacts, :find_by).with(file_type: [Ci::JobArtifact.file_types[file_type]])
subject
end
......
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