rm916463
rm916463

Reputation: 35

Abstract contents of gitlab-ci file to only use "include"

I've a gitlab-ci file that works as is no problem, however, a question has been asked as to whether we can abstract the contents of this file/move this file to another repo and reference the file instead, and once called upon all stages within the file will run.

gitlab-ci.yml file

stages:
  - deployment

test:
  stage: deployment
  trigger:
     include: /reference/to/file.yml

The error I'm receiving is "No stages/jobs for this pipeline" - any help would be greatly appreciated

Upvotes: 0

Views: 626

Answers (1)

Richard
Richard

Reputation: 2355

Try using the full URL to the location of the file:

test:
  stage: deployment
  trigger:
    include:
      remote: 'https://gitlab.com/awesome-project/raw/main/.before-script-template.yml'

See the docs on CI/CD Include Examples, include, and trigger.

Upvotes: 1

Related Questions