fastlane-plugin-sentry_api 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +333 -0
- data/lib/fastlane/plugin/sentry_api/actions/sentry_api_action.rb +129 -0
- data/lib/fastlane/plugin/sentry_api/actions/sentry_crash_free_sessions_action.rb +283 -0
- data/lib/fastlane/plugin/sentry_api/actions/sentry_crash_free_users_action.rb +198 -0
- data/lib/fastlane/plugin/sentry_api/actions/sentry_list_issues_action.rb +207 -0
- data/lib/fastlane/plugin/sentry_api/actions/sentry_slo_report_action.rb +573 -0
- data/lib/fastlane/plugin/sentry_api/actions/sentry_ttid_percentiles_action.rb +242 -0
- data/lib/fastlane/plugin/sentry_api/helper/sentry_api_helper.rb +113 -0
- data/lib/fastlane/plugin/sentry_api/version.rb +5 -0
- data/lib/fastlane/plugin/sentry_api.rb +16 -0
- metadata +51 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: bb37a45115a453684dd66170705b0742827ed070a18f78bb11180d8d796b74a0
|
|
4
|
+
data.tar.gz: b6775dc33d9ff13ca2152efc140fa74aa304e8e31251b9fc10bd3af08f5de4dd
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: ce63e72ef9919324c6107a90402407172ecaf58410e8b80b593fec312e6fb844901f8bd5c173574bb6e3a454a3fcdd09b09acfe37fe600c53f839c1af21859d2
|
|
7
|
+
data.tar.gz: 2cf45d8c19fb2bc24f7ceea371d64ba2b490cb2ffe7cf8e1d2277b006661a9e6a6ef530008d64218f53fdb48b6ba4880c7762f6972ce73a766e7c47e63bb052a
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Manish Rathi <i.am.manish.rathi@gmail.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
# sentry_api plugin
|
|
2
|
+
|
|
3
|
+
[](https://rubygems.org/gems/fastlane-plugin-sentry_api)
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-sentry_api`, add it to your project by running:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
fastlane add_plugin sentry_api
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## About sentry_api
|
|
14
|
+
|
|
15
|
+
A Fastlane plugin providing reusable actions for querying [Sentry](https://sentry.io) APIs. Built for tracking SLOs (Service Level Objectives) around **availability** (crash-free rates), **latency** (TTID percentiles), and **release issue comparison** — with support for week-over-week and release-over-release analysis.
|
|
16
|
+
|
|
17
|
+
### Actions
|
|
18
|
+
|
|
19
|
+
| Action | Description |
|
|
20
|
+
|--------|-------------|
|
|
21
|
+
| [`sentry_api`](#sentry_api) | Generic GET request to any Sentry API endpoint |
|
|
22
|
+
| [`sentry_crash_free_sessions`](#sentry_crash_free_sessions) | Crash-free session & user rates from the Sessions API |
|
|
23
|
+
| [`sentry_crash_free_users`](#sentry_crash_free_users) | User-focused crash-free rate (convenience wrapper) |
|
|
24
|
+
| [`sentry_ttid_percentiles`](#sentry_ttid_percentiles) | TTID p50/p75/p95 per screen from the Discover API |
|
|
25
|
+
| [`sentry_list_issues`](#sentry_list_issues) | Fetch project issues with filtering & sorting |
|
|
26
|
+
| [`sentry_slo_report`](#sentry_slo_report) | Comprehensive SLO report orchestrating all the above |
|
|
27
|
+
|
|
28
|
+
### Environment Variables
|
|
29
|
+
|
|
30
|
+
Set these once to avoid passing them to every action:
|
|
31
|
+
|
|
32
|
+
| Variable | Description |
|
|
33
|
+
|----------|-------------|
|
|
34
|
+
| `SENTRY_AUTH_TOKEN` | Sentry API Bearer auth token |
|
|
35
|
+
| `SENTRY_API_SERVER_URL` | Sentry API base URL (default: `https://sentry.io/api/0`) |
|
|
36
|
+
| `SENTRY_ORG_SLUG` | Sentry organization slug |
|
|
37
|
+
| `SENTRY_PROJECT_ID` | Sentry numeric project ID |
|
|
38
|
+
| `SENTRY_PROJECT_SLUG` | Sentry project slug |
|
|
39
|
+
| `SENTRY_ENVIRONMENT` | Environment filter (default: `production`) |
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Actions
|
|
44
|
+
|
|
45
|
+
### `sentry_api`
|
|
46
|
+
|
|
47
|
+
Make a generic GET request to any Sentry REST API endpoint. Use this for endpoints not covered by the specific actions.
|
|
48
|
+
|
|
49
|
+
**Parameters:**
|
|
50
|
+
|
|
51
|
+
| Key | Type | Required | Default | Description |
|
|
52
|
+
|-----|------|----------|---------|-------------|
|
|
53
|
+
| `auth_token` | `String` | Yes | `SENTRY_AUTH_TOKEN` | API Bearer auth token |
|
|
54
|
+
| `server_url` | `String` | No | `https://sentry.io/api/0` | API base URL |
|
|
55
|
+
| `path` | `String` | Yes | — | API endpoint path |
|
|
56
|
+
| `params` | `Hash` | No | `{}` | Query parameters (Array values produce repeated keys) |
|
|
57
|
+
|
|
58
|
+
**Output (SharedValues):** `SENTRY_API_STATUS_CODE`, `SENTRY_API_RESPONSE`, `SENTRY_API_JSON`
|
|
59
|
+
|
|
60
|
+
**Example:**
|
|
61
|
+
|
|
62
|
+
```ruby
|
|
63
|
+
result = sentry_api(
|
|
64
|
+
path: "/organizations/my-org/sessions/",
|
|
65
|
+
params: { field: ["crash_free_rate(session)"], statsPeriod: "7d", project: "12345" }
|
|
66
|
+
)
|
|
67
|
+
UI.message("Response: #{result[:json]}")
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
### `sentry_crash_free_sessions`
|
|
73
|
+
|
|
74
|
+
Query crash-free session and user rates from the Sentry Sessions API. Supports aggregate metrics for a time period (week-over-week) and grouped-by-release metrics (release-over-release).
|
|
75
|
+
|
|
76
|
+
**Parameters:**
|
|
77
|
+
|
|
78
|
+
| Key | Type | Required | Default | Description |
|
|
79
|
+
|-----|------|----------|---------|-------------|
|
|
80
|
+
| `auth_token` | `String` | Yes | `SENTRY_AUTH_TOKEN` | API Bearer auth token |
|
|
81
|
+
| `org_slug` | `String` | Yes | `SENTRY_ORG_SLUG` | Organization slug |
|
|
82
|
+
| `project_id` | `String` | Yes | `SENTRY_PROJECT_ID` | Numeric project ID |
|
|
83
|
+
| `environment` | `String` | No | `production` | Environment filter |
|
|
84
|
+
| `stats_period` | `String` | No | `7d` | Rolling window (`7d`, `14d`, `30d`). Mutually exclusive with `start_date`/`end_date` |
|
|
85
|
+
| `start_date` | `String` | No | — | ISO 8601 start date (use with `end_date`) |
|
|
86
|
+
| `end_date` | `String` | No | — | ISO 8601 end date (use with `start_date`) |
|
|
87
|
+
| `group_by` | `String` | No | — | Group by: `release`, `environment`, or nil for aggregate |
|
|
88
|
+
| `per_page` | `Integer` | No | `10` | Number of groups to return (max 100) |
|
|
89
|
+
| `order_by` | `String` | No | `-sum(session)` | Sort order for grouped results |
|
|
90
|
+
|
|
91
|
+
**Output (SharedValues):** `SENTRY_CRASH_FREE_SESSION_RATE`, `SENTRY_CRASH_FREE_USER_RATE`, `SENTRY_TOTAL_SESSIONS`, `SENTRY_TOTAL_USERS`, `SENTRY_SESSION_GROUPS`
|
|
92
|
+
|
|
93
|
+
**Examples:**
|
|
94
|
+
|
|
95
|
+
```ruby
|
|
96
|
+
# Aggregate crash-free rate for last 7 days
|
|
97
|
+
sentry_crash_free_sessions(stats_period: "7d")
|
|
98
|
+
rate = lane_context[SharedValues::SENTRY_CRASH_FREE_SESSION_RATE]
|
|
99
|
+
UI.message("Crash-free sessions: #{(rate * 100).round(2)}%")
|
|
100
|
+
|
|
101
|
+
# Grouped by release (release-over-release comparison)
|
|
102
|
+
result = sentry_crash_free_sessions(stats_period: "30d", group_by: "release", per_page: 5)
|
|
103
|
+
result[:groups].each do |g|
|
|
104
|
+
puts "#{g[:by]['release']}: #{(g[:crash_free_session_rate] * 100).round(2)}%"
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Custom date range (for week-over-week comparison)
|
|
108
|
+
sentry_crash_free_sessions(
|
|
109
|
+
start_date: "2026-02-24T00:00:00Z",
|
|
110
|
+
end_date: "2026-03-03T00:00:00Z"
|
|
111
|
+
)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
### `sentry_crash_free_users`
|
|
117
|
+
|
|
118
|
+
Convenience action for fetching user-centric crash-free metrics. For full session + user metrics, use `sentry_crash_free_sessions` instead.
|
|
119
|
+
|
|
120
|
+
**Parameters:**
|
|
121
|
+
|
|
122
|
+
| Key | Type | Required | Default | Description |
|
|
123
|
+
|-----|------|----------|---------|-------------|
|
|
124
|
+
| `auth_token` | `String` | Yes | `SENTRY_AUTH_TOKEN` | API Bearer auth token |
|
|
125
|
+
| `org_slug` | `String` | Yes | `SENTRY_ORG_SLUG` | Organization slug |
|
|
126
|
+
| `project_id` | `String` | Yes | `SENTRY_PROJECT_ID` | Numeric project ID |
|
|
127
|
+
| `environment` | `String` | No | `production` | Environment filter |
|
|
128
|
+
| `stats_period` | `String` | No | `7d` | Rolling window |
|
|
129
|
+
| `start_date` | `String` | No | — | ISO 8601 start date |
|
|
130
|
+
| `end_date` | `String` | No | — | ISO 8601 end date |
|
|
131
|
+
|
|
132
|
+
**Output (SharedValues):** `SENTRY_CRASH_FREE_USER_RATE_ONLY`, `SENTRY_TOTAL_USERS_ONLY`
|
|
133
|
+
|
|
134
|
+
**Example:**
|
|
135
|
+
|
|
136
|
+
```ruby
|
|
137
|
+
sentry_crash_free_users(stats_period: "7d")
|
|
138
|
+
rate = lane_context[SharedValues::SENTRY_CRASH_FREE_USER_RATE_ONLY]
|
|
139
|
+
UI.message("Crash-free users: #{(rate * 100).round(2)}%")
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
### `sentry_ttid_percentiles`
|
|
145
|
+
|
|
146
|
+
Query TTID (Time to Initial Display) percentiles per screen from the Sentry Events/Discover API. Returns p50, p75, p95 per screen transaction, sorted by load count.
|
|
147
|
+
|
|
148
|
+
**Parameters:**
|
|
149
|
+
|
|
150
|
+
| Key | Type | Required | Default | Description |
|
|
151
|
+
|-----|------|----------|---------|-------------|
|
|
152
|
+
| `auth_token` | `String` | Yes | `SENTRY_AUTH_TOKEN` | API Bearer auth token |
|
|
153
|
+
| `org_slug` | `String` | Yes | `SENTRY_ORG_SLUG` | Organization slug |
|
|
154
|
+
| `project_id` | `String` | Yes | `SENTRY_PROJECT_ID` | Numeric project ID |
|
|
155
|
+
| `environment` | `String` | No | `production` | Environment filter |
|
|
156
|
+
| `stats_period` | `String` | No | `7d` | Rolling window |
|
|
157
|
+
| `start_date` | `String` | No | — | ISO 8601 start date |
|
|
158
|
+
| `end_date` | `String` | No | — | ISO 8601 end date |
|
|
159
|
+
| `release` | `String` | No | — | Filter by release version |
|
|
160
|
+
| `transaction_op` | `String` | No | `ui.load` | Transaction operation filter |
|
|
161
|
+
| `per_page` | `Integer` | No | `20` | Number of screens to return (max 100) |
|
|
162
|
+
| `sort` | `String` | No | `-count()` | Sort order |
|
|
163
|
+
|
|
164
|
+
**Output (SharedValues):** `SENTRY_TTID_DATA` (array of `{ transaction:, p50:, p75:, p95:, count: }`)
|
|
165
|
+
|
|
166
|
+
**Examples:**
|
|
167
|
+
|
|
168
|
+
```ruby
|
|
169
|
+
# Top 10 screens by load count
|
|
170
|
+
screens = sentry_ttid_percentiles(stats_period: "7d", per_page: 10)
|
|
171
|
+
screens.each do |s|
|
|
172
|
+
UI.message("#{s[:transaction]}: p50=#{s[:p50]}ms p95=#{s[:p95]}ms (#{s[:count]} loads)")
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Filter by release
|
|
176
|
+
sentry_ttid_percentiles(release: "v25.10.0", stats_period: "14d")
|
|
177
|
+
|
|
178
|
+
# Custom date range (for week-over-week comparison)
|
|
179
|
+
sentry_ttid_percentiles(
|
|
180
|
+
start_date: "2026-02-24T00:00:00Z",
|
|
181
|
+
end_date: "2026-03-03T00:00:00Z"
|
|
182
|
+
)
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
### `sentry_list_issues`
|
|
188
|
+
|
|
189
|
+
Fetch issues from a Sentry project. Supports filtering by release version, query string, sort order, and pagination. Useful for comparing issues across releases.
|
|
190
|
+
|
|
191
|
+
**Parameters:**
|
|
192
|
+
|
|
193
|
+
| Key | Type | Required | Default | Description |
|
|
194
|
+
|-----|------|----------|---------|-------------|
|
|
195
|
+
| `auth_token` | `String` | Yes | `SENTRY_AUTH_TOKEN` | API Bearer auth token |
|
|
196
|
+
| `org_slug` | `String` | Yes | `SENTRY_ORG_SLUG` | Organization slug |
|
|
197
|
+
| `project_slug` | `String` | Yes | `SENTRY_PROJECT_SLUG` | Project slug |
|
|
198
|
+
| `query` | `String` | No | `is:unresolved` | Sentry search query |
|
|
199
|
+
| `sort` | `String` | No | `freq` | Sort: `date`, `new`, `freq`, `priority`, `user`, `trend` |
|
|
200
|
+
| `stats_period` | `String` | No | — | Time window for issue stats |
|
|
201
|
+
| `per_page` | `Integer` | No | `25` | Number of issues to return (max 100) |
|
|
202
|
+
| `cursor` | `String` | No | — | Pagination cursor |
|
|
203
|
+
|
|
204
|
+
**Output (SharedValues):** `SENTRY_ISSUES` (array of issue hashes), `SENTRY_ISSUE_COUNT`
|
|
205
|
+
|
|
206
|
+
**Examples:**
|
|
207
|
+
|
|
208
|
+
```ruby
|
|
209
|
+
# Fetch unresolved issues sorted by frequency
|
|
210
|
+
result = sentry_list_issues(query: "is:unresolved", sort: "freq", per_page: 10)
|
|
211
|
+
result[:issues].each do |issue|
|
|
212
|
+
UI.message("##{issue[:short_id]}: #{issue[:title]} (#{issue[:event_count]} events)")
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
# Issues for a specific release
|
|
216
|
+
sentry_list_issues(query: "is:unresolved release:v25.10.0", sort: "freq")
|
|
217
|
+
|
|
218
|
+
# New issues introduced in a release
|
|
219
|
+
sentry_list_issues(query: "is:unresolved first-release:v25.10.0", sort: "date")
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
### `sentry_slo_report`
|
|
225
|
+
|
|
226
|
+
Generate a comprehensive SLO report by orchestrating multiple Sentry API calls. Produces a structured report with:
|
|
227
|
+
|
|
228
|
+
- **Availability** — Crash-free session/user rates with week-over-week delta
|
|
229
|
+
- **Latency** — TTID p50/p75/p95 per screen with week-over-week delta
|
|
230
|
+
- **Release comparison** — Release-over-release crash-free rates
|
|
231
|
+
- **Issues** — Issue counts and top issues per release (latest vs previous)
|
|
232
|
+
|
|
233
|
+
Includes target checking with ✅/⚠️ indicators and optional JSON file output.
|
|
234
|
+
|
|
235
|
+
**Parameters:**
|
|
236
|
+
|
|
237
|
+
| Key | Type | Required | Default | Description |
|
|
238
|
+
|-----|------|----------|---------|-------------|
|
|
239
|
+
| `auth_token` | `String` | Yes | `SENTRY_AUTH_TOKEN` | API Bearer auth token |
|
|
240
|
+
| `org_slug` | `String` | Yes | `SENTRY_ORG_SLUG` | Organization slug |
|
|
241
|
+
| `project_id` | `String` | Yes | `SENTRY_PROJECT_ID` | Numeric project ID |
|
|
242
|
+
| `project_slug` | `String` | Yes | `SENTRY_PROJECT_SLUG` | Project slug |
|
|
243
|
+
| `environment` | `String` | No | `production` | Environment filter |
|
|
244
|
+
| `stats_period` | `String` | No | `7d` | Rolling window |
|
|
245
|
+
| `crash_free_target` | `Float` | No | `0.998` | Target crash-free session rate (e.g. 0.998 = 99.8%) |
|
|
246
|
+
| `ttid_p95_target_ms` | `Integer` | No | `1000` | Target TTID p95 in milliseconds |
|
|
247
|
+
| `compare_weeks` | `Boolean` | No | `true` | Include week-over-week comparison |
|
|
248
|
+
| `compare_releases` | `Boolean` | No | `true` | Include release-over-release comparison |
|
|
249
|
+
| `current_release` | `String` | No | — | Current release version for issue comparison |
|
|
250
|
+
| `previous_release` | `String` | No | — | Previous release version for issue comparison |
|
|
251
|
+
| `release_count` | `Integer` | No | `5` | Number of releases to compare |
|
|
252
|
+
| `ttid_screen_count` | `Integer` | No | `10` | Number of top screens in TTID report |
|
|
253
|
+
| `issue_count` | `Integer` | No | `10` | Number of top issues per release |
|
|
254
|
+
| `output_json` | `String` | No | — | Path to write JSON report file |
|
|
255
|
+
|
|
256
|
+
**Output (SharedValues):** `SENTRY_SLO_REPORT` (complete hash with `:availability`, `:latency`, `:issues`)
|
|
257
|
+
|
|
258
|
+
**Examples:**
|
|
259
|
+
|
|
260
|
+
```ruby
|
|
261
|
+
# Full SLO report with WoW & RoR comparison
|
|
262
|
+
sentry_slo_report(
|
|
263
|
+
crash_free_target: 0.998,
|
|
264
|
+
ttid_p95_target_ms: 1000,
|
|
265
|
+
compare_weeks: true,
|
|
266
|
+
compare_releases: true,
|
|
267
|
+
current_release: "v25.10.0",
|
|
268
|
+
previous_release: "v25.9.0",
|
|
269
|
+
output_json: "slo_report.json"
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
# Quick availability check only
|
|
273
|
+
report = sentry_slo_report(
|
|
274
|
+
compare_weeks: true,
|
|
275
|
+
compare_releases: false
|
|
276
|
+
)
|
|
277
|
+
rate = report[:availability][:current][:crash_free_session_rate]
|
|
278
|
+
UI.important("Crash-free: #{(rate * 100).round(2)}%")
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Example Fastfile
|
|
284
|
+
|
|
285
|
+
Check out the [example `Fastfile`](fastlane/Fastfile) for usage examples. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
|
|
286
|
+
|
|
287
|
+
```ruby
|
|
288
|
+
lane :availability_check do
|
|
289
|
+
sentry_crash_free_sessions(stats_period: "7d")
|
|
290
|
+
|
|
291
|
+
rate = lane_context[SharedValues::SENTRY_CRASH_FREE_SESSION_RATE]
|
|
292
|
+
UI.important("Crash-free session rate: #{(rate * 100).round(2)}%")
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
lane :slo_report do
|
|
296
|
+
sentry_slo_report(
|
|
297
|
+
crash_free_target: 0.998,
|
|
298
|
+
ttid_p95_target_ms: 1000,
|
|
299
|
+
current_release: "v25.10.0",
|
|
300
|
+
previous_release: "v25.9.0",
|
|
301
|
+
output_json: "slo_report.json"
|
|
302
|
+
)
|
|
303
|
+
end
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## Run tests for this plugin
|
|
307
|
+
|
|
308
|
+
To run both the tests, and code style validation, run
|
|
309
|
+
|
|
310
|
+
```
|
|
311
|
+
rake
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
To automatically fix many of the styling issues, use
|
|
315
|
+
```
|
|
316
|
+
rubocop -a
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
## Issues and Feedback
|
|
320
|
+
|
|
321
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
|
322
|
+
|
|
323
|
+
## Troubleshooting
|
|
324
|
+
|
|
325
|
+
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
|
326
|
+
|
|
327
|
+
## Using _fastlane_ Plugins
|
|
328
|
+
|
|
329
|
+
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
|
330
|
+
|
|
331
|
+
## About _fastlane_
|
|
332
|
+
|
|
333
|
+
_fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
require 'fastlane/action'
|
|
2
|
+
require_relative '../helper/sentry_api_helper'
|
|
3
|
+
|
|
4
|
+
module Fastlane
|
|
5
|
+
module Actions
|
|
6
|
+
module SharedValues
|
|
7
|
+
SENTRY_API_STATUS_CODE = :SENTRY_API_STATUS_CODE
|
|
8
|
+
SENTRY_API_RESPONSE = :SENTRY_API_RESPONSE
|
|
9
|
+
SENTRY_API_JSON = :SENTRY_API_JSON
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Generic action for making raw GET requests to any Sentry REST API endpoint.
|
|
13
|
+
# Use the specific actions (sentry_crash_free_sessions, sentry_ttid_percentiles, etc.)
|
|
14
|
+
# for common use cases. This action is a fallback for endpoints not covered by specific actions.
|
|
15
|
+
class SentryApiAction < Action
|
|
16
|
+
class << self
|
|
17
|
+
def run(params)
|
|
18
|
+
response = Helper::SentryApiHelper.api_request(
|
|
19
|
+
auth_token: params[:auth_token],
|
|
20
|
+
path: params[:path],
|
|
21
|
+
params: params[:params] || {},
|
|
22
|
+
base_url: params[:server_url]
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
status_code = response[:status]
|
|
26
|
+
json = response[:json]
|
|
27
|
+
|
|
28
|
+
unless status_code.between?(200, 299)
|
|
29
|
+
UI.error("Sentry API error #{status_code}: #{response[:body]}")
|
|
30
|
+
UI.user_error!("Sentry API returned #{status_code}")
|
|
31
|
+
return nil
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
Actions.lane_context[SharedValues::SENTRY_API_STATUS_CODE] = status_code
|
|
35
|
+
Actions.lane_context[SharedValues::SENTRY_API_RESPONSE] = response[:body]
|
|
36
|
+
Actions.lane_context[SharedValues::SENTRY_API_JSON] = json
|
|
37
|
+
|
|
38
|
+
UI.success("Sentry API request successful (#{status_code})")
|
|
39
|
+
|
|
40
|
+
{ status: status_code, body: response[:body], json: json }
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
#####################################################
|
|
44
|
+
# @!group Documentation
|
|
45
|
+
#####################################################
|
|
46
|
+
|
|
47
|
+
def description
|
|
48
|
+
"Make a generic GET request to the Sentry REST API"
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def details
|
|
52
|
+
[
|
|
53
|
+
"Makes a generic GET request to the Sentry REST API.",
|
|
54
|
+
"Use this action for any Sentry API endpoint not covered by the specific actions.",
|
|
55
|
+
"API Documentation: https://docs.sentry.io/api/"
|
|
56
|
+
].join("\n")
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def available_options
|
|
60
|
+
[
|
|
61
|
+
FastlaneCore::ConfigItem.new(key: :auth_token,
|
|
62
|
+
env_name: "SENTRY_AUTH_TOKEN",
|
|
63
|
+
description: "Sentry API Bearer auth token",
|
|
64
|
+
optional: false,
|
|
65
|
+
type: String,
|
|
66
|
+
sensitive: true,
|
|
67
|
+
code_gen_sensitive: true,
|
|
68
|
+
verify_block: proc do |value|
|
|
69
|
+
UI.user_error!("No Sentry auth token given, pass using `auth_token: 'token'`") if value.to_s.empty?
|
|
70
|
+
end),
|
|
71
|
+
FastlaneCore::ConfigItem.new(key: :server_url,
|
|
72
|
+
env_name: "SENTRY_API_SERVER_URL",
|
|
73
|
+
description: "Sentry API base URL",
|
|
74
|
+
optional: true,
|
|
75
|
+
default_value: "https://sentry.io/api/0",
|
|
76
|
+
type: String),
|
|
77
|
+
FastlaneCore::ConfigItem.new(key: :path,
|
|
78
|
+
description: "API endpoint path (e.g. '/organizations/my-org/sessions/')",
|
|
79
|
+
optional: false,
|
|
80
|
+
type: String,
|
|
81
|
+
verify_block: proc do |value|
|
|
82
|
+
UI.user_error!("API path cannot be empty") if value.to_s.empty?
|
|
83
|
+
end),
|
|
84
|
+
FastlaneCore::ConfigItem.new(key: :params,
|
|
85
|
+
description: "Query parameters hash. Array values produce repeated keys.",
|
|
86
|
+
optional: true,
|
|
87
|
+
default_value: {},
|
|
88
|
+
type: Hash)
|
|
89
|
+
]
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def output
|
|
93
|
+
[
|
|
94
|
+
['SENTRY_API_STATUS_CODE', 'The HTTP status code returned from the Sentry API'],
|
|
95
|
+
['SENTRY_API_RESPONSE', 'The full response body from the Sentry API'],
|
|
96
|
+
['SENTRY_API_JSON', 'The parsed JSON returned from the Sentry API']
|
|
97
|
+
]
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def return_value
|
|
101
|
+
"A hash including the HTTP status code (:status), the response body (:body), and the parsed JSON (:json)."
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def authors
|
|
105
|
+
["crazymanish"]
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def example_code
|
|
109
|
+
[
|
|
110
|
+
'result = sentry_api(
|
|
111
|
+
auth_token: ENV["SENTRY_AUTH_TOKEN"],
|
|
112
|
+
path: "/organizations/my-org/sessions/",
|
|
113
|
+
params: { field: ["crash_free_rate(session)"], statsPeriod: "7d", project: "12345" }
|
|
114
|
+
)
|
|
115
|
+
UI.message("Response: #{result[:json]}")'
|
|
116
|
+
]
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def category
|
|
120
|
+
:misc
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def is_supported?(platform)
|
|
124
|
+
true
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|