Branching Strategy for Deployments

Overview When an automatic deployment occurs, DCP receives a built event and must deploy the given artifact to the proper environment. Branch strategies help DCP know which environments to target based solely on the Git branch naming convention.

Use Cases

  • As a user, I want to define the environments that my branch is deployed to so that my dev, stage, prod, etc branches are deployed where they are expected.
  • As a user, I want my services to have an initial standard branch pattern-to-env configuration, so my services can be deployed “out of the box”

Teams are encouraged to define branch prefixes aligning with their development and release workflows. For instance, a team working on a refactor may use a branch prefix like "dev/container-refactor" if they would like their change pushed out to test environments. This flexibility in branch naming conventions accommodates project-specific needs.

Default Branch Strategies

All services will receive a set of default branch strategies that should meet the needs of most services. When custom branch strategies are required, contact the DCP Support team.

When the built event arrives, DCP will compare the branch name against each branch strategy in the order they are displayed on the Service Detail page.

View Branch Strategies

On a given service, you will see the list of branch strategies

Manage Branch Strategies

In a future release, DCP will support service owners ability to insert, update and delete their own branch strategies. Please note that images are created in Harbor based on branch patterns, so it is possible that you can create a branch pattern that may build, but does not create imgages, and therefore cannot be deployed by DCP.

Troubleshoting

  • No branch patterns: When no branch strategies exist, the deployment is immediately cancelled.
  • No matching branch strategies - when no strategies are matched to the branch name, the deployment is immediately cancelled.
  • An phase for an environment does not have any releases - when no clusters are found for a given phase/environment, we will cancel the entire deployment so that you can correct the channel or other deployment parameters

In DCP you can

  • Custom Branch Prefixes: Teams define prefixes in line with their development strategies.
  • Deployment Destination Selection: Flexibility in specifying target environments.
  • Detailed Deployment Insights: Access to deployment status, environment details, and timestamps.
  • Deployment Triggers: Teams initiate deployments directly from the portal.
  • Documentation Integration: Links to onboarding resources for branching strategies and best practices.

Transitioning to Branch Strategies

Teams currently using Deployment Strategies will transition to the new strategy. Existing DeploymentStrategies and corresponding branch patterns and target environments are as follows:

  • Development Strategy:
    • Branch Pattern: "main"
    • Target Environments: [Dev, QA]
  • Continuous Delivery Strategy:
    • Branch Pattern: "main" or "master"
    • Target Environments: [Dev, QA, Staging] (will stop at staging and require manual deploy to prod).
  • Continuous Deployment Strategy:
    • Branch Pattern: "main" or "master"
    • Target Environments: [Dev, QA, Staging, Prod, Prod-EU]

Example Branch Prefixes and Target Environments

Example branch prefixes for channel cloud and their resulting target environments:

Branch PrefixTarget Environments
dev/Dev
qa/Dev, QA
stg/Dev, QA, Staging
hotfix/Staging (for evidence), Prod, Prod-EU
main masterDev, QA, Staging (human approve if Continuous Delivery), Prod, Prod-EU, (gov phases)

## Questions

1. What use is Deployment Strategy after we complete this feature? 
    - we can use this for phase querying when branch is main/master
4. Can a user delete all their branch patterns? 
    - No, we will provide a warning.  When no branch patterns match, this will cause automatic deployments to be immediately cancelled. 
5. How does branch pattern design affect manual deployments.  
    - Does not apply.  Manual deployments specify artifact and user can pick Environments.
 



---

<div>
<strong>Version: 0.3.110</strong><br>
Last Updated: 2024-07-01T19:32:00+0000
</div>