Last updated Nov 15, 2024

Update components managed with config as code

Once you set up config as code for a component, the component becomes managed via the compass.yaml configuration file located in its related repository. You can update a managed component by making changes to the compass.yaml file.

You might need to update a managed component for several reasons:

  • You want to add new details or update the existing details of the component.
  • You want move the compass.yaml file to another folder in your repository.
  • Your component’s repository changes and you want to move the compass.yaml file to the new repository so that it is co-located with the component's source code.

Before you begin

Before you update your managed components, make sure you’ve done the following:

Update the details of a component in compass.yaml

A component’s details can change over time. You might want to call it by a different name, assign ownership to a different team, or add links and dependencies. You can update the details of a managed component by updating the component’s compass.yaml file in the source repository.

To update the details of a component that is managed with config as code:

  1. In the source repository, update the details in the compass.yaml file and save the changes.
  2. Push the changes and open a pull request if necessary.
  3. Merge the changes to your repository’s default branch. You’ve now updated the component’s details.
  4. Verify that the changes have been synced by refreshing the component details page in Compass.
    • If a 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 validation

Move compass.yaml to a different location in the same repository

Once a component is managed via config as code, you can move the compass.yaml to a new location within the same repository, without impacting the component’s connection with Compass. Compass maintains the connection via the unique id in the compass.yaml file, even if the compass.yaml file changes location within the repository.

To move the compass.yaml file to a different location within the same repository:

  1. In the source repository, move the compass.yaml file to a new location.
  2. Push the changes and open a pull request if necessary.
  3. Merge the changes to your repository’s default branch.
    • The component remains in sync with the compass.yaml file in its new location.
  4. Verify your changes in Compass.
  5. Reload the component's details page and locate the link under the component name that says Managed by compass.yaml in {name of source code provider}
  6. Select the link and check that the link goes to the file's new location. Ensure that the component is in sync with the compass.yaml file in its new location.

Your component is now managed from the new location in the repository.

Change the repository connected to a managed component

You can change a repository that is connected to a managed component. To do so, you first need to disconnect the component from its current repository and then connect it to a new repository via config as code.

Note the following points about changing a managed component’s repository:

  • Both repositories, the one that is currently connected to the component and the new repository you wish to connect to, must be connected to compass.
  • You’ll need read/write permission on both repositories.
  • During the change, the component briefly becomes unmanaged until you connect it to the new repository. The compass.yaml file you use when connecting it to the new repository overrides any interim changes to the component.
  • The component's unique id in the compass.yaml file must be present to connect the file in the new repository to the corresponding component in Compass.

To change a managed component’s repository:

  1. Make a copy of the compass.yaml file from the component’s current repository.
  2. Delete the compass.yaml file from the component’s current repository.
  3. Push the changes and merge the changes to the default branch.
    • At this stage, the component is temporarily unmanaged, meaning you can edit its details in the Compass UI until you proceed to the next step.
  4. Add the compass.yaml file that you copied earlier to the new repository.
  5. Push the changes and merge the changes to the default branch.
    • The component is now connected to the new repository and is managed via the compass.yaml file in that repository.
  6. Verify your changes in Compass.
  7. Reload the component’s details page then locate the Component manager card.
  8. Select Go to source and check that the link goes to the compass.yaml file’s new repository. Ensure that the component is in sync with the file.

Your component is now managed from the new repository.

Rate this page: