Overview
CloudBees Feature Management Configuration as Code (CasC) synchronizes flags, flag configurations, custom properties, and target groups between the CloudBees Unify UI and a .cloudbees/casc/feature-management/ folder in a connected Git repository. This synchronization is bidirectional, but the initial sync when a repository is first connected is not a merge: CloudBees Unify inspects the state of the application (in the UI) and the repository (branch and .cloudbees folder) at connection time, then makes one side match the other.
Connecting a repository in the wrong order can permanently delete flags, custom properties, and other elements, in CloudBees Feature Management, with no merge or confirmation prompt. This article describes the data-loss scenarios observed and the recommended order of operations to avoid them.
Recommendations
Connect an empty application to a repository that already has a main branch
Connect an application that has no flags, custom properties, or other elements configured in the UI to a repository that already contains a main branch but does not yet contain a .cloudbees folder.
Why this matters:
-
CloudBees Unify creates the
.cloudbeesfolder (and required subfolders) in the repository automatically and commits it. -
Elements that already exist in the UI, if any, are written into the new
.cloudbeesfolder as files.
After the folder is created, add or edit flags, custom properties, and other elements directly in the repository’s .cloudbees folder. These changes sync to the UI automatically.
Do not create the main branch on a connected repository that already has elements in the UI
If a repository without a main branch is connected to an application that already has flags, custom properties, or other elements configured in the UI, do not create the main branch in that repository while the connection is active.
|
Creating |
If the application already has elements configured in the UI, create and populate the main branch before connecting the repository to the application.
Implementation
To connect a repository to CloudBees Feature Management CasC without losing data:
-
Confirm the target repository has a
mainbranch. -
Confirm the target repository’s
mainbranch does not yet contain a.cloudbeesfolder, unless its contents already match the elements configured in the application. Please refer to article_name for further details regarding this particular use case. -
Connect the repository to the application.
-
Verify that CloudBees Unify commits a new
.cloudbeesfolder to the repository, or that existing UI elements now appear as files under.cloudbees/casc/feature-management/. -
Make further changes to flags, custom properties, and other elements directly in the repository, or in the CloudBees Unify UI. Both directions sync automatically after the initial connection.