Start Building for Free
CircleCI.comAcademyBlogCommunitySupport

Set up multiple configuration files for a project

1 month 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 pipeline

Next, add a new pipeline in your CircleCI project settings.

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

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

  3. Select Pipelines in the sidebar

  4. Select Add Pipeline

  5. Complete the required form fields:

    • Give your pipeline a descriptive name

    • Ensure GitHub App is selected under Pipeline

    • If you see a Connect button, select it and follow instructions to install the GitHub App for your org.

    • Select the same repository as the project you are building

  6. Select Save

3. Create a new trigger

Next, create a trigger for your pipeline.

  1. Following from the previous step, select Triggers in the sidebar

  2. Select Add Trigger

  3. Select GitHub App in the dropdown menu

  4. Select Next

  5. Complete the required form fields:

    • Give your trigger a descriptive name

    • Select your project repository from the dropdown

    • Choose your new pipeline from the "Choose config to run" menu

  6. Select Save

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. Push a commit to your code to test this out. You should see both pipelines trigger in the CircleCI web app Pipelines page.


Suggest an edit to this page

Make a contribution
Learn how to contribute