Branch Management Setup

Updated 2 months ago by Copado Solutions

Copado Branch Management is a feature-based license that establishes the connections between orgs to form a sandbox landscape. It allows you to keep Salesforce orgs' metadata and Git branches effortlessly in sync.

As of Summer '19, the calculation is based on user stories and all the steps below are done automatically following the pipeline wizard.

How to Set It Up

Requirements
  • One Git repository.
  • For each environment within your deployment flow, one branch must be created within your Git repository. Note that branch names are case sensitive.
  • All branches must start in sync, all in the same commit id, which will be the common starting point. When creating new branches, all branches must be created from the same 'master' branch.
Setup Steps
  1. Make sure you have Copado Branch Management enabled from the Account Summary tab.
  2. Create the org credentials that will be part of the deployment flow.
  3. Rename the environments (it is strongly recommended to rename the environments with the same name as the branches).
  4. Add Branch Management Permissions to each environment. Make sure the related list is included in the environment layout.
  5. Create a new empty git repository in your git server.
  6. Create a .gitignore file in the master branch (this should be the first file of the repository).
    1. #package.xml file is recreated on the fly by Copado, no need to track
      #unnecessary changes of this file
      package.xml
      #Managed packages can trigger the installation or uninstallation of
      #applications, it is recommended to manage this outside git
      installedPackages/*
      #if you are not customizing a managed package, you can keep your
      #repository clean by ignoring all files for that package.
      #For example, to ignore all files of the "Copado" managed package
      #just add to your .gitignore file the following text: *copado__*
      #if you will be customizing managed packages, make sure that the
      #same version of the package is installed on all your environments
      #so that deployments will only update existing managed components.
      #Creation of managed components is not permitted by the API.
      #It is recommended that you ignore managed components that cannot be
      #modified since there is no need to track them in Git,
      #like for example:
      # classes/copado__*
      # triggers/copado__*
      # pages/copado__*
      #profiles and permission sets are complex Files. If your Org's
      #metadata and Git are in sync, you can track incremental changes on
      #Profiles and Permission sets using Copado "commit files" functionality.
      #Otherwise ignore profiles and permission sets until you are ready for it.
      #You can deploy profiles and permission sets using
      #Copado Deployer steps: Full profiles and Full Permission sets.
      # Below is how to ignore them
      # profiles/*
      # permissionsets/*
      #Translations are complex since get updated indirectly across
      #multiple files, they can make a deployment fail if a field is
      #translated in source and it doesn't exist on destination.
      #If you are committing incrementally new fields and new Translations
      #you can track them in Git, just be careful.
      #If you choose to ignore them in Git, you can always create a deployment
      #with the Copado Deployer "Translation" Step.
      # translations/*
      # objectTranslations/*
      #Sites which has Domain mapping has environment specific information.
      #Make sure you setup Copado Environment Variables to make sites config
      #files environment agnostic.
      #Until the above is achieved, you can ignore them as follows
      # sites/*
      # siteDotComSites/*
  7. Create a Git repository in Copado that connects to the one created in a previous step.
  8. Create a deployment flow (including the repository and the main branch). Make sure these two fields are included in the layout.
  9. Add all the deployment steps by setting the destination org and then the branch.
  10. Create snapshots for each org -> branch (without running them yet).
    1. For master branch, set permissions to Allow Snapshots and Commits.
    2. For all the other branches, set permissions to Allow Commits Only.
  11. Initialize the master branch by running the Git snapshot for the master branch.
  12. On the Git server, create all the branches based on the master branch.
  13. Edit the snapshot for the master branch and set permissions to Allow Commits Only.
  14. From the deployment flow, go to the Release Management page and click on Recalculate. All branches should be displayed in sync after the recalculation.

You are all set! Now you can start creating commits into the different branches and Copado will do its magic.

Be mindful of what you commit into Git. It is better to have many small commits with a proper commit message than committing a bunch of files. Committing all files in bulk is not a good practice and will only lead to conflicts and deployment issues.


How did we do?