sentry-for-ci

2.0.2 • Public • Published

Sentry for CI

CLI application which notifies a given Sentry instance of new releases and deploys.

Supported CIs

Name Version
Drone CI 0.8.0

Usage

Using as a node module

const sentryForCI = require('sentry-for-ci')

;(async () => {
  const sentry = sentryForCI({
    endpoint: 'https://sentry.io/api/hooks/release/builtin/3/94fa654c6c7de15b6757531e99c485c8057136943fc5508d991c5c240f067196/',
    origin: 'ci.my-domain.com',
    dryRun: false,
    debug: true
  })

  try {
    await sentry.release(['backend'], '4d67a06d763d9387c41c25d764719a8f68fa763e', [{
      repository: 'acme/backend',
      commit: '4d67a06d763d9387c41c25d764719a8f68fa763e'
    }])
  } catch (err) {
    console.error(err)
  }
})()

Using as a CI Plugin

Using with DroneCI

properties

Common properties used on all commands.

pipeline:
    sentry:
        image: rwillians/sentry-for-ci
        endpoint: https://sentry.io/api/hooks/release/builtin/3/94fa654c6c7de15b6757531e99c485c8057136943fc5508d991c5c240f067196/
        dry-run: true
        debug: true
        origin: ci.my-domain.com
        projects: [ backend, frontend ]
        repository: organization/repository
        release_strategy: commit
        commit: 4d67a06d763d9387c41c25d764719a8f68fa763e
Property When Type Required Default Enum Description Alt. Env Variable
endpoint any string true - - Sentry's API endpoint SENTRY_RELEASE_WEBHOOK_URL
origin any string false - - Custom origin header -
event any string false release release The event type to be registered -
release_strategy any string false commit commit, tag Choose between using commit hash or tag as release identifier -
debug any boolean false false - Logs debug information -
dry-run any boolean false false - Doesn't call Sentry's API -
projects release array[string] true - - List of projects affected -
repository release string false null - Repository name (e.g: acme/repo) -
commit release string false null - Commit hash reference DRONE_COMMIT, CI_COMMIT'
environment deploy string true - - The environment name -
url deploy string false null - The environment url -

Developments

CLI usage

CI_COMMIT=4d67a06d763d9387c41c25d764719a8f68fa763e \
CI_TAG=v1.0.0 \
PLUGIN_ENDPOINT=https://sentry.foobar.com \
PLUGIN_ORIGIN=ci.mydomain.com \
PLUGIN_PROJECTS=backend \
PLUGIN_RELEASE_STRATEGY=commit \
PLUGIN_COMMIT=4d67a06d763d9387c41c25d764719a8f68fa763e \
PLUGIN_REPOSITORY=organization/repository \
PLUGIN_ENVIRONMENT=testing \
PLUGIN_URL=https://testing.app.foobar.com/ \
PLUGIN_DEBUG=true \
PLUGIN_EVENT=release \
PLUGIN_DRY_RUN=true \
bin/sentry-for-ci

Docker

Build

docker build -t sentry-for-ci .

Run

docker run -ti \
    -e CI_COMMIT=7f51241e4cee670ef93f9674f63b3191d36704d4 \
    -e CI_TAG=v1.0.3-rc3 \
    -e PLUGIN_ENDPOINT=https://cors-anywhere.herokuapp.com/https://sentry.sabes.org.br/api/hooks/release/builtin/3/66e5ac874dfc1b0ddb7bf0f8c24fc3b710f90070b72b699eba80896d19839dfe/ \
    -e PLUGIN_ORIGIN=ci.sabes.org.br \
    -e PLUGIN_PROJECTS=frontend \
    -e PLUGIN_RELEASE_STRATEGY=commit \
    -e PLUGIN_COMMIT=7f51241e4cee670ef93f9674f63b3191d36704d4 \
    -e PLUGIN_REPOSITORY=hospitalalemao/sabes-frontend \
    -e PLUGIN_ENVIRONMENT=testing \
    -e PLUGIN_URL=https://testing.app.sabes.org.br \
    -e PLUGIN_DEBUG=true \
    -e PLUGIN_EVENT=release \
    -e PLUGIN_DRY_RUN=true \
    sentry-for-ci

Readme

Keywords

none

Package Sidebar

Install

npm i sentry-for-ci

Weekly Downloads

2

Version

2.0.2

License

MIT

Last publish

Collaborators

  • rwillians