Skip to content

Draft: Optimize sbom_occurrences upserts

Fabien Catteau requested to merge 442486-optimize-sbom_occurrences_upserts into master

What does this MR do and why?

  • Change the comparison performed in IngestOccurrences#attibutes so that the pipeline_id and commit_sha are ignored. This way sbom_occurrences records aren't touched when the same SBOM components is ingested from a new pipeline and a new commit.
  • Implement Sbom::Occurrence#commit_sha. This new method returns the commit SHA of the last pipeline that has uploaded SBOMs. It uses Project#latest_ingested_sbom_pipeline, which needs to be cached. This ensures that the UX doesn't change.

See https://gitlab.com/gitlab-org/gitlab/-/issues/442486

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.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Related to #442486

Edited by Fabien Catteau

Merge request reports