Rate this page:
Configuration as code (config as code) is an automated method of maintaining Compass component data in a Git repository. You can choose to declare component details in a YAML file that sits alongside the source code for the component itself. Learn more about how config as code works
Compass currently supports config as code with Bitbucket Cloud, GitHub Cloud, and GitLab.com. After integrating Compass with a source code provider, you can set up config as code for a component existing in Compass by declaring its details in a compass.yaml
file that lives in the source repository. Any updates to the compass.yaml
on your repository’s default branch automatically sync back and are reflected in Compass. The component becomes a managed component.
Here, we’ll take you through the process of setting up config as code for a component existing in Compass and also show you how you can manage multiple components from the same repository.
Before you set up config as code, make sure you’ve done the following:
Create your component in Compass or import it from other apps. Before setting up config as code for a component, you must first create it in Compass.
Install and configure a source code provider app for Compass. You must be an admin of the source code provider workspace/organization and your Compass site to perform this step.
Verify that you can access the source code provider workspace/organization configured for Compass and you have read and write permissions on the repositories within that source code provider.
Have some basic experience with using Git and familiarize yourself with adding and editing files in Bitbucket Cloud or GitHub. Learn how to add, edit, and commit to source files in a Bitbucket repository or learn how to manage files in GitHub
Have a basic understanding of YAML file structures.
Familiarize yourself with the structure and contents of the compass.yml file.
Managing a component with config as code requires you to perform the following steps:
compass.yaml
file.compass.yaml
file to your repository in your source code provider and commit your changes to the default branch.The first step to manage a component via config as code is to prepare the compass.yaml
configuration file.
To prepare the compass.yaml
file:
compass.yaml
file containing the component’s details that are already available in Compass.compass.yaml
file.After you prepare your compass.yaml
file, the next step is to add it to your repository and merge the changes with the default branch.
To add the compass.yaml
file to your repository in your source code provider:
compass.yaml
file to the component’s repository.
The last step is to verify that your component in Compass is managed via config as code.
To verify your managed component in Compass:
In Compass, reload the component’s details page.
compass.yaml
file in your source code provider. It may take a few seconds after you merge your changes for this to take effect.compass.yml
file is invalid, Compass rejects the update for that component. You’ll know there is a problem if the component details aren’t updated in Compass within a few seconds. Check the contents of the file, fix any errors, and merge your changes with the repository’s default branch. Learn more about file validationVerify that the information from the compass.yaml
file reflects correctly in the component’s details in Compass.
Select Component settings in the left side menu.
Select Go to compass.yaml. The compass.yaml
file in the repository opens.
Verify that the link between the component and its corresponding compass.yaml
file is correct.
Your component is now managed with config as code.
From here onwards, every time you update the compass.yaml
file and commit those changes to your repository’s default branch, the changes automatically sync back to Compass and are reflected in your component’s details. Learn how to update a component managed via config as code
At any time, you can disconnect a managed component from config as code and start managing it again from the Compass UI.
You can manage multiple Compass components from a single source code provider repository.
The procedure is the same as managing a single component with config as code, but you must include a separate compass.yaml
file for each component and the files must reside in separate subfolders within the repository.
To manage multiple components in a single repository:
compass.yaml
file for each component. Learn how to prepare the file
id
, which distinguishes one file from another and connects them to the correct components in Compass.compass.yaml
file from its respective subfolder.compass.yml
file is invalid, Compass rejects the update for that component. You’ll know there is a problem if the component details aren’t updated in Compass within a few seconds. Check the contents of the file, fix any errors, and merge your changes with the repository’s default branch. Learn more about file validationFrom here onwards, you can update a component managed with config as code.
At any time, you can disconnect a managed component from config as code and start managing it again from the Compass UI.
Each component in Compass has a unique, unchangeable identifier (ID). Compass assigns each component an ID when you create it. You can find a component's ID on the component's details page in Compass.
If you’re using config as code to manage components, you’ll notice that components are referred to by their unique id
in several places in the compass.yaml
configuration file. Both the component itself and any other components that it depends on are referred to by their unique IDs. Learn more about the structure and contents of a compass.yaml file
To find a component’s ID:
The component’s ID is copied to your clipboard.
When using the id
in a compass.yaml
file, enclose the entire text of the id
in single quotes. For example:
1 2id: 'ari:cloud:compass:00000000-0000-0000-0000-0000:component/0000-0000-0000-0000-000000000000/00000000-0000-0000-0000-0000'
Each team in Compass has a unique, unchangeable identifier (ID). Compass assigns each team an owner ID when you create it. You can find a team’s owner ID on the team’s dashboard in Compass.
If you’re using config as code to manage components, you’ll notice that teams are referred to by their unique ownerId
in the compass.yaml
configuration file. Learn more about the structure and contents of a compass.yaml file
To find a team’s owner ID:
The owner ID is copied to your clipboard.
When using the ownerId
in a compass.yaml
file, enclose the entire text of the ownerId
in single quotes. For example:
1 2ownerId: 'ari:cloud:teams::team/00000000-0000-0000-0000-000000000000'
Rate this page: