Commit ce4e32db authored by Alper Akgun's avatar Alper Akgun

Merge branch...

Merge branch '349801-data-tracking-add-high-conversion-trial-actions-to-continuous-onboarding-database-secure' into 'master'

Register actions to Continuous Onboarding database  license_scanning

See merge request gitlab-org/gitlab!77782
parents 69a41b5f 59d45d87
......@@ -27,7 +27,8 @@ class OnboardingProgress < ApplicationRecord
:secure_secret_detection_run,
:secure_coverage_fuzzing_run,
:secure_api_fuzzing_run,
:secure_cluster_image_scanning_run
:secure_cluster_image_scanning_run,
:license_scanning_run
].freeze
scope :incomplete_actions, -> (actions) do
......
# frozen_string_literal: true
class AddLicenseScanningActionToOnboardingProgresses < Gitlab::Database::Migration[1.0]
def change
add_column :onboarding_progresses, :license_scanning_run_at, :datetime_with_timezone
end
end
2b20f2c3bb8dd5d3ba27dcb8854108763a40be9393f4799f16e9c10daf9fff75
\ No newline at end of file
......@@ -17697,7 +17697,8 @@ CREATE TABLE onboarding_progresses (
secure_secret_detection_run_at timestamp with time zone,
secure_coverage_fuzzing_run_at timestamp with time zone,
secure_cluster_image_scanning_run_at timestamp with time zone,
secure_api_fuzzing_run_at timestamp with time zone
secure_api_fuzzing_run_at timestamp with time zone,
license_scanning_run_at timestamp with time zone
);
CREATE SEQUENCE onboarding_progresses_id_seq
......@@ -21,6 +21,8 @@ module SCA
end
def find_policies(detected_only: false, classification: [], sort: { by: :name, direction: :asc })
record_onboarding_progress
classifications = Array(classification || [])
matching_policies = policies.reject do |policy|
(detected_only && policy.dependencies.none?) ||
......@@ -102,5 +104,11 @@ module SCA
direction = SORT_DIRECTION[direction] || SORT_DIRECTION[:asc]
direction.call(items.sort_by { |item| attribute.call(item) })
end
def record_onboarding_progress
return unless pipeline
OnboardingProgress.register(pipeline.project.root_namespace, :license_scanning_run)
end
end
end
......@@ -206,7 +206,23 @@ RSpec.describe SCA::LicenseCompliance do
expect(actual).to eql(expected)
end
context "when searching for policies for licenses that were detected in a scan report" do
it 'records an onboarding progress action for license scanning' do
expect(OnboardingProgress).to receive(:register).with(pipeline.project.root_namespace, :license_scanning_run).and_call_original
license_compliance.find_policies
end
context 'when pipeline is not present' do
let!(:pipeline) { nil }
it 'records an onboarding progress action for license scanning' do
expect(OnboardingProgress).not_to receive(:register).with(anything)
license_compliance.find_policies
end
end
context 'when searching for policies for licenses that were detected in a scan report' do
let(:results) { license_compliance.find_policies(detected_only: true) }
it 'only includes licenses that appear in the latest license scan report' do
......
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