Unable to Use Mirrored Component - "the component path is not supported"

My company uses a self-hosted instance of GitLab. We’d like to use some of the official
GitLab CI/CD components, but we discovered that we cannot use them directly. To solve this,
I have created a mirror repository for each component and added them to our components’ repository. However, I’m having some trouble adding these to our CI/CD catalogue.
Using SAST as an example, here are the steps I’ve tried so far and the problem I’m facing.

Created the SAST Mirror

I created the mirror repository for the GitLab SAST component at https://gitlab.myorg.com.au/development/mirrors/gitlab-sast-component. This is
working fine and is regularly updated.

Created the Component Repository

Created a component project at https://gitlab.myorg.com.au/development/components
with some custom components that we’re already using. These are registered in the
CI/CD catalogue and are already being used in other projects.

Adding the Mirrored Component

In the development/components repository, I created a new templates/sast/template.yml file. This is what it looks like.

spec:
  inputs:
    enable_mr_pipelines:
      default: false
      type: boolean
    excluded_analyzers:
      default: ""
    excluded_paths:
      default: "spec, test, tests, tmp"
    image_prefix:
      default: "$CI_TEMPLATE_REGISTRY_HOST/security-products"
    image_suffix:
      default: ""
    image_tag:
      default: "6"
    include_experimental:
      default: false
      type: boolean
    run_advanced_sast:
      default: false
      type: boolean
    run_advanced_sast_cpp:
      default: false
      type: boolean
    run_kubesec_sast:
      default: false
      type: boolean
    search_max_depth:
      default: 4
      type: number
    stage:
      default: test
    advanced_sast_partial_scan:
      description: "Configures the scan mode for Advanced SAST in merge requests. Set to 'differential' to scan only modified files and their dependencies, improving performance."
      default: ""

---
include:
  - component: $CI_SERVER_FQDN/development/mirrors/gitlab-sast-component
    inputs:
      stage: $[[ inputs.stage ]]
      enable_mr_pipelines: $[[ inputs.enable_mr_pipelines ]]
      excluded_analyzers: $[[ inputs.excluded_analyzers ]]
      excluded_paths: $[[ inputs.excluded_paths ]]
      image_prefix: $[[ inputs.image_prefix ]]
      image_suffix: $[[ inputs.image_suffix ]]
      image_tag: $[[ inputs.image_tag ]]
      include_experimental: $[[ inputs.include_experimental ]]
      run_advanced_sast: $[[ inputs.run_advanced_sast ]]
      run_advanced_sast_cpp: $[[ inputs.run_advanced_sast_cpp ]]
      run_kubesec_sast: $[[ inputs.run_kubesec_sast ]]
      search_max_depth: $[[ inputs.search_max_depth ]]
      advanced_sast_partial_scan: $[[ inputs.advanced_sast_partial_scan ]]

As I understand it, the idea is to just expose the mirrored component and available inputs.

Then, in .gitlab-ci.yml, I’ve added the following line

include:
  # Other components...
  - component: $CI_SERVER_FQDN/$CI_PROJECT_PATH/sast@$CI_COMMIT_SHA

I pushed my branch and created an MR. However, the pipeline fails with this message.

Unable to create pipeline

  • Component ‘gitlab.myorg.com.au/development/mirrors/gitlab-sast-component’ - the component path is not supported

I’m not sure what I’ve done wrong, or if what I’m trying to achieve is even possible. Any help would be greatly appreciated.

Thanks!

P.S. As this is a mirrored repositroy, I’m not sure how to use versioning with the component. Do I just use the tag?

---
include:
  - component: $CI_SERVER_FQDN/development/mirrors/gitlab-sast-component
    inputs:
      stage: $[[ inputs.stage ]]

Components always need a version. Make it gitlab-sast-component@main at least.

Thanks, @GreenZombie76.
I tried both of these

include:
  - component: $CI_SERVER_FQDN/development/mirrors/gitlab-sast-component@main

And the latest tag

include:
  - component: $CI_SERVER_FQDN/development/mirrors/gitlab-sast-component@3.1.0

They both resulted in the same (but new) error.

Unable to create pipeline

  • Component ‘gitlab.aussiebb.com.au/development/mirrors/gitlab-sast-component@main’ - content not found

Is this project https://gitlab.myorg.com.au/development/mirrors/gitlab-sast-component marked as CI/CD Component project in the settings and exported to the catalog following CI/CD components | GitLab Docs

gitlab.myorg.com.au/development/components/gitlab-sast-component is a mirror of gitlab.com/components/SAST

the SAST component contains a templates folder with sast.yml and iac-sast.yml so the proper component links on gitlab.com would be (the component name includes the yaml file name without the suffix or templates prefix):

```

include:
- component: $CI_SERVER_FQDN/components/SAST/iac-sast@version
- component: $CI_SERVER_FQDN/components/SAST/sast@version

As you have mirrored this to a new location, your links would be:

include:
- component: $CI_SERVER_FQDN/development/mirrors/gitlab-sast-component/iac-sast@main
#or
- component: $CI_SERVER_FQDN/development/mirrors/gitlab-sast-component/sast@main

or @3.1.0 etc.

1 Like

Hi @dnsmichi,

That project has the General Settings > Visibility, project features, permissions > CI/CD Catalog project option turned on, yes.

@GreenZombie76
Using

include:
  - component: $CI_SERVER_FQDN/development/mirrors/gitlab-sast-component/sast@main

worked! Thank you so much for your help.

1 Like