Search code examples
gitlabyamlgitlab-ci

GitLab CI manual start of pipeline with only include


I have a pipeline with only include like this

---
include:
  - project: "test/devops/gitlabci-templates"
    ref: "2.0"
    file: "templates/terraform/all.yml"

is there a way to add rules or trigger it manually instead of starting it on every push?


Solution

  • include:s support use of rules:. You can do this directly on the template include, or you can do it for the jobs specified in the template.

    include:
      - project: "test/devops/gitlabci-templates"
        ref: "2.0"
        file: "templates/terraform/all.yml"
        rules:
          - if: '$CI_PIPELINE_SOURCE == "web"'