Copado Branch Management: How Does It Work?
The deployment flow (with Git repository and branch information) is set up within Copado. A Copado webhook is also added to your Git repository. Every time a commit is received by the Git repository, the commit information is sent to Copado where the following will occur:
- The Git repository is retrieved and the branch divergence will be calculated (commits ahead and behind).
- A local merge (ahead) or pull (behind) of the diverged commits will be attempted between a branch (e.g. Dev2) and its parent branch (in this case Staging).
- If the merge succeeds, a validation-only deployment of the merged content is created (e.g. validation deployment into the Dev1 org).If it fails, the error information will be displayed in the Deployment Errors tab.
- You will be able to see if the validation deployment succeeded or failed as well as the errors if it failed.
- The differences between the branches of the files affected will be available for comparison in the File Differences tab.
- If the validation deployment was successful, you can choose to perform a sync (e.g. Staging content into Dev1). If you click on the Sync button, the deployment is executed (Staging content into the Dev1 org), and only if it is successful, the Staging commit is merged into the destination branch (e.g. Dev1) and the changes are pushed to your Git repository.
Best Practices Tip
Always sync back to lower environments before pushing to production, or once the deployment has been done to production. No new user story feature branch can be created until its environment has been synced. This is to prevent the feature branch from inheriting the latest changes to production into the feature and orgs branch without having actually synced them.
Reviewing File Differences
If Copado Branch Management application detects that there are file differences between two branches, the application performs a local (backend) Git merge between the two branches. Once merged, a validation deployment containing the modified files in the Git merge will be executed automatically. The merged files used in the validation deployment can be found in a zipped attachment in the Deployment Flow Steps record.
When clicking on any of the the promote or back promote icons, you can navigate through the different tabs. By clicking on the File Differences tab you can review the files that are going to be modified in the merge.
For more information about file differences in v8 & under, click here.
Best Practices Validations in CBM Flows
Copado has enabled the following validations:
- All flow steps must have a branch.
- All flow steps must have a source and a destination.
- There are no duplicated branches in the steps.
- There are no duplicated source environments.
- If Enforce branch/env naming convention is set to true, the branch and the source environment must be equal. (case sensitive), e.g. environment name 'UAT' vs. branch name 'UAT'.
How to Use It
If you want to enforce the naming convention between environments and branches, you have to set the Enforce branch/env naming convention checkbox to true.
Validations will apply when you try to activate a CBM flow, when you try to edit an active CBM flow, or when you create or edit a deployment flow step in an active CBM flow.
If you want to disable these best practices enforcement, you can turn off the validations by setting the Disable Validations checkbox to true.