How to use CI/CD files from another project

Problem to solve

We have common CI/CD logic in our Company/Build/DevOps repository. Our various Company/foo repositories reuse the CI/CD logic by adding the following to the top of the .gitlab-ci.yml file.

include:
    - project: 'Company/Build/DevOps'
      ref: ${CI_REF_BRANCH}
      file: 'Gitlab/ci_cd/all.gitlab-ci.yml'

I have a personal repository on the server at Rocha/grpc-example and I would like to re-use some of the CI/CD logic from our devops repository.

When I attempt to use the above I get an invalid yaml error

Unable to create pipeline
Project `company/build/devops` reference `` does not exist!

Aside from the fact that it doesn’t work, there is the aspect that the error has changed the case of the reference from Company/Build/DevOps to company/build/devops.

What can I do so that my personal repository can re-use the CI/CD logic we’ve already established? Is this a limitation, where personal repos cannot use/reference CI/CD logic from standard repos?

I could easily see that for potential security reasons, but I didn’t see anything that explicitly stated this limitation.

I’m questioning if I have something set incorrectly in my repository.

Versions

Please select whether options apply, and add the version information.

Self-managed: v17.0.0-ee

1 Like

any solution about it ?

No solution has been shared or discovered.

try

include:
  - project: '$CI_PROJECT_ROOT_NAMESPACE/devops/mysonar'
    ref: 'feature/component-sonar'
    file: '/templates//gitlab-ci-sonar.yml'

Thank you for the suggestion, but that doesn’t work. That ends up using my name as the root rather than our instance.

I tried the following:

include:
    - project: 'Stratovan/Build/DevOps'
      ref: ${CI_REF_BRANCH}
      file: 'Gitlab/ci_cd/all.gitlab-ci.yml'

And this results in and error message of

 This GitLab CI configuration is invalid:
Project `rocha/stratovan/build/devops` not
found or access denied! Make sure any includes
in the pipeline configuration are correctly defined.. Learn more

My company has a self deployed instance of Gitlab.

I’m trying to test/play with official pipeline code in my personal repository that is also on the company Gitlab.

I’m an admin so I believe I have all the permissions.

This makes me want to look at other CI variables thought… maybe there is a similar one…

To add more… this is the “path” for the test repo

image

https://git.stratovan.com/rocha/pipelinetests

And this is the path to the standard repository we have

image

https://git.stratovan.com/Stratovan/Build/DevOps