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
How to set up and validate locally
-
Pick a project that is not already a catalog resource
-
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)
-
Set up the project to be a valid catalog resource: https://docs.gitlab.com/ee/ci/components/#create-a-component-project
-
Create a release for the resource
-
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