Skip to content
GitLab
Next
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • GitLab GitLab
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 44,758
    • Issues 44,758
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 1,331
    • Merge requests 1,331
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.orgGitLab.org
  • GitLabGitLab
  • Issues
  • #26793
Closed
Open
Issue created Feb 17, 2019 by King Chung Huang@kinghuang

Allow a list of files in CI include:file syntax

Release notes

Previously when adding multiple files using the include:file syntax you would have to specify the project and ref for each file. In this release, we've added support to accept a list of files, so now you can specify the project and the ref once and provide a list of files, this way you save you time so you wont not need to repeat yourself and will make the pipeline configuration less verbose.

include:
  - project: devops/ci-cd/pipelines
    ref: latest
    file: 
      - terraform/terraform.yml
      - terraform/deploy/continuous.yml
      - ...

Problem to solve

GitLab 11.7 introduced the include:file syntax for including a file from another project in CI configurations. It currently accepts a single file. In my GitLab instance, I have a GitLab project that holds a collection of CI configurations for all projects, and it is common for projects to include multiple files.

The include:file syntax only allows a single file to be included. It would be useful if it allowed multiple multiple files to be specified.

Target audience

  • Sasha, Software Developer, https://design.gitlab.com/research/personas#persona-sasha
  • Devon, DevOps Engineer, https://design.gitlab.com/research/personas#persona-devon

Further details

Here is an example of two files being included from one common project and ref.

include:
  - project: devops/ci-cd/pipelines
    ref: latest
    file: terraform/terraform.yml
  - project: devops/ci-cd/pipelines
    ref: latest
    file: terraform/deploy/continuous.yml

Proposal

The include:file syntax should accept a list of files. That way, the project and ref don't have to be repeated, reducing the likelihood of errors and making changes easier.

include:
  - project: devops/ci-cd/pipelines
    ref: latest
    file: 
      - terraform/terraform.yml
      - terraform/deploy/continuous.yml

This requires refactoring of the files at: https://gitlab.com/gitlab-org/gitlab/-/tree/master/lib/gitlab/ci/config/external and we should count each file from the project: entry as a separate entry for max limit of includes(the example above should still consume 2 entries in the list form)

What does success look like, and how can we measure that?

When a GitLab project includes multiple CI files from a common source project and ref, the local .gitlab-ci.yml file should be DRY by not repeating the project and ref for every single file.

Links / references

include:file

gitlab-ce!24101

gitlab-ce!24098

Edited Nov 04, 2020 by Dov Hershkovitch
Assignee
Assign to
Time tracking