[SalesForce] Deploy sfdx project to another sandbox with CI

SFDX project folder structure is little different from previous folder structure where all metadata folders are inside src folder.

ANT agent on our Continuous Integration tool works for the old folder structure. How can I make the agent work for the new folder structure?

1) Convert SFDX to src folder structure and commit to VCS

2) Update CI script to read SFDX project and deploy to sandboxes(dev, uat, prod etc)

Any examples to the recommended approach is appreciated. Thanks!

Best Answer

At very high level here are the steps you need to take to convert the existing source format to the DX source format .

1.Replace your ANT Migration tooling to leverage SalesforceDX CLI .Assuming your CI is a unix server you can run below to install

wget https://developer.salesforce.com/media/salesforce-cli/sfdx-linux-amd64.tar.xz

mkdir sfdx

tar xJf sfdx-linux-amd64.tar.xz -C sfdx --strip-components 1

./sfdx/install

or If you have node(Ensure that Node v8.6.0 or later is installed on your computer) and npm installed on the CI server use below

npm install sfdx-cli --global
  1. Convert your existing project source code to the DX Source format using the technique described here

3.The source in your SVN will be of DX format .Use the metadata convert command to convert the source to metadata format that you can deploy

sfdx force:source:convert -r path/to/source -d path/to/outputdir

4.Authenticate to the org where you want to deploy using the sfdx auth command

You can use any approach mentioned in the doc other than web login to authenticate your CI server

4.Deploy the source using mdapi deploy command

sfdx force:mdapi:deploy -u <alias> -w 10 -d path/of/outputdir