Think. Build. Salesforce Solutions.

Salesforce Consulting Services across Salesforce Clouds & Across App Lifecycles

Blog

Automating Salesforce Deployments: Gearset CI/CD in Action with GitHub

By |2024-02-21T07:35:25+00:00February 21st, 2024|

Automating Salesforce deployments is a crucial aspect of managing and maintaining Salesforce applications efficiently. Implementing Continuous Integration and Continuous Deployment (CI/CD) practices can help streamline the development and deployment process, ensuring faster and more reliable releases.

In this guide, we’ll walk through the integration of Gearset, a popular Salesforce deployment tool, with GitHub, a widely used version control system. This integration will enable a seamless CI/CD pipeline for Salesforce applications, allowing you to automate the deployment process and reduce the risk of errors.

Prerequisites:

1. Create/Have two Salesforce accounts (Source Org and Target Org).

  • Visit the Salesforce website at https://login.salesforce.com/?locale=in
  • Click on “Try for Free,” choose the account type, and input personal and company information.
  • Create a unique username and password, provide your phone number, agree to terms and conditions, finish setup by configuring security settings and organization details, and review the entered information for accuracy.
  • Finally, confirm the registration to access your new Salesforce account.

2. Create/Have a Gearset account

  • To create a Gearset account, visit the Gearset website https://app.gearset.com/landing-page
  • Click on “Sign Up” or “Create Account,” fill in the required information including your email, create a secure password, and agree to the terms of service.
  • Complete any additional setup steps prompted by Gearset, such as organization details or preferences.
  • Once done, you can log in with your newly created credentials and access your Gearset account for continuous integration and deployment in Salesforce environments.

3. Create/Have a GitHub account

  • Go to the GitHub website https://github.com/, click “Sign up,”.
  • Input your username, email address, and password
  • Verify your email, customize your profile, and start collaborating on projects by creating or contributing to repositories.

4. Basic understanding

Here are the steps for Automating Salesforce Deployments: Gearset CI/CD in Action with GitHub.

Step 1: Source Control and Services

To link your GitHub repository with Gearset for Salesforce version control and deployment, follow these steps:

  • Open Gearset: Launch the Gearset application.
  • Navigate to Source Control and Service: Locate the Source Control settings or a section related to version control within Gearset.
  • Choose GitHub Integration: Select the GitHub integration option within the Source Control settings.
  • Provide GitHub Credentials: Enter your GitHub credentials when prompted by Gearset. This step is crucial for establishing a secure connection between Gearset and your GitHub account.

These steps ensure a seamless integration between your GitHub repository and Gearset, facilitating version control and deployment processes for your Salesforce.

gearset salesforce

Step 2: Continuous Integration with Gearset.

Implementing Continuous Integration (CI) with Gearset is a strategic approach to automate and streamline the development and deployment processes for Salesforce projects. Follow these steps to set up Continuous Integration with Gearset.

  • Open Gearset: Launch the Gearset application to access the tools needed for Continuous Integration.
  • Navigate to Continuous Integration: Within Gearset, find the Continuous Integration/Continuous Deployment (CI/CD) settings or a related section.
  • Create a CI Job in Gearset: Inside Gearset, navigate to the CI/CD (Continuous Integration/Continuous Deployment) section. Create a new CI job, specifying the source (e.g., your GitHub repository) and the target Salesforce environment where you want to deploy changes.

Salesforce Gearset

  • Deployment Behavior: In the deployment behavior step, configure settings, select deployment options, define deployment strategy, set post-deployment actions, and review before next.

gearset salesforce deployment

  • Test: In the testing step of Gearset’s Continuous Integration, select Salesforce’s default tests in the “Run Tests” section for Apex unit tests. Additionally, Don’t run any tests in the “Tests to Run” section for automated UI tests, and review before next.
  • Metadata Filters: Within the Metadata Filter tab, establish the specific filter for the CI job, determining the metadata types that the job will compare and deploy between the designated orgs. This configuration enables precise control over the types of metadata being considered in the Continuous Integration process, and review before next.
  • Deployment Gates: In CI jobs, set up Deployment Gates by selecting a Static Code Analysis ruleset. If the job fails based on these rules, validation will be halted, ensuring that only code meeting specified quality standards progresses in the deployment pipeline, and review before next.
  • Outgoing Webhooks: Establish outgoing webhooks for external notifications.
  • Advanced: Explore advanced settings for further customization.
  • Notification: Configure notification preferences for the job.

Following these steps, click “Save” to create the job then.

The following dialog box will prompt you to add a webhook.

Salesforce Gearset

By selecting “Add Webhook,” the system will automatically generate the webhook in your Version Control System (VCS) with all the necessary permissions correctly configured.

Gearset Salesforce

Step 3: Compare and Deploy.

Gearset allows the comparison of two metadata sets, such as Salesforce orgs, Salesforce DX scratch orgs, source control repositories (like GitHub), or local folders. This feature enables users to identify configuration differences efficiently.

  • Open Gearset: Launch the Gearset application to access the tools needed for Continuous Integration.
  • Navigate to Compare and Deploy: Within Gearset, find the Compare and Deploy settings or a related section.
  • Select Environments: Salesforce as the source and GitHub as the source control. Specify the org for comparison, integrate with GitHub, and provide credentials for a secure connection.

Gearset Salesforce

  • Choose Metadata Components: Specify the metadata components (objects, fields, workflows, etc.) you want to compare between the selected environments.

Salesforce Gearset

  • Summary of items to Deploy: Before committing changes to a GitHub repository, it is advisable to review and verify all items to ensure accuracy and consistency.

Salesforce Gearset

Commit Successful: Now Successful commit in your GitHub.

Salesforce Gearset

By combining the capabilities of Gearset and GitHub, you can establish a robust CI/CD pipeline for your Salesforce projects. This integration enhances collaboration, accelerates development cycles, and ensures the reliability of your deployments. In the following sections, we will delve into the step-by-step implementation of each aspect mentioned above, providing a practical guide to automating Salesforce deployments with Gearset and GitHub.

Leave A Comment