I hope you enjoyed my talk at Dreamforce 2018!
You can use this repository as a base for setting up your own continuous integration workflow!
This repository contains build scripts (located in the build/ folder) and an example config.yml file in the .circleci/ folder to get you started
-
You first need to create a certificate and key to authenticate with. To do this you can run the script in
build/generate-keys.sh- Follow the prompts when creating the certificate files
- Take note of the Base64 output, as you will need this to set up CircleCI later
-
You will need to create a connected app in your production (and any sandboxes you wish to use CI with)
- First, from Setup, enter App in the Quick Find box, then select App Manager. Click New Connected App.
- Give your application a name such as 'CircleCI'
- Make sure you check
Enable OAuth Settingsin the connected app - Set the OAuth callback to
http://localhost:1717/OauthRedirect - Check
Use Digital Signaturesand add your certificate file (server.crt), this will be in thebuild/folder. Once you have done this delete this file - Select the required OAuth scopes
- Make sure that
refreshis enabled - otherwise you'll get this error:user hasn't approved this consumer - Ensure that
Admin approved users are pre-authorizedunderPermitted Usersis selected - Ensure that you allow the
System Administratorprofile is selected under theProfilesrelated list - Take note of the
Consumer Keyas you will need it for CircleCI
-
You now can set up your CircleCI build
-
Open CircleCI and click on
Add Projectschoose your GitHub repository and clickSet Up Projectthen clickStart buildingthere is an exampleconfig.ymlin this repository already. You can edit this to suit your needs. -
Cancel the first build, as it will fail without any enviornment variables set
-
Click the gear icon next to the repository name on the left hand side of the screen
-
In the settings screen, choose
Environment Variablesyou will need to add three variables by clickingAdd VariableSFDC_SERVER_KEYis the Base64 output generated in Step 1SFDC_PROD_CLIENTIDis theConsumer Keyfrom Step 2SFDC_PROD_USERis the user to use with CircleCI
-
You can now re-run the first build.
-
You are now ready to build your salesforce projects with CircleCI!