Start Building for Free
CircleCI.comAcademyBlogCommunitySupport

Set up multiple configuration files for a project

2 weeks ago2 min read
Cloud
On This Page

You can use multiple configuration files in a CircleCI project and set up separate triggers for each one. Each configuration triggers a separate pipeline on a trigger event. If your existing configuration file is getting too large to manage, consider splitting it into multiple files.

Prerequisites

To use multiple configuration files for a project in CircleCI, you will need to meet the following prerequisites:

1. Add an additional configuration file to your project repository

In the GitHub repository for your project add a new CircleCI configuration file in the .circleci/ directory. Your new configuration file must use the .yml extension but can have any name. Add your required configuration to the file and commit it to your repository.

As your repository is set up as a project in CircleCI, a config.yml file will exist already. If you do not see .circleci/config.yml, check which branch you are on. You may have set this up on a non-default branch during the set up process.

Each configuration file will trigger a separate pipeline so it is important that each configuration file is complete with all necessary elements for the pipeline, for example, version, jobs, workflows, commands, executors, orbs etc.

2. Set up a configuration source

Next, add a new configuration source in your CircleCI project settings.

  1. In the CircleCI web app select Projects in the sidebar

  2. Find your project in the list, click the ellipsis () next to it and select Project Settings

  3. Select Configuration in the sidebar

  4. Click Add Configuration Source

  5. Complete the required form fields:

    • Give your configuration source a descriptive name

    • Ensure GitHub App is selected under Configuration Source

    • Select the same repository as the project you are building

3. Create a new trigger

Next, create a trigger for your new configuration source.

  1. In the CircleCI web app select Projects in the sidebar

  2. Find your project in the list, click the ellipsis () next to it and select Project Settings

  3. Select Triggers in the sidebar

  4. Click Add Trigger

  5. Select GitHub App in the dropdown menu

  6. Click Next

  7. Complete the required form fields:

    • Give your trigger a descriptive name

    • Select your project repository from the dropdown

    • Choose your new configuration source from the "Choose config to run" menu

Conclusion

You have now successfully set up multiple configuration files for your project on CircleCI. Each configuration file will trigger a separate pipeline on the configured trigger events.


Suggest an edit to this page

Make a contribution
Learn how to contribute