Salesforcesfdx

Notes on using circleci to deply to a UAT sandbox

Follow previous post to create package

UAT sandbox is a copy of production, the connected app (used for JWT auth) copies across but there is a new consumer key.

CircleCi yml extract

  deploy-UAT:
    docker:
    - image: circleci/node:latest
    steps:
      - checkout
      - run:
          name: Install Dependencies
          command: . build/install.sh
      - run:
          name: Setup UAT
          command: . build/setup-uat.sh
      - run:
          name: Deploy to UAT
          command: . build/deploy-UAT.sh
workflows:
  version: 2
  validate:
      - deploy-UAT:
          filters:
            branches:
              only:
                - developer

setup-uat.sh

# Get the private key from the environment variable
echo "Setting up UAT Connection..."
mkdir uatkeys
echo $SFDC_SERVER_KEY | base64 -d > uatkeys/server.key

# Authenticate to salesforce
echo "Authenticating..."
sfdx force:auth:jwt:grant --instanceurl https://test.salesforce.com --clientid $CONSUMERKEYUAT --jwtkeyfile uatkeys/server.key --username $SFDC_UAT_USER  -a UAT 
 
echo "New listing orgs we are authorised to..."
sfdx force:auth:list

deploy-uat.sh

#Deploy the package to UAT
echo "Name of Package Id..."
echo ${PACKAGEID}

echo "Deploy the package to UAT..."
sfdx force:package:install -p ${PACKAGEID} -u UAT -w 10 -k <password>  

This will deploy the package.

TO DO – the code for package versions…..

Leave a Reply

Your email address will not be published. Required fields are marked *