Skip to content

Add cache for Software Licenses table

What does this MR do and why?

This MR adds cache for the SoftwareLicense as described in the implementation plan of issue #388630 (closed)

The software licenses rarely changes and are returned every time we populate the license type dropdown in the Scan Result Policy new and edit views.

Screenshots or screen recordings

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

How to set up and validate locally

Pre-requisites

Check if you have the licenses in your database.

  1. Open the rails console
rails c
  1. Query the software licenses
[1] pry(main)> SoftwareLicense.all
  1. If the table is empty, run the ImportSoftwareLicensesWorker
[2] pry(main)> ImportSoftwareLicensesWorker.new.perform

How to check the licenses in the UI

  1. Create a new project or open an existing one
  2. Go to Security and Compliance -> Policies.
  3. Click on New policy
  4. Select Scan Result Policy
  5. In Rules, Select License Scan.
  6. Click on the license type dropdown to verify the licenses

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Marcos Rocha

Merge request reports