Splitting your config into multiple files can be useful for increasing readability or splitting responsibilities between teams. Whether you are able to do this depends on the type of organization you have.
To check whether you have a GitHub App organization, you can follow the instructions at the top of this article.
GitHub App Organizations - Yes
For GitHub App organizations, configurations can be split into many different individual files.
You can set this up by generating a new trigger for your project, and selecting the configuration file you want to use.
Full details on how to go about setting this up can be found in our documentation here.
Other Organizations - No
For non-GitHub App organizations, it is not currently 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.
Comments
Article is closed for comments.