Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Sync branch with Salesforce Sandbox

Romarr Garcia
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 28, 2022

Hi,

Has someone tried implementing Continuous Integration for Salesforce using Bitbucket pipelines and SFDX? I cannot keep the repository, UI and my local in sync at the same time. When the pipeline runs, Bitbucket seems to always redownload the repository files thus SFDX thinks the files have changed and it pushes everything again. So even if the files are all the same between repo, Salesforce and my local, when pipeline runs it thinks otherwise and still pushes files instead for sfdx force:source:status to return no results (meaning no change detected).

Thanks in advance.

Romarr 

1 answer

0 votes
Neha Jain May 29, 2023

Hi @Romarr Garcia 

Here are some tips to fix the issue you're facing with Bitbucket pipelines and SFDX:

Exclude unnecessary files: Double-check your Bitbucket pipeline settings and make sure you're excluding any files or folders that don't need to be sent to Salesforce. This way, you'll avoid pushing stuff that doesn't need to be pushed.

Leverage Git's file timestamp: Git keeps track of file timestamps, so you can take advantage of that. In your Bitbucket pipeline, compare the modification time of files between your repository and Salesforce. If the timestamps match, it means the files haven't changed, so you can skip the deployment step.

Use Git diffs: Git's diff feature allows you to compare the differences between your local repository and Salesforce. This way, you can pinpoint the specific files that have changed and only deploy those, instead of deploying the whole repository every single time.

Optimize your deployment strategy: Instead of pushing all files each time the pipeline runs, consider using SFDX's incremental deployments. This cool feature lets you deploy only the changes you've made to your Salesforce metadata, rather than everything. It saves time and makes the process more efficient.

By following these tips and tweaking your Bitbucket pipeline configuration and SFDX commands, you'll be able to sync your repository, Salesforce, and your local development environment more smoothly.

Here are some resources which may help -
From Salesforce website:
https://www.salesforce.com/video/3598965/
https://www.youtube.com/watch?v=rqhyU99aU0E

Sample Bitbucket Repo-
https://bitbucket.org/sfdc-cookbook/salesforce-bitbucket-pipelines/src/master/

From Medium articles:
https://medium.com/@maheshchouhan1995/setting-up-salesforce-environment-c4ac75bf1bec
https://medium.com/@maheshchouhan1995/ci-cd-using-bitbucket-pipeline-for-salesforce-part-2-8fe982823e02

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events