Skip to main content

DevOps to Retrieve Org in BitBucket

Groundswell Team
On , In Tips & Tricks

Groundswell identified a need for an easier way for various DevOps teams to adapt to SFDX based CI/CD, and therefore created GS DevOps Mate, our Open Source, first-of-its-kind deployment tool. If you are familiar with this tool already, then you are in the right place! If not, feel free to read our previous blog posts below:

  1. Introducing GS DevOps Mate
  2. Part Two in the series: Features and Unique Benefits 
  3. Step by Step guide to configuring 

Steps:

  1. Runtime Configuration
  2. Define Repo Variables
  3. Configure A Pipeline
  4. Test the Pipeline
  5. Schedule the Pipeline

Runtime Configuration

Please refer to How to Configure GS DevOps Mate for Bitbucket Pipelines blog post for blog Build Runtime Configuration section.

Define Repo Variables

  1. Go to Pipelines => Repository Variables
  2. Define these variables with the following values:

PROD_ORG_TYPE: PRODUCTION

PROD_ORG_USERNAME: Username for a QA Org user with enough rights to deploy, Create, Read and Update custom settings data, preferably someone like System Administrator

PROD_ORG_PASSWORD: Password and Security Token concatenated for the above user 

e.g mySecretPasswordmySecretToken

LOGGING_LEVEL: debug

MANIFEST_VERSION: 51.0 or the latest version of package.xml

Configuring DevOps Mate to Retrieve Org metadata in BitBucket Repository variables

Configure A Pipeline

In the bitbucket-pipelines.yaml file, add the following pipeline step to retrieve the full org.

Configuring DevOps Mate to Retrieve Org metadata in BitBucket and configuring a pipeline

Step One:

 Checkout master branch ( you can configure any feature branch to act as a backup branch)

Step Two:

Use GS Devops mate command sfRetrieve fullOrg-sfdx to retrieve the Production org metadata ( you can configure any org to retrieve the metadata)

Step Three:

Add all the retrieved metadata to git

Step Four:

Commit the added metadata to git

Step Five:

Push the committed metadata to bitbucket server

Step Six:

We have identified a couple of metadata not supported by the sfdx retrieve command, which we need to specify in the repo explicitly.

In master branch => Add file => Give the name ignoreMetadataList.json and populate the below content

{
   "list": ["Audience", "UserProvisioningConfig", "CallCoachingMediaProvider", "CleanDataService", "ManagedContentType", "BlacklistedConsumer"]
}

Tips: Remove any unsupported folders/files from your repo to execute the pipeline successfully. 

Test the Pipeline

Finally, we are ready to test the pipeline.

Go to Pipelines => Run Pipeline => Choose the Branch Master => Select “BackupDev” pipeline. => Run

These pipelines can be monitored and checked by clicking on the Pipelines tab.

Configuring DevOps Mate to Retrieve Org metadata in BitBucket Pipelines

Schedule the pipeline

You can schedule your pipeline to run periodically to perform the backup activity

Go to Pipelines => Schedules => New schedule => Select Master branch => Select “BackupDev” pipeline => Choose the schedule dropdown to run the pipeline Hourly, Weekly, Daily

Configuring DevOps Mate to Retrieve Org metadata in BitBucket  Master branch
Configuring DevOps Mate to Retrieve Org metadata in BitBucket Scheduled pipelines

Next Time, we will cover how to set up a DevOps mate in Github actions using GitFlow strategy.

Let’s connect

We’d love to get to know your business better, and chat about how we can harness the power of Salesforce to help achieve your long-term goals.

Start the conversation

Let’s connect

Whether you’re looking for a quick fix, a major transformation, or expert consulting to help you navigate through it all, we’d love to hear from you.
Want to join our team?
Visit our careers page for current openings.
Our HQ
650 W Georgia St Suite 1300 Vancouver, BC V6B 4N8 (604) 628-3421
General inquiries
info@gscloudsolutions.com