Add logs when MR approvals are updated by scan result policy
What does this MR do and why?
This MR logs more information when MR approvals are updated from scan result policy to make debugging easier.
Addresses: #413773 (closed)
Sample log
{"severity":"INFO","time":"2023-07-21T16:18:12.675Z","correlation_id":"01H5WKX4HJGZP2KTMBTMQHPZWP","meta.caller_id":"Security::ScanResultPolicies::SyncFindingsToApprovalRulesWorker","meta.remote_ip":"172.16.123.1","meta.feature_category":"security_policy_management","meta.user":"root","meta.user_id":1,"meta.project":"multi-pipeline/test-multi-pipeline","meta.root_namespace":"multi-pipeline","meta.client_id":"user/1","meta.pipeline_id":1065,"meta.job_id":986,"meta.root_caller_id":"PUT /api/:version/jobs/:id","meta.artifact_size":11577,"message":"Evaluating MR approval rules from scan result policies","merge_request_id":201,"pipeline_ids":[1057,1065],"target_pipeline_ids":[736,1005,1060,998]}
{"severity":"INFO","time":"2023-07-21T16:18:12.680Z","correlation_id":"01H5WKX4HJGZP2KTMBTMQHPZWP","meta.caller_id":"Security::ScanResultPolicies::SyncFindingsToApprovalRulesWorker","meta.remote_ip":"172.16.123.1","meta.feature_category":"security_policy_management","meta.user":"root","meta.user_id":1,"meta.project":"multi-pipeline/test-multi-pipeline","meta.root_namespace":"multi-pipeline","meta.client_id":"user/1","meta.pipeline_id":1065,"meta.job_id":986,"meta.root_caller_id":"PUT /api/:version/jobs/:id","meta.artifact_size":11577,"message":"Updating MR approval rule","reason":"Scanner removed by MR","approval_rule_id":320}
{"severity":"INFO","time":"2023-07-21T16:23:59.174Z","correlation_id":"d99cbc5ce295482c1aec7f0aa6566bea","meta.caller_id":"Security::ScanResultPolicies::SyncFindingsToApprovalRulesWorker","meta.remote_ip":"172.16.123.1","meta.feature_category":"security_policy_management","meta.user":"root","meta.user_id":1,"meta.project":"multi-pipeline/test-multi-pipeline","meta.root_namespace":"multi-pipeline","meta.client_id":"user/1","meta.pipeline_id":1065,"meta.job_id":986,"meta.root_caller_id":"PUT /api/:version/jobs/:id","meta.artifact_size":11577,"message":"Updating MR approval rule","reason":"scan_finding rule violated,"approval_rule_id":320}
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.
Edited by Sashi Kumar Kumaresan