Skip to content

Add limits on number of schedule rules for in Security Policy Project

What does this MR do and why?

We are adding ability to set limits on number of scheduled security scan rules created for single Security Policy Project. By default limit is not enforced, but configurable.

Migration

⋊> env VERBOSE=true bundle exec rake db:migrate:up:main VERSION=20220516201245
WARNING: This version of GitLab depends on gitlab-shell 14.7.0, but you're running 14.5.0. Please update gitlab-shell.
== 20220516201245 AddSecurityPolicyScanExecutionSchedulesToPlanLimits: migrating
-- add_column(:plan_limits, :security_policy_scan_execution_schedules, :bigint, {:default=>0, :null=>false})
   -> 0.0213s
== 20220516201245 AddSecurityPolicyScanExecutionSchedulesToPlanLimits: migrated (0.0214s)
⋊> env VERBOSE=true bundle exec rake db:migrate:down:main VERSION=20220516201245
WARNING: This version of GitLab depends on gitlab-shell 14.7.0, but you're running 14.5.0. Please update gitlab-shell.
== 20220516201245 AddSecurityPolicyScanExecutionSchedulesToPlanLimits: reverting
-- remove_column(:plan_limits, :security_policy_scan_execution_schedules)
   -> 0.0140s
== 20220516201245 AddSecurityPolicyScanExecutionSchedulesToPlanLimits: reverted (0.0142s)

Queries

explain SELECT "security_orchestration_policy_rule_schedules".* FROM "security_orchestration_policy_rule_schedules" WHERE "security_orchestration_policy_rule_schedules"."security_orchestration_policy_configuration_id" = 154;
Time: 3.266 ms
  - planning: 0.882 ms
  - execution: 2.384 ms
    - I/O read: 2.310 ms
    - I/O write: 0.000 ms

https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/10249/commands/36360

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to Add application limits to scheduled security sc... (#335659 - closed)

Edited by Alan (Maciej) Paruszewski

Merge request reports