Skip to main content

Adding environments to your Gitflow pipeline

How to configure each environment in your Gitflow pipeline.

Written by Jacob Joshua
Updated this week

When your pipeline is created, it contains three stages that map directly to the Gitflow branching structure: Integration, Release & Testing, and Production.

This article walks you through adding environments to each stage.

Integration

This stage maps to your designated develop branch and is where all individual feature work is integrated.

Add your Integration environment

  1. Select Add environment in the middle of the Integration stage:
    ​

  2. Choose to create a new CI job or select an existing one:
    ​


    If selecting an existing job, it must meet all of the following conditions:

    • The source is git with the repository matching the pipeline's repository, and the target is a Salesforce org.

    • The source branch is the same as your designated develop branch.

    • Run job is set to when the source branch is updated and a webhook has been added as the trigger for the job.

    • The CI job is not used in any other pipeline.

  3. Follow the remaining steps as outlined here.

Add your developer sandboxes

  1. Select Add in the top right corner, then choose Add developer sandbox:
    ​

  2. Give the sandbox environment a name and then select the corresponding sandbox from the list. From there, you can either assign the sandbox to yourself or another member of your team before pressing Save:
    ​

Repeat this step for the remainder of your sandboxes.

Release & Testing (Optional)

This stage maps to the release branch and is where the release is tested before opening a pull request against production. If you are unsure whether your team needs a Release & Testing environment, refer to this section for guidance on how this stage fits into the branching structure.

Add your release environment

  1. Select Add environment in the middle of the Release & Testing stage.

  2. You must create a new CI job at this stage. Existing CI jobs cannot be used here.

    • Unlike the Integration stage, you do not pick a source branch for this environment's CI job. Gearset automatically handles the creation and deployment of short-lived release branches, eliminating the need to manage long-lived environment branches at this stage.

  3. Follow the remaining steps as outlined here.

Once you add an environment in this stage, you may see a branch in your VCS named gs-gitflow-baseline-release. Gearset creates this branch to run an empty baseline deployment, allowing your release branch deployments to benefit from Delta CI. This branch should not be edited or removed. If you need to delete and recreate the release environment, you must delete this baseline branch in your VCS before creating a new CI job in this section, otherwise the setup will not complete successfully.

Production

This stage maps to main and is where the release is deployed to production.

Add your production environment

  1. Select Add environment in the middle of the Production stage.

  2. Choose to create a new CI job or select an existing one. If selecting an existing job, it must meet all of the following conditions:

    • The source is git with the repository matching the pipeline's repository, and the target is a Salesforce org.

    • The source branch is the same as your designated main branch.

    • Run job is set to when the source branch is updated and a webhook has been added as the trigger for the job.

    • The CI job is not used in any other pipeline.

  3. Follow the remaining steps as outlined here.

You should now have a complete pipeline. The next steps are to start creating and promoting features into your Integration environment.

Did this answer your question?