A demo project showing a Salesforce project being built with SalesforceDX and CircleCI
CircleCI is a Continuous Integration service. This project demonstrates how to use Salesforce DX with Circle.
Follow the instructions below to get started. Also, take a look the SFDX Travis CI. This project is similar in implementation.
-
Generate a an SSL server key and certificate
-
Convert it to hex for storing in Circle's env variables.
Circle does a nice job of allowing you to set environment variables inside the UI in a protected way. Because OpenSSL likes key files formatted in a particular fashion, we'll convert it to hex for storage in env variables. This will make it easier to create a valid key file on the fly in the build later.
$ xxd -p server.key >> server.key.hex
- Set up a Connected App in Salesforce for use with the JWT auth flow.
- Check
Enable OAuth Settings
- Set the OAuth callback to
http://localhost:1717/OauthRedirect
- Check
Use Digital Signatures
and add your certificate (likelyserver.crt
) from step (1) - Select the required OAuth scopes
- Once saved, click
Manage
to set up policies. I used "Admin Approved" for the permitted users and added the correct profiles to the app.
-
Create a project in github, set it up for use with SFDX, and add source files
-
Add the project to your CircleCI account
-
Configure CircleCI variables inside of the settings for your project
CONSUMER_KEY
: Your Connected App consumer keySERVER_KEY_HEX
: The hex version of your server key from step 2SFDC_USER
: The username for your Salesforce user
- Add the example
circle.yml
and push some commits to your repo to start building