Commit e690cc79 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'remove-join-to-builds-analyzer-scans' into 'master'

Secure `[analyzer]_scans` metrics report on all CI jobs

See merge request gitlab-org/gitlab!67812
parents 4ba24381 22b1675c
...@@ -401,10 +401,8 @@ module EE ...@@ -401,10 +401,8 @@ module EE
{}.tap do |secure_jobs| {}.tap do |secure_jobs|
::Security::Scan.scan_types.each do |name, scan_type| ::Security::Scan.scan_types.each do |name, scan_type|
secure_jobs["#{name}_scans".to_sym] = count(::Security::Scan.joins(:build) by_scan_type = ::Security::Scan.where(scan_type: scan_type).where(time_period)
.where(scan_type: scan_type) secure_jobs["#{name}_scans".to_sym] = count(by_scan_type, :build_id, start: start, finish: finish)
.merge(::CommitStatus.latest.success)
.where(time_period), :build_id, start: start, finish: finish)
end end
end end
end end
......
...@@ -598,8 +598,8 @@ RSpec.describe Gitlab::UsageData do ...@@ -598,8 +598,8 @@ RSpec.describe Gitlab::UsageData do
user_sast_jobs: 1, user_sast_jobs: 1,
user_secret_detection_jobs: 1, user_secret_detection_jobs: 1,
user_unique_users_all_secure_scanners: 1, user_unique_users_all_secure_scanners: 1,
sast_scans: 0, sast_scans: 2,
dependency_scanning_scans: 4, dependency_scanning_scans: 6,
container_scanning_scans: 2, container_scanning_scans: 2,
dast_scans: 0, dast_scans: 0,
secret_detection_scans: 2, secret_detection_scans: 2,
...@@ -625,8 +625,8 @@ RSpec.describe Gitlab::UsageData do ...@@ -625,8 +625,8 @@ RSpec.describe Gitlab::UsageData do
coverage_fuzzing_pipeline: be_within(error_rate).percent_of(0), coverage_fuzzing_pipeline: be_within(error_rate).percent_of(0),
api_fuzzing_pipeline: be_within(error_rate).percent_of(0), api_fuzzing_pipeline: be_within(error_rate).percent_of(0),
user_unique_users_all_secure_scanners: 1, user_unique_users_all_secure_scanners: 1,
sast_scans: 0, sast_scans: 1,
dependency_scanning_scans: 2, dependency_scanning_scans: 3,
container_scanning_scans: 1, container_scanning_scans: 1,
dast_scans: 0, dast_scans: 0,
secret_detection_scans: 1, secret_detection_scans: 1,
......
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