Skip to content

Save resource verification level on create

What does this MR do and why?

This MR updates Catalog::Resources::CreateService to fetch the verification level from a resource's root namespace and save it with the resource. It also updates the verification_level field on the Resource model so it has the same values as the verification_field on VerifiedNamespace.

Changelog: changed

Issue: #455530 (closed)

Screenshots

You can see the badges showing up as expected below 👍

Note: we don't yet have a badge for verified creators, but the backend will support it once we add it

Screenshot 2024-04-16 at 15.11.06.png

How to set up and validate locally

  1. Pick a project that is not already a catalog resource

  2. Create a verified namespace record for the project's root namespace:

    project = Project.find_by_full_path('FULL_PATH')
    
    Ci::Catalog::VerifiedNamespace.create(namespace: project.root_namespace, verification_level: :gitlab_maintained)
  3. Set up the project to be a valid catalog resource: https://docs.gitlab.com/ee/ci/components/#create-a-component-project

  4. Create a release for the resource

  5. Check in the Rails console that a resource record was created with the correct verification level

    project = Project.find_by_full_path('FULL_PATH')
    
    project.catalog_resource.gitlab_maintained? # => true
Edited by Avielle Wolfe

Merge request reports