8

Is there any way to have a continuous integration in place that does Incremental/Partial Deployment using SalesforceDX. So that only the components that are changed are deployed, instead of a full build.

I got one question here which is almost a year old, which did not mention any solution to it.

Also the documentation (beta version) does not mention anything about it.

6
  • 1
    Isn't that what a sfdx force:source:push does? Identify the components that have changed and only push those to the org. Or do you want to exclude some of those changed components? Aug 3, 2017 at 22:38
  • its only allowed for scratch orgs...Meesage: You can push source only to a scratch org using this command. Use the Metadata API to sync changes for non-scratch orgs.
    – ipradhansk
    Aug 3, 2017 at 22:48
  • I was looking for Continuous Integration using Travis, to Sandbox or Production environment
    – ipradhansk
    Aug 3, 2017 at 22:49
  • I"m not aware of a sfdx command that will reduce the metadata down to just the changes required to the sandbox or production org. There isn't currently a way to diff with what is currently in the target org and determine which changes are required. At least not without using a third party tool. Aug 3, 2017 at 23:09
  • 2
    We started using GearSet, and it basically does a smart diff to figure out the difference between a branch and an org, and syncs them up. There's other tools out there that do this as well. As far as CI goes... it really depends on the CI. I've heard of intelligent deploys using both Jenkins and Travis, but I don't know the specifics of how this was accomplished.
    – sfdcfox
    Aug 3, 2017 at 23:40

1 Answer 1

2

Assuming your changes are tracked in Git, you can combine sfdx force:source:deploy and git diff to deploy only the assets that have changed since a particular commit.

The script needs to convert the newlines in the git diff output to commas in order to pass in a comma-separated list of paths to force:source:deploy.

Bash:

sfdx force:source:deploy -p $(git diff --name-only <commit> | tr '\n' ',')

Powershell:

sfdx force:source:deploy -p ((git diff --name-only <commit>) -join ",")

Just replace <commit> with your commit ID.

You must log in to answer this question.

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