CI/CD sfdx deployments using Saleforce CLI by default deploys all the metadata into the Orgs.

Is this recommended ? Or should we limit the deployments to changed components alone (using package.xml)?

If we have to limit the deployment using package.xml, what is the best approach/tools to generate the package.xml and destructiveChanges.xml files in an automated manner. Or, is this the responsibility of the developer to modify these files and check-in to repository.

Thanks in advance!

1 Answer 1

  1. Related to developer deployments - If you have scratch org, it will take full deployment only. And it's best to go with full deployment there. Since its a scratch org, you won't need any xml files here.

  2. Related to sandbox/PDE/PEE/Prod deployments - In this case you can opt in for either Delta, or full deployment. Lets say you've frequent deployments, then go with delta, since it takes less time. You can use git commands to find the delta and generate package.xml/destructive.xml with it. But make sure you have periodic full deployment to ensure integrity of code compilation and test class coverages.

To calculate delta, I'd recommend to use Git commands(start with git diff command)

  • 1
    This gives me a clear picture. Thanks! What about the SFDX deployment command. Salesforce provides us two commands for deployment, force:source:deploy and force:mdapi:deploy. The first one can be used for scratch org deployments. But which one is recommended for sandbox and prod deployments ? Detailed question is in https://salesforce.stackexchange.com/questions/348146/salesforce-ci-cd-deployment-commands.
    – jeninjames
    Commented Jun 29, 2021 at 12:11
  • 2
    I'd also recommend sfdx-git-delta for calculating deltas. Commented Jun 29, 2021 at 13:55
  • @jeninjames - I have update my opinion there. Its subjective topic and your future plan can influence it.
    – Ysr Shk
    Commented Jun 29, 2021 at 14:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .