Can I split a config into multiple files?

Single Config File

It is not possible to have a config split across multiple files as CircleCI requires a single config file in .circleci/config.yml to start running.

While there are examples of split configs in some open source projects, such as our Orbs, this is generally just to make them more human-readable. Before these can be used the config must be packed with the CLI - this creates a single config.yml file which can be used with CircleCI.

This packing procedure cannot be run as a "pre" step on CircleCI itself as it is not possible to run arbitrary commands before a workflow. Additionally, the workflow itself will not be generated if a valid "whole" config is not found. Config packing must be run locally, with the resulting file checked in to your repo.


Dynamic Configuration As An Alternative

Dynamic configuration uses a setup workflow to determine pipeline parameter values and based on those values a separate config.yml can be triggered even if it doesn't reside in the .circleci/ folder. Using this method, you can create different config.yml files to trigger depending on the computed value of pipeline parameters in the setup workflow in the .circleci/config.yml.


Additional Resources

Was this article helpful?
26 out of 58 found this helpful



Article is closed for comments.