Skip to main content

DevOps to Retrieve Org in BitBucket

Avatar photoContent Marketing Specialist
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 Configure GS DevOps Mate

Steps:

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

Runtime Configuration in BitBucket

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

Define Repo Variables in BitBucket

  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
Configuring DevOps Mate to Retrieve Org metadata in BitBucket Repository variables

Configure A Pipeline in BitBucket

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

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

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

Step 2: Use GS DevOps Mate command sfRetrieve fullOrg-sfdx to retrieve the Production org metadata ( you can configure any org to retrieve the metadata)

Step 3: Add all the retrieved metadata to git.

Step 4: Commit the added metadata to git.

Step 5: Push the committed metadata to bitbucket server.

Step 6: 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"]
}

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

Test the Pipeline in BitBucket

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
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, or Daily.

Configuring DevOps Mate to Retrieve Org metadata in BitBucket Master branch
Configuring DevOps Mate to Retrieve Org metadata in BitBucket Master branch
Configuring DevOps Mate to Retrieve Org metadata in BitBucket Scheduled pipelines
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
GyanSys Inc.
702 Adams St. Carmel, IN 46032
+1-317-580-4200
General inquiries
marketing.us@gyansys.com