Configuration as code (config as code) allows you to manage Compass component data via a YAML file that is stored in a git repository. Config as code requires the Bitbucket, GitHub, or GitLab app to be installed and configured on your Compass site. With config as code, you declare component details in a compass.yaml
file that sits alongside the source code or configuration for the component itself. The component then becomes a managed component in Compass. You can manage existing components this way or create new components in Compass by simply committing a compass.yaml
file. Learn more about how config as code works.
With config as code, you move the source of truth for Compass component data to a compass.yaml
configuration file in your code repository. Any updates to the YAML file on your repository’s default branch automatically sync back to and reflect in Compass.
You can also create new components by simply committing a compass.yaml
to a git repository.
Some of the benefits of config as code are:
compass.yaml
files with scripts or build jobs to help keep information fresh.Compass currently supports config as code with Bitbucket Cloud, GitHub Cloud, and GitLab.com.
To set up config as code, a Compass admin must first install and configure one of the above-mentioned source code management apps in Compass.
Then, in your git repository, declare a component’s details in a YAML configuration file called compass.yaml
or compass.yml
. Each component should have its own compass.yaml
file. Learn more about the structure and contents of a compass.yaml file.
compass.yaml
file to the default branch (i.e. main or master usually) in your repository. Learn how to manage components with config-as-code.compass.yaml
file is committed.compass.yaml
files in separate subfolders anywhere in your repository structure. This is helpful if you have a monorepo.While it is possible to add multiple repository links to a component, config-as-code will only handle the first link added, as events and data connections may not function properly for the additional links. To prevent this, we recommend making sure only a single repository link is connected so that config-as-code works as expected.
Once you set up config as code for a component, the compass.yaml
file in your repository becomes the source of truth for all the component’s details. You now manage the component by making changes in the compass.yaml
file.
compass.yaml
file. Learn how to update a component managed via config as codeRate this page: