Not being able to include gitlab-ci template from private project

Hello and good day.

I would like to be able to include a template gitlab-ci file in project A which is located in another private project B. I am including the file via

include:
    remote: "https://gitlab-ci-token:$CI_JOB_TOKEN@gitlab.com/group/templates/project-b/raw/main/.gitlab-ci-spring-boot-template.yml"

I went into the CI/CD settings in project B and gave the CI_JOB_TOKEN of project A access to project B.

Still I am getting the error:

  • Remote file https://gitlab-ci-token:@gitlab.com/socialpals/templates/gitlab-spring-boot-ci-template/raw/main/.gitlab-ci-spring-boot-template.yml could not be fetched because of HTTP code 403 error!

Is there a simple way to access files for a repo directly via HTTP GET with Basic Auth wich works in this case?

Thank you

Hi @sebmezza

If it’s on the same GitLab instance you can just use:

include:
- project: 'group/templates/project-b'
  file: '/.gitlab-ci-spring-boot-template.yml'
1 Like

Thank you sooo much @balonik ,

I probably overread that in the documentation and it solved my problem and the builds are working like a charm. Thank you again and have a great day!