capistrano-sentry 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c2b0c32362fb64aaaa1e3037835ddf4e8c57db855e4081f3be2777ed78c5082
4
- data.tar.gz: 38c19a019f359db6dd0f12d6b9c17faa5a4d4c3e2d8137b1765a928e8a6155b7
3
+ metadata.gz: eb193cb50eb3f8ecfd39146451c570de4536f8ff22a86aef6663bdd290db0814
4
+ data.tar.gz: 34316e7f275118450ae34fd9722b6d2f050f0849bb92cec062816bcc0e0c74e4
5
5
  SHA512:
6
- metadata.gz: b3ea7744d925f10e7930cae9c6793f2303cd34be0ac5821880462345f46fe10e90a94400987259b1c591e2f63440424ee8257ce162cf7c1998191b992157d4af
7
- data.tar.gz: ecdec189a6ae9f5848171738c48bad136e381994ec3d99d1460a9827af5cb746290aec9eaca6c430a16024b8a1da62d5c16711cb8f20c2316e2df63e35d9853a
6
+ metadata.gz: daedfea3dfadbb1b6395bf73c0f4f4b11a3a417c33d77e30e79f0bb7034d010c027a1f0126e4161a355dc3e4475f64f7313606a33408b84706cad1a76eae3de3
7
+ data.tar.gz: 016b032dc21bc1276389eb3dfda706246d09106da1913d5384980ecf245c41184132ba09e31d6855822e59650c9789dddea62f29afd845341bca7b8dd7335768
data/.gitignore CHANGED
@@ -6,4 +6,5 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
- *~
9
+ Gemfile.lock
10
+ *~
data/README.md CHANGED
@@ -2,15 +2,12 @@
2
2
 
3
3
  Simple extension of capistrano for automatic notification of Sentry.
4
4
 
5
- TODO: Prevent user at deployment start if missing parameter to inform sentry
6
- properly
7
-
8
5
  ## Installation
9
6
 
10
7
  Add this line to your application's Gemfile:
11
8
 
12
9
  ```ruby
13
- gem 'capistrano-sentry'
10
+ gem 'capistrano-sentry', require: false
14
11
  ```
15
12
 
16
13
  Then, add this line to your application's Capfile:
@@ -32,14 +29,37 @@ Add these lines to your application's `config/deploy.rb`:
32
29
  ```ruby
33
30
  # Sentry deployment notification
34
31
  set :sentry_host, 'https://my-sentry.mycorp.com' # https://sentry.io by default
35
- set :sentry_api_token, 'd9fe44a1cf34e63993e258dbecf42158918d407978a1bb72f8fb5886aa5f9fe1'
32
+ set :sentry_api_token, '0123456789abcdef0123456789abcdef'
36
33
  set :sentry_organization, 'my-org' # fetch(:application) by default
37
34
  set :sentry_project, 'my-proj' # fetch(:application) by default
38
35
  set :sentry_repo, 'my-org/my-proj' # computed from repo_url by default
36
+ ```
39
37
 
38
+ If you want deployments to be published in every Rails environment, put this in `config/deploy.rb`, otherwise put it your environment-specific deploy file (i.e. `config/deploy/production.rb`):
39
+ ```ruby
40
+ before 'deploy:starting', 'sentry:validate_config'
40
41
  after 'deploy:published', 'sentry:notice_deployment'
41
42
  ```
42
43
 
44
+ ### Explaination of Configuration Properties
45
+
46
+ * `sentry_host`: identifies to which host Sentry submissions are sent. [https://sentry.io by default]
47
+
48
+ * `sentry_api_token`: API Auth Tokens are found/created in you Sentry Account Settings (not in the organization or project): `Settings > Account > Api > Auth Tokens`.
49
+ [https://sentry.io/settings/account/api/auth-tokens/]
50
+
51
+ * `sentry_organization`: The "**Name**" ("*A unique ID used to identify this organization*") from Sentry's Organization Settings page.
52
+ [https://sentry.io/settings/{ORGANIZATION_SLUG}]
53
+
54
+ * `sentry_project`: The "**Name**" ("*A unique ID used to identify this project*") from Sentry's Project Settings page.
55
+ [https://sentry.io/settings/{ORGANIZATION_SLUG}/projects/{PROJECT_SLUG}]
56
+
57
+ * `sentry_repo`: The `repository` name to be used when reporting repository details to Sentry [computed from `fetch(:repo_url)` by default -- `https://github.com/codeur/capistrano-sentry` becomes `//github.com/codeur/capistrano-sentry` and `git@github.com:codeur/capistrano-sentry.git` becomes `codeur/capistrano-sentry`]
58
+
59
+ ### Sentry API Documentation
60
+ * [Project Releases](https://docs.sentry.io/api/releases/post-project-releases/)
61
+ * [Release Deploys](https://docs.sentry.io/api/releases/post-release-deploys/)
62
+
43
63
  ## Development
44
64
 
45
65
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Sentry
3
- VERSION = '0.2.0'.freeze
3
+ VERSION = '0.3.0'.freeze
4
4
  end
5
5
  end
@@ -1,12 +1,31 @@
1
- # This task will notify Sentry via their API[1] that you have deployed
1
+ # This task will notify Sentry via their API[1][2] that you have deployed
2
2
  # a new release. It uses the commit hash as the `version` and the git ref as
3
3
  # the optional `ref` value.
4
4
  #
5
- # [1]: https://docs.getsentry.com/hosted/api/releases/post-project-releases
5
+ # [1]: https://docs.sentry.io/api/releases/post-project-releases/
6
+ # [2]: https://docs.sentry.io/api/releases/post-release-deploys/
6
7
 
7
8
  # For Rails app, this goes in config/deploy.rb
8
9
 
10
+ module Capistrano
11
+ class SentryConfigurationError < StandardError
12
+ end
13
+ end
14
+
9
15
  namespace :sentry do
16
+ desc 'Confirm configuration for notification to Sentry'
17
+ task :validate_config do
18
+ run_locally do
19
+ info '[sentry:validate_config] Validating Sentry notification config'
20
+ api_token = ENV['SENTRY_API_TOKEN'] || fetch(:sentry_api_token)
21
+ if api_token.nil? || api_token.empty?
22
+ msg = "Missing SENTRY_API_TOKEN. Please set SENTRY_API_TOKEN environment variable or `set :sentry_api_token` in your `config/deploy.rb` file for your Rails application."
23
+ warn msg
24
+ fail Capistrano::SentryConfigurationError, msg
25
+ end
26
+ end
27
+ end
28
+
10
29
  desc 'Notice new deployment in Sentry'
11
30
  task :notice_deployment do
12
31
  run_locally do
@@ -61,8 +80,3 @@ namespace :sentry do
61
80
  end
62
81
  end
63
82
  end
64
-
65
- # If you want deployments to be published in every Rails environment, put this
66
- # in config/deploy.rb, otherwise put it your environment-specific deploy file
67
- # i.e. config/deploy/production.rb
68
- # after 'deploy:published', 'sentry:notice_deployment'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-sentry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brice Texier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-08 00:00:00.000000000 Z
11
+ date: 2019-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano