function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Caleb Kuester 44Caleb Kuester 44 

CI/CD Predeployment Step With SFDX

Greetings!

I have a question centering specifically on the sfdx force:source:deploy command.

As it stands, you can add a predestructivechanges flag to it, which allows you to add an XML file with a list of components that you're wanting to delete in whichever environment. This has been a fantastic change, but there's a significant problem with it.

If you set it and you have an XML file and it fails deployment from your branch, the next attempt is guaranteed to fail unless you remove your pre-destructive changes XML file from the branch first because the pre-destructive changes already happened prior to the primary deployment.

The only graceful solutions I can think of is if Salesforce either allows you to continue deployment of destructive changes even if they don't exist, or Salesforce rolls back the deletion on a failed deployment. The alternative is to run pre-destructive changes at the beginning, which potentially incurs the wrath of the test class runs, which doubles the time required to run deployments.

Anybody have thoughts?