Install, authenticate with, and utilize the Salesforce sf CLI on CircleCI with ease.
Note This orb was updated in September 2023 to use the
sf
cli instead ofsfdx
Commands are backwards compatible and you can call them usingsf
orsfdx
More information can be found here on the developer.salesforce.com website
Read the full automated documentation live on the Orb Registry: https://circleci.com/developer/orbs/orb/circleci/salesforce-sfdx#usage-create_open_delete_scratch
Base64 encode your private key
Navigate to the directory containing the self signed certificate files you created earlier and enter the following command: base64 server.key
. Once you have the base64 encoded value, copy it for the next step.
Add environment variables
https://circleci.com/docs/2.0/env-vars/#setting-an-environment-variable-in-a-project
SFDX_JWT_KEY
This value must contain the base64 encoded value of the private server.key file.SFDX_CONSUMER_KEY
The consumer key of the connected app for salesforce
version: 2.1
orbs:
sfdx: circleci/salesforce-sfdx@x.y
jobs:
install_authenticate:
executor: sfdx/default
steps:
- checkout
- sfdx/install
- sfdx/auth:
defaultusername: user@email.com
- run:
name: Run your SF commands here
command: |
echo "You now have access to the sf cli and may execute commands against it. https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_unified.htm"
sf auth list
workflows:
basic-test:
jobs:
- install_authenticate
Read our announcement post here: