Skip updating vulnerability statistics if there are no new records
What does this MR do and why?
This MR addresses an exception that happens when there are no new vulnerabilities for a pipeline while ingesting the security reports.
The exception we receive is;
ActiveRecord::StatementInvalid:
PG::SyntaxError: ERROR: syntax error at or near ","
LINE 1: ...O vulnerability_statistics AS target (project_id, , letter_g...
This happens because the insert_attributes
is empty if there are no new vulnerabilities, also, trying to run this query without having new vulnerabilities does not make sense at all.
Related to !75268 (merged).
Note: This ingestion service runs behind a feature flag but I've added a changelog entry anyway.
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 Mehmet Emin INAC