You can use other CI tools, such as CircleCI, Travis CI, or Gitlab, to deploy your application. These CI tools support running any Docker image as part of a CI workflow. Porter maintains public.ecr.aws/o1j4x7p4/porter-cli:latest, a public Docker image that contains the Porter CLI. This allows you to run Porter CLI commands easily as part of any workflow.

The Porter CLI requires that the following environment variables are set in order to target a specific application:

PORTER_TOKEN
PORTER_PROJECT
PORTER_CLUSTER

These environment variables can be set by logging into the Porter CLI and running porter config.

Examples

CircleCI

It is easiest to create a CircleCI Context for each Porter cluster in order to set environment variables for a CircleCI job. In CircleCI, set the following environment variables in a context:

PORTER_TOKEN
PORTER_PROJECT
PORTER_CLUSTER

These environment variables can be found after running porter config from the Porter CLI. Next, you can create the following CircleCI config file to a desired branch of your repository:

version: 2.1

jobs:
  porter:
    docker:
      - image: public.ecr.aws/o1j4x7p4/porter-cli:latest
    steps:
      - checkout
      - setup_remote_docker:
          version: 19.03.13
      - run:
          name: "Update Porter application"
          command: "porter app update-tag <APP_NAME> --tag $CIRCLE_SHA1 --stream"

workflows:
  version: 2
  porter-staging-workflow:
    jobs:
      - porter:
          context: <CONTEXT_NAME>

Make sure to replace <CONTEXT_NAME> and <APP_NAME> with your actual CircleCI context name and application name.