Development

Deploying with the Skpr CircleCI Orb

By Kim Pepper8 March 2021

Deploying to Skpr using the command line has always been easy. Now it's even easier using the Skpr Circle CI Orb.

Here's the process in a few simple steps:

1. Set up credentials

Add your provided Skpr credentials as CircleCI secrets either directly to the project or via a CircleCI context. They should be available to the workflow as the following environment variables:

SKPR_USERNAME=xxxxxxxxxxxxxxxxxx
SKPR_PASSWORD=yyyyyyyyyyyyyyyyyy

2. Add the Orb

Add the following to the top of your .circleci/config.yml

orbs:
    skpr: skpr/skpr@1.2.3

NOTE: Check the Orb page to ensure you are using the latest version Skpr Orb.

3. Use the Orb

You can now use the Orb in your deployment workflow. For example:

workflows:
  deploy:
    jobs:
      - skpr/deploy:
          env: dev
          post-deploy:
            - run: skpr exec dev — drush updb -y

In the above example, the skpr/deploy job takes two parameters:

  1. env - The environment to deploy to.
  2. post-deploy - A list of steps to run after deployment.

If you have a staging -> approval -> prod deployment workflow, then you can use the following example:

workflows:
  deploy:
    jobs:
      - skpr/deploy:
          name: deploy_stg
          env: stg
          post-deploy:
            - run: skpr exec stg — drush updb -y
      - approval:
          type: approval
          requires:
            - deploy_stg
      - skpr/deploy:
          name: deploy_prod
          env: prod
          package: false
          post-deploy:
            - run: skpr exec prod — drush updb -y
          requires:
            - approval

In the above example, the prod deployment does not require packaging as it re-uses the version that was packaged for the staging environment.

The full example is:

workflows:
  deploy:
    jobs:
      - skpr/deploy:
          name: deploy_dev
          context: skpr-example
          env: dev
          post-deploy:
            - run: skpr exec dev — drush updb -y
          filters:
            branches:
              only: master
      - skpr/deploy:
          name: deploy_stg
          context: skpr-example
          env: stg
          post-deploy:
            - run: skpr exec stg — drush updb -y
          filters:
            branches:
              only: releases
      - approve:
          type: approval
          requires:
            - deploy_stg
      - skpr/deploy:
          name: deploy_prod
          context: skpr-example
          env: prod
          package: false
          post-deploy:
            - run: skpr exec prod — drush updb -y
          requires:
            - approve

Of course, you can still use the skpr/cli Docker image in your custom job and run the Skpr commands directly.

Tags

deploying
circleci orb

Getting Started

Interested in a demo?

🎉 Awesome!

Please check your inbox for a confirmation email. It might take a minute or so.

🤔 Whoops!

Something went wrong. Check that you have entered a valid email and try submitting the form again.

We'll be in touch shortly.