Fix the wrong argument error
What does this MR do and why?
Fixes the wrong argument error as observed in the logs https://log.gprd.gitlab.net/app/discover#/?_g=h@0103128&_a=h@60d2b0b
During the function call, delay
arg is passed to execute
and not to constructor. Source link
Earlier code introduction MR.
Screenshots or screen recordings
For the below local setup validation on protected branch deletion and new protected branch creation.
Verified with pry_shell
breakpoint and redis-cli > monitor
that the delay is being set correctly.
1686236574.018458 [1 unix:/Users/bala/gitlab/gitlab-development-kit/redis/redis.socket] "zadd" "resque:gitlab:schedule" "1686236634.015475" "{\"retry\":true,\"queue\":\"default\",\"backtrace\":true,\"version\":0,\"class\":\"Security::ProcessScanResultPolicyWorker\",\"args\":[21,1],\"jid\":\"3aa13d17ef26ba0b6dd38b3c\",\"created_at\":1686236574.01555,\"correlation_id\":\"01H2DRDZBWERHCPWR9E6E328YS\",\"meta.caller_id\":\"Projects::ProtectedBranchesController#destroy\",\"meta.remote_ip\":\"172.16.123.1\",\"meta.feature_category\":\"security_policy_management\",\"meta.user\":\"root\",\"meta.user_id\":1,\"meta.project\":\"root/license-approval-policies-test-cases\",\"meta.root_namespace\":\"root\",\"meta.client_id\":\"user/1\",\"meta.root_caller_id\":\"Projects::ProtectedBranchesController#destroy\",\"worker_data_consistency\":\"always\",\"size_limiter\":\"validated\",\"scheduled_at\":1686236634.015475}"
How to set up and validate locally
- Create a Simple scan result policy like
scan_result_policy:
- name: License Policy 1
description: ''
enabled: true
actions:
- type: require_approval
approvals_required: 1
users_approvers_ids:
- 1
rules:
- type: license_finding
branches: []
match_on_inclusion: true
license_types:
- GNU General Public License v3.0 or later
license_states:
- newly_detected
- Create a new protected branch which invokes
Security::ProcessScanResultPolicyWorker
and we should observe the job invocation for ProcessScanResultPolicyWorker happens after a minute in log/Sidekiq.log.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #409047 (closed)
Edited by Bala Kumar