Skip to content

Use object exist check for codeowners file

Adam Hegyi requested to merge 394831-use-object-exists-for-snapshot-worker into master

What does this MR do and why?

This MR uses a faster lookup to determine if a project uses CODEOWNERS file in the devops adoption report feature. The change is behind the use_faster_code_owner_file_exist_check a feature flag.

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

Recording codeowners usage count (project count) should work as before. You can verify it by executing the following steps:

  1. Ensure you're on ultimate plan and enable the feature flag

    Feature.enable(:use_faster_code_owner_file_exist_check)
  2. Create a new group and visit Analytics > DevOps Adoption (this create the enabled namespace record)

  3. Create a project

  4. Add a new file named CODEOWNERS with some random content

  5. Start rails console and run:

    enabled_namespace = Analytics::DevopsAdoption::EnabledNamespace.last
    range_end = Date.today
    Analytics::DevopsAdoption::Snapshots::CalculateAndSaveService.new(enabled_namespace: enabled_namespace, range_end: range_end).execute
  6. Notice the code_owners_used_count: 1 value. It should show 1.

Related to #394831

Edited by Adam Hegyi

Merge request reports