Last updated Aug 23, 2021

Rate this page:

Update components managed with config as code

Once you set up config-as-code for a component, the component becomes managed via the compass.yml configuration file located in its related Bitbucket repository. You can update a managed component by making changes to the compass.yml 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.yml file to another folder in your repository.
  • Your component’s repository changes and you want to move the compass.yml 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.yml

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.yml 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.yml file and save the changes.
  2. Push the changes to Bitbucket and open a pull request if necessary.
  3. Merge the changes to your repository’s default branch in Bitbucket. 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.yml to a different location in the same repository

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

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

  1. In the source repository, move the compass.yml file to a new location.
  2. Push the changes to Bitbucket and open a pull request if necessary.
  3. Merge the changes to your repository’s default branch in Bitbucket.
    • The component remains in sync with the compass.yml file in its new location.
  4. Verify your changes in Compass.
  5. Reload the component's details page the locate the Component manager card.
  6. Select Go to source and check that the link goes to the file's new location. Ensure that the component is in sync with the compass.yml 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 reside in the same Bitbucket workspace.
  • 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.yml file you use when connecting it to the new repository overrides any interim changes to the component.

To change a managed component’s repository:

  1. Make a copy of the compass.yml file from the component’s current repository.
  2. Delete the compass.yml file from the component’s current repository.
  3. Push the changes to Bitbucket 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.yml file that you copied earlier to the new repository.
  5. Push the changes to Bitbucket and merge the changes to the default branch.
    • The component is now connected to the new repository and is managed via the compass.yml 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.yml 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: