> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# picturepipe/sentry-cli

Manage your Sentry projects with sentry-cli: https://github.com/getsentry/sentry-cli/
The SENTRY_AUTH_TOKEN environment variable must be set to authenticate with Sentry. Also set the SENTRY_ORG environment variable if you don't want to configure each command separately.
The Sentry project slug can be configured using the SENTRY_PROJECT environment variable.
This orb's source is available here: https://github.com/PicturePipe/sentry-cli-orb


## Commands

### checkout-to-workspace

Check out source code and persist to workspace.


### create-deployment

Create a new Sentry release deployment. Execute for each deployment of a release. If the release has been finalized, execute afterwards.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `env` | string |  | Sentry environment for this release deployment.
 |
| `org` | env_var_name | SENTRY_ORG | Sentry organization slug.
 |

### create-release

Create a new Sentry release. Execute only once per release.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `org` | env_var_name | SENTRY_ORG | Sentry organization slug.
 |
| `project` | env_var_name | SENTRY_PROJECT | Sentry project slug.
 |

### finalize-release

Finalize a Sentry release. Execute only once per release.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `org` | env_var_name | SENTRY_ORG | Sentry organization slug.
 |

### set-commits

Set commits of a Sentry release. Execute only once per release.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `org` | env_var_name | SENTRY_ORG | Sentry organization slug.
 |

### set-version

Set version for Sentry release, write to file and persist to workspace.
Will first run `git describe --tags` to set the version. If this fails, the output of `sentry-cli releases propose-version` will be used as version.


## Jobs

### checkout-to-workspace

Check out source code and persist to workspace.


### create-deployment

Create a new Sentry release deployment. Execute for each deployment of a release. If the release has been finalized, execute afterwards.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `env` | string |  | Sentry environment for this release deployment.
 |
| `org` | env_var_name | SENTRY_ORG | Sentry organization slug.
 |

### create-release

Create a new Sentry release. Execute only once per release.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `org` | env_var_name | SENTRY_ORG | Sentry organization slug.
 |
| `project` | env_var_name | SENTRY_PROJECT | Sentry project slug.
 |

### finalize-release-set-commits

Finalize a Sentry release and set commits. Execute only once per release.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `org` | env_var_name | SENTRY_ORG | Sentry organization slug.
 |

### set-version

Install Git, set version for Sentry release, write to file and persist to workspace.


## Executors

### default

Official sentry-cli Docker image.


### scm

Docker image with common source control management tools installed.


## Examples

### production-deployment

Example workflow to deploy to production. Runs all jobs in the workflow only for tags. Uses the Git tag as Sentry version and creates a new Sentry release for it. Commits and deployment will be tracked by Sentry after a successful deployment.


```yaml
jobs:
  deploy:
    docker:
      - image: buildpack-deps:stable
    steps:
      - checkout
      - run: echo "Deploy release to production"
orbs:
  sentry-cli: picturepipe/sentry-cli@volatile
version: 2.1
workflows:
  deploy:
    jobs:
      - sentry-cli/checkout-to-workspace:
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /.*/
      - sentry-cli/set-version:
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /.*/
          requires:
            - sentry-cli/checkout-to-workspace
      - sentry-cli/create-release:
          context: org-global
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /.*/
          requires:
            - sentry-cli/set-version
      - deploy:
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /.*/
          requires:
            - sentry-cli/create-release
      - sentry-cli/finalize-release-set-commits:
          context: org-global
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /.*/
          requires:
            - deploy
      - sentry-cli/create-deployment:
          context: org-global
          env: production
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /.*/
          requires:
            - sentry-cli/finalize-release-set-commits
  version: 2
```

### testing-staging-production-pipeline

Example workflow for continuous delivery pipeline using testing, staging and production environments. Each environment uses a matching Sentry environment.
Each push to the develop branch triggers a testing deployment with a Sentry release using the Git revision as version. Commits and deployment are also tracked by Sentry for this version.
Each push to the master branch first triggers a staging deployment with a Sentry release using the Git tag as version. The same version is used for the manual production deployment. Commits and deployments are also tracked by Sentry for this version.


```yaml
jobs:
  deploy:
    docker:
      - image: buildpack-deps:stable
    parameters:
      env:
        description: |
          Environment to deploy to.
        type: string
    steps:
      - checkout
      - run: echo "Deploy release to << parameters.env >>"
orbs:
  sentry-cli: picturepipe/sentry-cli@volatile
version: 2.1
workflows:
  deploy:
    jobs:
      - sentry-cli/checkout-to-workspace:
          filters:
            branches:
              only:
                - develop
            tags:
              only: /.*/
      - sentry-cli/set-version:
          filters:
            branches:
              only:
                - develop
            tags:
              only: /.*/
          requires:
            - sentry-cli/checkout-to-workspace
      - sentry-cli/create-release:
          context: org-global
          filters:
            branches:
              only:
                - develop
            tags:
              only: /.*/
          requires:
            - sentry-cli/set-version
      - deploy:
          env: testing
          filters:
            branches:
              only:
                - develop
          name: deploy-testing
          requires:
            - sentry-cli/create-release
      - sentry-cli/finalize-release-set-commits:
          context: org-global
          filters:
            branches:
              only:
                - develop
          name: sentry-finalize-release-set-commits-testing
          requires:
            - deploy-testing
      - sentry-cli/create-deployment:
          context: org-global
          env: testing
          filters:
            branches:
              only:
                - develop
          name: sentry-create-deployment-testing
          requires:
            - sentry-finalize-release-set-commits-testing
      - deploy:
          env: staging
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /.*/
          name: deploy-staging
          requires:
            - sentry-cli/create-release
      - sentry-cli/finalize-release-set-commits:
          context: org-global
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /.*/
          name: sentry-finalize-release-set-commits-staging
          requires:
            - deploy-staging
      - sentry-cli/create-deployment:
          context: org-global
          env: staging
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /.*/
          name: sentry-create-deployment-staging
          requires:
            - sentry-finalize-release-set-commits-staging
      - start-production-deployment:
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /.*/
          requires:
            - sentry-finalize-release-set-commits-staging
          type: approval
      - deploy:
          env: production
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /.*/
          name: deploy-production
          requires:
            - start-production-deployment
      - sentry-cli/create-deployment:
          context: org-global
          env: production
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /.*/
          name: sentry-create-deployment-production
          requires:
            - deploy-production
  version: 2
```