This repository demonstrates the basic usage of the orb circle-makotom-orbs/config-splitting
.
- Fork this repository.
- Go to https://app.circleci.com/settings/project/github/YOUR_GITHUB_ORG_NAME/circle-combine-split-config/advanced and enable the option "Enable dynamic config using setup workflows".
- Go to https://app.circleci.com/settings/project/github/YOUR_GITHUB_ORG_NAME/circle-combine-split-config and hit the "Follow Project" button there. This action will trigger the first pipeline for your forked project.
Then you will find that the first pipeline has generated 3 workflows: setup
, A-main-workflow
, and B-main-workflow
, which are defined in .circleci/config.yml
, subdir-a/.circleci/config.yml
, and subdir-b/.circleci/config.yml
, respectively.
- There are 2 "modular" configs:
subdir-a/.circleci/config.yml
andsubdir-b/.circleci/config.yml
. Note that these "modular" configs are syntactically valid CircleCI configs, except that these can reference resources defined in the "shared" config (an injected config explained in the below). - The "modular" configs to be combined are listed in
.circleci/modular-config-list.txt
. .circleci/config.yml
defines thesetup
workflow. Thesetup
workflow callsrun-all-modular-configs
job of the config-splitting orb, and combines the configs listed in.circleci/modular-config-list.txt
(which is specified inconfig-list-file
parameter).- Optional:
run-all-modular-configs
injectscontinue-shared.yml
into the combined config. This will let "modular" configs listed in.circleci/modular-config-list.txt
to reference resources (commands, jobs, etc.) defined in the single "shared" config, avoiding common config stanzas appearing in each "modular" config. - The combined config generated by the
setup
workflow is passed back to CircleCI and then is executed accordingly.