Skip to content

CircleCI: Skpr

Skpr provides developers with a command-line interface for scripting complex workflows.

Development teams are also able to leverage the command-line client in CI/CD workflows using our offical Docker image.

This document outlines some of the tasks that can be accomplished using this integration.

Authentication

We recommend authentication is configured using environment variables to avoid having to manage a ~/.skpr/credentials.yml file during the CirlceCI workflow executions.

Skpr Orb

The Skpr platform team maintains a CircleCI Orb which can be used to simplify your CircleCI configuration.

The examples below will showcase how this orb can be integrated into your CirlceCI workflow.

Examples

Deploy

The following example demonstrates how development teams can set up a tag-based deployment workflow for their project using the Skpr Orb integration.

Workflow Outline

  • When pushing to main branch, deploy to dev environment
  • When pushing a tag, deploy to stg environment
  • Approve release via CircleCI web console, deploy to prod environment

CircleCI Configuration

version: 2.1

orbs:
  skpr: skpr/skpr@1.2

commands:
  skpr-pre-package:
    steps:
      - run:
          name: Pull Base Images
          command: |
            docker pull skpr/php-cli:8.1-v2-latest
            docker pull skpr/php-fpm:8.1-v2-latest
            docker pull skpr/nginx-drupal:v2-latest

  skpr-post-deploy:
    parameters:
      env:
        type: string
    steps:
      - run:
          name: Skpr Post-Deploy
          command: skpr exec << parameters.env >> -- make deploy

workflows:
  deploy:
    jobs:
      - skpr/deploy:
          name: deploy_dev
          env: dev
          pre-package: [ skpr-pre-package ]
          post-deploy:
            - skpr-post-deploy: { env: dev }
          filters:
            branches:
              only: [ main ]

      - skpr/deploy:
          name: deploy_stg
          env: stg
          pre-package: [ skpr-pre-package ]
          post-deploy:
            - skpr-post-deploy: { env: stg }
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /^\d+\.\d+\.\d+[0-9A-Za-z-]*$/

      - approve:
          type: approval
          requires:
            - deploy_stg
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /^\d+\.\d+\.\d+[0-9A-Za-z-]*$/

      - skpr/deploy:
          name: deploy_prod
          env: prod
          package: false
          post-deploy:
            - skpr-post-deploy: { env: prod }
          requires:
            - approve
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /^\d+\.\d+\.\d+[0-9A-Za-z-]*$/