Skip to content

Backend: Scan a catalog resource for components

Context

When a release is created for a catalog resource, we need to validate that it contains components.

Proposed solution

Create a new service that is called during the release creation process. When a release is created, this service will scan the catalog resource repository for valid components. This scan will happen synchronously unless we determine that it is too slow.

A valid component is a component that has a valid directory structure.

NOTE: the valid directory structure for a catalog resource repository is still under discussion in &10728 (comment 1420078585)

If the release is not valid, an error should be raised to the user. NOTE: this might need design if we are displaying the error on the release creation UI page

If the release contains valid CI components:

  1. Add a record to catalog_resource_versions
  2. Add a record to catalog_resource_components for each component found
  3. Mark the catalog resource as published if it is not already published

NOTE: The work noted in #428956 (closed) to introduce components per release limits will be handled in this issue too.

Implementation Table

NOTE: Backend: Create a migration to update state and... (#416292 - closed) can (and should) be worked on immediately after Backend: Scan a catalog resource for components (#415413 - closed)

This issue is being broken down into multiple MRs:

Problem MR Status
  1. Rename Services to suit patterns

!133731 (merged)

done
  1. Create Ci::Catalog::ComponentsProject and extract

knowledge from InstancePath

!133732 (merged)

done
  1. Clean up and update Ci::Catalog::Resources::ValidateService

!134906 (merged)

done
  1. Create Ci::Catalog::Resources::Version::CreateService

to use previously created service

!134148 (merged)

done

previously blocked by:

#429256 (closed), which is now merged

  1. Create Ci::Catalog::Resources::ReleaseService

!133739 (merged)

done
Group Issue Link
backend #425726 (closed)
frontend #424967 (closed)
backend 👈 You are here
backend #416292 (closed)
backend #427170 (closed)
backend #427169 (closed)
backend #415414 (closed)
Edited by Laura Montemayor