Commit 9932febe authored by Alex Groleau's avatar Alex Groleau

Added runner metrics and network referee types to job artifact model

Added runner metrics and network referee types to job artifact model
parent 1fcfac98
...@@ -16,6 +16,8 @@ module Ci ...@@ -16,6 +16,8 @@ module Ci
archive: nil, archive: nil,
metadata: nil, metadata: nil,
trace: nil, trace: nil,
metrics_referee: nil,
network_referee: nil,
junit: 'junit.xml', junit: 'junit.xml',
codequality: 'gl-code-quality-report.json', codequality: 'gl-code-quality-report.json',
sast: 'gl-sast-report.json', sast: 'gl-sast-report.json',
...@@ -37,6 +39,8 @@ module Ci ...@@ -37,6 +39,8 @@ module Ci
REPORT_TYPES = { REPORT_TYPES = {
junit: :gzip, junit: :gzip,
metrics: :gzip, metrics: :gzip,
metrics_referee: :gzip,
network_referee: :gzip,
# All these file formats use `raw` as we need to store them uncompressed # All these file formats use `raw` as we need to store them uncompressed
# for Frontend to fetch the files and do analysis # for Frontend to fetch the files and do analysis
...@@ -108,7 +112,9 @@ module Ci ...@@ -108,7 +112,9 @@ module Ci
license_management: 10, ## EE-specific license_management: 10, ## EE-specific
license_scanning: 101, ## EE-specific till 13.0 license_scanning: 101, ## EE-specific till 13.0
performance: 11, ## EE-specific performance: 11, ## EE-specific
metrics: 12 ## EE-specific metrics: 12, ## EE-specific
metrics_referee: 13, ## runner referees
network_referee: 14 ## runner referees
} }
enum file_format: { enum file_format: {
......
---
title: Metrics and network referee artifact types added to job artifact types
merge_request: 20181
author:
type: added
...@@ -1792,6 +1792,58 @@ describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -1792,6 +1792,58 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
end end
end end
end end
context 'when artifact_type is metrics_referee' do
context 'when artifact_format is gzip' do
let(:file_upload) { fixture_file_upload('spec/fixtures/referees/metrics_referee.json.gz') }
let(:params) { { artifact_type: :metrics_referee, artifact_format: :gzip } }
it 'stores metrics_referee data' do
upload_artifacts(file_upload, headers_with_token, params)
expect(response).to have_gitlab_http_status(201)
expect(job.reload.job_artifacts_metrics_referee).not_to be_nil
end
end
context 'when artifact_format is raw' do
let(:file_upload) { fixture_file_upload('spec/fixtures/referees/metrics_referee.json.gz') }
let(:params) { { artifact_type: :metrics_referee, artifact_format: :raw } }
it 'returns an error' do
upload_artifacts(file_upload, headers_with_token, params)
expect(response).to have_gitlab_http_status(400)
expect(job.reload.job_artifacts_metrics_referee).to be_nil
end
end
end
context 'when artifact_type is network_referee' do
context 'when artifact_format is gzip' do
let(:file_upload) { fixture_file_upload('spec/fixtures/referees/network_referee.json.gz') }
let(:params) { { artifact_type: :network_referee, artifact_format: :gzip } }
it 'stores network_referee data' do
upload_artifacts(file_upload, headers_with_token, params)
expect(response).to have_gitlab_http_status(201)
expect(job.reload.job_artifacts_network_referee).not_to be_nil
end
end
context 'when artifact_format is raw' do
let(:file_upload) { fixture_file_upload('spec/fixtures/referees/network_referee.json.gz') }
let(:params) { { artifact_type: :network_referee, artifact_format: :raw } }
it 'returns an error' do
upload_artifacts(file_upload, headers_with_token, params)
expect(response).to have_gitlab_http_status(400)
expect(job.reload.job_artifacts_network_referee).to be_nil
end
end
end
end end
context 'when artifacts are being stored outside of tmp path' do context 'when artifacts are being stored outside of tmp path' do
......
...@@ -35,7 +35,8 @@ describe Ci::RetryBuildService do ...@@ -35,7 +35,8 @@ describe Ci::RetryBuildService do
job_artifacts_license_management job_artifacts_license_scanning job_artifacts_license_management job_artifacts_license_scanning
job_artifacts_performance job_artifacts_performance
job_artifacts_codequality job_artifacts_metrics scheduled_at job_artifacts_codequality job_artifacts_metrics scheduled_at
job_variables waiting_for_resource_at].freeze job_variables waiting_for_resource_at job_artifacts_metrics_referee
job_artifacts_network_referee].freeze
IGNORE_ACCESSORS = IGNORE_ACCESSORS =
%i[type lock_version target_url base_tags trace_sections %i[type lock_version target_url base_tags trace_sections
......
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