Commit adc11563 authored by Alex Ives's avatar Alex Ives

Add support for tfplan.json report

Added support for `terraform` report type in ci yml. This is a special
json file added as a part of https://gitlab.com/gitlab-org/gitlab/-/merge_requests/26830
to handle showing terraform results in merge requests

Relates to https://gitlab.com/gitlab-org/gitlab/issues/207527
parent d1ed6c02
...@@ -31,7 +31,8 @@ module Ci ...@@ -31,7 +31,8 @@ module Ci
metrics: 'metrics.txt', metrics: 'metrics.txt',
lsif: 'lsif.json', lsif: 'lsif.json',
dotenv: '.env', dotenv: '.env',
cobertura: 'cobertura-coverage.xml' cobertura: 'cobertura-coverage.xml',
terraform: 'tfplan.json'
}.freeze }.freeze
INTERNAL_TYPES = { INTERNAL_TYPES = {
...@@ -59,7 +60,8 @@ module Ci ...@@ -59,7 +60,8 @@ module Ci
dast: :raw, dast: :raw,
license_management: :raw, license_management: :raw,
license_scanning: :raw, license_scanning: :raw,
performance: :raw performance: :raw,
terraform: :raw
}.freeze }.freeze
TYPE_AND_FORMAT_PAIRS = INTERNAL_TYPES.merge(REPORT_TYPES).freeze TYPE_AND_FORMAT_PAIRS = INTERNAL_TYPES.merge(REPORT_TYPES).freeze
...@@ -129,7 +131,8 @@ module Ci ...@@ -129,7 +131,8 @@ module Ci
network_referee: 14, ## runner referees network_referee: 14, ## runner referees
lsif: 15, # LSIF data for code navigation lsif: 15, # LSIF data for code navigation
dotenv: 16, dotenv: 16,
cobertura: 17 cobertura: 17,
terraform: 18 # Transformed json
} }
enum file_format: { enum file_format: {
......
...@@ -14,7 +14,7 @@ module Gitlab ...@@ -14,7 +14,7 @@ module Gitlab
ALLOWED_KEYS = ALLOWED_KEYS =
%i[junit codequality sast dependency_scanning container_scanning %i[junit codequality sast dependency_scanning container_scanning
dast performance license_management license_scanning metrics lsif dast performance license_management license_scanning metrics lsif
dotenv cobertura].freeze dotenv cobertura terraform].freeze
attributes ALLOWED_KEYS attributes ALLOWED_KEYS
...@@ -36,6 +36,7 @@ module Gitlab ...@@ -36,6 +36,7 @@ module Gitlab
validates :lsif, array_of_strings_or_string: true validates :lsif, array_of_strings_or_string: true
validates :dotenv, array_of_strings_or_string: true validates :dotenv, array_of_strings_or_string: true
validates :cobertura, array_of_strings_or_string: true validates :cobertura, array_of_strings_or_string: true
validates :terraform, array_of_strings_or_string: true
end end
end end
......
...@@ -46,6 +46,7 @@ describe Gitlab::Ci::Config::Entry::Reports do ...@@ -46,6 +46,7 @@ describe Gitlab::Ci::Config::Entry::Reports do
:lsif | 'lsif.json' :lsif | 'lsif.json'
:dotenv | 'build.dotenv' :dotenv | 'build.dotenv'
:cobertura | 'cobertura-coverage.xml' :cobertura | 'cobertura-coverage.xml'
:terraform | 'tfplan.json'
end end
with_them do with_them do
......
...@@ -34,6 +34,7 @@ describe Ci::RetryBuildService do ...@@ -34,6 +34,7 @@ describe Ci::RetryBuildService do
job_artifacts_container_scanning job_artifacts_dast job_artifacts_container_scanning job_artifacts_dast
job_artifacts_license_management job_artifacts_license_scanning job_artifacts_license_management job_artifacts_license_scanning
job_artifacts_performance job_artifacts_lsif job_artifacts_performance job_artifacts_lsif
job_artifacts_terraform
job_artifacts_codequality job_artifacts_metrics scheduled_at job_artifacts_codequality job_artifacts_metrics scheduled_at
job_variables waiting_for_resource_at job_artifacts_metrics_referee job_variables waiting_for_resource_at job_artifacts_metrics_referee
job_artifacts_network_referee job_artifacts_dotenv job_artifacts_network_referee job_artifacts_dotenv
......
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