Skip to content

Adds restriction to component fetching for nested components

Laura Montemayor requested to merge fix-component-fetching into master

What does this MR do and why?

Updates component fetching

In !127448 (merged), the fetching of the components was updated by restricting the location of the component file to specific directories. However, the directory structure implemented was slightly different that the proposal that was agreed upon: &10728, which states that there are 2 cases defined by the structure:

  1. a self-contained component: templates/secret-detecion.yml
  2. a complex component that relies on adjacent files: templates/dast/template.yml with only one component inside - other files are ignored.

Changelog: changed

Screenshots or screen recordings

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

Before After
Screenshot 2023-08-24 at 18.10.49.png Screenshot_2023-08-24_at_17.51.13

How to set up and validate locally

In a project that is marked as a component, create the following structure:

templates/secret-detection.yml # simple
templates/another-directory/template.yml # complex
templates/another-directory/test-template.yml # will be invalid when referenced
templates/another-directory/another-directory-2/template.yml # will be invalid when refereneced
include:
  - component: 'gdk.test:3000/root/test-project/another-directory@main' # valid complex component
  - component: 'gdk.test:3000/root/test-project/secret-detection@main' # valid simple component
  - component: 'gdk.test:3000/root/test-fetching-component/another-directory/test-template@main' # invalid
  - component: 'gdk.test:3000/root/test-fetching-component/another-directory/another-directory-2@main' # invalid

You should get an invalid error for the second component, like the screenshot above.

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 Laura Montemayor

Merge request reports