Support multiple files in .circleci folder

We are migrating to a mono-repo setup for a number of previously separate codebases, and our CircleCI config file has grown to many hundreds of lines. Now that config is within a `.circleci/` directory, is there an opportunity to split up the config file into multiple pieces to make it more comprehensible?


There was a similar feature request files here previously:

  • Aaron Taylor
  • Feb 23 2018
  • Taking votes
  • Attach files
  • Roopak Venkatakrishnan commented
    14 Apr 02:58

    I recently wrote about an easy way to split your yml file here:

  • Agam More commented
    07 Apr 09:49

    I'm currently doing this with the following structure and script (doesn't allow aliases atm):

    #!/usr/bin/env bash
    echo "Packing all YAML files..." && \
    circleci config pack ./.circleci/ci > ./.circleci/config.yml && \
    echo "Done packing." && echo "Validating compiled config.yml" && circleci config validate

  • Guest commented
    28 Feb 16:25

    Just noticed this related idea:

  • Guest commented
    28 Feb 16:21

    We often will have application code and library code in the same repo. It would be nice to be able to treat these as different workflows in CircleCI. I we commit a change in the library code it would trigger the library workflow and if we commit a change in the application code it would trigger the application workflow. As it is now, we have to separate them into different repositories.

  • Amram Ben David commented
    10 Feb 16:59

     I would like this feature as well

  • Ian Rose commented
    December 12, 2019 13:17

    > How about orbs instead?


    Being able to simply #include another file (or similar) is miles simpler than using Orbs.  I want to empower everyone on our engineering team to make changes to the build as necessary, but I definitely don't want everyone to have to learn how to interact with Orbs.  Most people just need to make a relatively small change to a shell command in our config.

  • Timothy c commented
    December 03, 2019 16:26

    How about orbs instead?

  • Jeff Hudson commented
    September 04, 2019 01:30

    We recently hit 1000 line config and there is little to no duplication. I would love to see this too.

  • Owein Reese commented
    June 26, 2019 13:27

    Yeah, much like Ansible or other "programming  languages" (ugh, hate describing it like this,) could you add in `import` support?

  • Sam S commented
    June 17, 2019 23:27

    If anyone wants to do this right now, this repo I just published makes it easy to generate a single config.yml from many, and just uses the circleci-cli tool under the hood to pack and process files. It even lets you use circleci 2.1 syntax, including orbs, on CircleCI Enterprise, by compiling them at dev time down to fully expanded 2.0 syntax: 

  • Sergio Moya commented
    May 01, 2019 21:52

    It should be a great enhancement because you may have many complex process happening on ci, so is important to keep those process in order.

  • John B commented
    January 30, 2019 09:11

    Just the ability to include other files would be nice. But something like Orbs but just with local & private files would be great. We need to be able to treat pipeline config as proper code.

  • Thomas Edwards commented
    October 22, 2018 15:44

    Same thing happened to us. We’re moving to one repo, but we have five projects running in it. A config file per project would be great, plus a master one. Maybe a file for each job in a `jobs` folder, and then a `workflows.yml` to tie them together.

  • Guest commented
    August 23, 2018 15:33

    yeah I would love to see that feature too