Skip to content

Add by_pipeline_ids scope for sbom_occurrences

Zamir Martins requested to merge add_by_pipeline_ids_scope into master

What does this MR do and why?

Add by_pipeline_ids scope for sbom_occurrences. This will be used for fetching occurrences based on pipeline_id as required by CVS on SBOM change (#464575) • Zamir Martins • 17.2

Related issue: #464575

Query plan

The average number of occurrences per pipeline_id is 450, the following example has the count of 63137 with the respective query plan:

Time: 3.239 ms
  - planning: 3.120 ms
  - execution: 0.119 ms
    - I/O read: 0.000 ms
    - I/O write: 0.000 ms

Shared buffers:
  - hits: 10 (~80.00 KiB) from the buffer pool
  - reads: 0 from the OS file cache, including disk I/O
  - dirtied: 0
  - writes: 0

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

> pipeline_id = Sbom::Occurrence.group(:pipeline_id).order(count: :desc).count.first.first
> Sbom::Occurrence.by_pipeline_ids(pipeline_id)
Edited by Zamir Martins

Merge request reports