sentry-cli 2.18.1__tar.gz → 2.19.1__tar.gz

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.
Files changed (111) hide show
  1. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/Cargo.lock +14 -13
  2. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/Cargo.toml +4 -3
  3. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/PKG-INFO +1 -1
  4. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/sentry_cli.egg-info/PKG-INFO +1 -1
  5. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/api.rs +13 -23
  6. sentry_cli-2.19.1/src/commands/monitors/run.rs +199 -0
  7. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/releases/set_commits.rs +1 -1
  8. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/sourcemaps/inject.rs +0 -1
  9. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/dif_upload.rs +6 -2
  10. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/sourcemaps/inject.rs +253 -14
  11. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/sourcemaps.rs +112 -77
  12. sentry_cli-2.18.1/src/commands/monitors/run.rs +0 -127
  13. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/LICENSE +0 -0
  14. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/MANIFEST.in +0 -0
  15. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/README.md +0 -0
  16. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/build.rs +0 -0
  17. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/pyproject.toml +0 -0
  18. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/sentry_cli.egg-info/SOURCES.txt +0 -0
  19. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/sentry_cli.egg-info/dependency_links.txt +0 -0
  20. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/sentry_cli.egg-info/top_level.txt +0 -0
  21. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/setup.cfg +0 -0
  22. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/setup.py +0 -0
  23. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/bashsupport.sh +0 -0
  24. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/bash_hook.rs +0 -0
  25. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/debug_files/bundle_jvm.rs +0 -0
  26. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/debug_files/bundle_sources.rs +0 -0
  27. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/debug_files/check.rs +0 -0
  28. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/debug_files/find.rs +0 -0
  29. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/debug_files/mod.rs +0 -0
  30. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/debug_files/print_sources.rs +0 -0
  31. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/debug_files/upload.rs +0 -0
  32. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/deploys/list.rs +0 -0
  33. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/deploys/mod.rs +0 -0
  34. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/deploys/new.rs +0 -0
  35. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/events/list.rs +0 -0
  36. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/events/mod.rs +0 -0
  37. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/files/delete.rs +0 -0
  38. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/files/list.rs +0 -0
  39. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/files/mod.rs +0 -0
  40. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/files/upload.rs +0 -0
  41. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/info.rs +0 -0
  42. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/issues/mod.rs +0 -0
  43. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/issues/mute.rs +0 -0
  44. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/issues/resolve.rs +0 -0
  45. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/issues/unresolve.rs +0 -0
  46. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/login.rs +0 -0
  47. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/mod.rs +0 -0
  48. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/monitors/list.rs +0 -0
  49. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/monitors/mod.rs +0 -0
  50. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/organizations/list.rs +0 -0
  51. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/organizations/mod.rs +0 -0
  52. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/projects/list.rs +0 -0
  53. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/projects/mod.rs +0 -0
  54. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/react_native/appcenter.rs +0 -0
  55. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/react_native/gradle.rs +0 -0
  56. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/react_native/mod.rs +0 -0
  57. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/react_native/xcode.rs +0 -0
  58. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/releases/archive.rs +0 -0
  59. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/releases/delete.rs +0 -0
  60. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/releases/finalize.rs +0 -0
  61. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/releases/info.rs +0 -0
  62. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/releases/list.rs +0 -0
  63. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/releases/mod.rs +0 -0
  64. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/releases/new.rs +0 -0
  65. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/releases/propose_version.rs +0 -0
  66. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/releases/restore.rs +0 -0
  67. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/repos/list.rs +0 -0
  68. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/repos/mod.rs +0 -0
  69. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/send_envelope.rs +0 -0
  70. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/send_event.rs +0 -0
  71. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/sourcemaps/explain.rs +0 -0
  72. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/sourcemaps/mod.rs +0 -0
  73. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/sourcemaps/resolve.rs +0 -0
  74. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/sourcemaps/upload.rs +0 -0
  75. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/uninstall.rs +0 -0
  76. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/update.rs +0 -0
  77. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/upload_dif.rs +0 -0
  78. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/upload_dsym.rs +0 -0
  79. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/upload_proguard.rs +0 -0
  80. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/config.rs +0 -0
  81. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/constants.rs +0 -0
  82. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/main.rs +0 -0
  83. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/android.rs +0 -0
  84. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/appcenter.rs +0 -0
  85. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/args.rs +0 -0
  86. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/chunks.rs +0 -0
  87. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/codepush.rs +0 -0
  88. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/cordova.rs +0 -0
  89. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/dif.rs +0 -0
  90. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/enc.rs +0 -0
  91. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/event.rs +0 -0
  92. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/file_search.rs +0 -0
  93. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/file_upload.rs +0 -0
  94. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/formatting.rs +0 -0
  95. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/fs.rs +0 -0
  96. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/http.rs +0 -0
  97. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/logging.rs +0 -0
  98. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/mod.rs +0 -0
  99. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/progress.rs +0 -0
  100. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/releases.rs +0 -0
  101. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/retry.rs +0 -0
  102. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/snapshots/sentry_cli__utils__vcs__generate_patch_default_twenty.snap +0 -0
  103. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/snapshots/sentry_cli__utils__vcs__generate_patch_ignore_missing.snap +0 -0
  104. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/snapshots/sentry_cli__utils__vcs__generate_patch_set_base.snap +0 -0
  105. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/snapshots/sentry_cli__utils__vcs__generate_patch_set_previous_commit.snap +0 -0
  106. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/snapshots/sentry_cli__utils__vcs__get_commits_from_git.snap +0 -0
  107. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/system.rs +0 -0
  108. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/ui.rs +0 -0
  109. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/update.rs +0 -0
  110. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/vcs.rs +0 -0
  111. {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/xcode.rs +0 -0
@@ -2159,9 +2159,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
2159
2159
 
2160
2160
  [[package]]
2161
2161
  name = "sentry"
2162
- version = "0.31.1"
2162
+ version = "0.31.2"
2163
2163
  source = "registry+https://github.com/rust-lang/crates.io-index"
2164
- checksum = "37dd6c0cdca6b1d1ca44cde7fff289f2592a97965afec870faa7b81b9fc87745"
2164
+ checksum = "234f6e133d27140ad5ea3b369a7665f7fbc060fe246f81d8168665b38c08b600"
2165
2165
  dependencies = [
2166
2166
  "curl",
2167
2167
  "httpdate",
@@ -2172,9 +2172,9 @@ dependencies = [
2172
2172
 
2173
2173
  [[package]]
2174
2174
  name = "sentry-anyhow"
2175
- version = "0.31.1"
2175
+ version = "0.31.2"
2176
2176
  source = "registry+https://github.com/rust-lang/crates.io-index"
2177
- checksum = "d9c3d7032fff178c77c107c32c6d3337b12847adf67165ccc876c898e7154b00"
2177
+ checksum = "47e940be4c63b29006b4ac422cacea932c2cb5f8c209647ee86446ed27595a42"
2178
2178
  dependencies = [
2179
2179
  "anyhow",
2180
2180
  "sentry-backtrace",
@@ -2183,9 +2183,9 @@ dependencies = [
2183
2183
 
2184
2184
  [[package]]
2185
2185
  name = "sentry-backtrace"
2186
- version = "0.31.1"
2186
+ version = "0.31.2"
2187
2187
  source = "registry+https://github.com/rust-lang/crates.io-index"
2188
- checksum = "c029fe8317cdd75cb2b52c600bab4e2ef64c552198e669ba874340447f330962"
2188
+ checksum = "d89b6b53de06308dd5ac08934b597bcd72a9aae0c20bc3ab06da69cb34d468e3"
2189
2189
  dependencies = [
2190
2190
  "backtrace",
2191
2191
  "once_cell",
@@ -2195,7 +2195,7 @@ dependencies = [
2195
2195
 
2196
2196
  [[package]]
2197
2197
  name = "sentry-cli"
2198
- version = "2.18.1"
2198
+ version = "2.19.1"
2199
2199
  dependencies = [
2200
2200
  "anyhow",
2201
2201
  "anylog",
@@ -2209,6 +2209,7 @@ dependencies = [
2209
2209
  "console",
2210
2210
  "crossbeam-channel",
2211
2211
  "curl",
2212
+ "data-encoding",
2212
2213
  "dirs",
2213
2214
  "dotenv",
2214
2215
  "elementtree",
@@ -2265,9 +2266,9 @@ dependencies = [
2265
2266
 
2266
2267
  [[package]]
2267
2268
  name = "sentry-contexts"
2268
- version = "0.31.1"
2269
+ version = "0.31.2"
2269
2270
  source = "registry+https://github.com/rust-lang/crates.io-index"
2270
- checksum = "bc575098d73c8b942b589ab453b06e4c43527556dd8f95532220d1b54d7c6b4b"
2271
+ checksum = "0769b66763e59976cd5c0fd817dcd51ccce404de8bebac0cd0e886c55b0fffa8"
2271
2272
  dependencies = [
2272
2273
  "hostname",
2273
2274
  "libc",
@@ -2279,9 +2280,9 @@ dependencies = [
2279
2280
 
2280
2281
  [[package]]
2281
2282
  name = "sentry-core"
2282
- version = "0.31.1"
2283
+ version = "0.31.2"
2283
2284
  source = "registry+https://github.com/rust-lang/crates.io-index"
2284
- checksum = "20216140001bbf05895f013abd0dae4df58faee24e016d54cbf107f070bac56b"
2285
+ checksum = "a1f954f1b89e8cd82576dc49bfab80304c9a6201343b4fe5c68c819f7a9bbed2"
2285
2286
  dependencies = [
2286
2287
  "once_cell",
2287
2288
  "rand",
@@ -2292,9 +2293,9 @@ dependencies = [
2292
2293
 
2293
2294
  [[package]]
2294
2295
  name = "sentry-types"
2295
- version = "0.31.1"
2296
+ version = "0.31.2"
2296
2297
  source = "registry+https://github.com/rust-lang/crates.io-index"
2297
- checksum = "d7f6959d8cb3a77be27e588eef6ce9a2a469651a556d9de662e4d07e5ace4232"
2298
+ checksum = "85c53caf80cb1c6fcdf4d82b7bfff8477f50841e4caad7bf8e5e57a152b564cb"
2298
2299
  dependencies = [
2299
2300
  "debugid",
2300
2301
  "getrandom",
@@ -2,7 +2,7 @@
2
2
  authors = ["Armin Ronacher <armin.ronacher@active-4.com>"]
3
3
  build = "build.rs"
4
4
  name = "sentry-cli"
5
- version = "2.18.1"
5
+ version = "2.19.1"
6
6
  edition = "2021"
7
7
  rust-version = "1.65"
8
8
 
@@ -22,7 +22,7 @@ clap = { version = "4.1.6", default-features = false, features = [
22
22
  "string",
23
23
  "help",
24
24
  "usage",
25
- "error-context"
25
+ "error-context",
26
26
  ] }
27
27
  console = "0.15.5"
28
28
  curl = { version = "0.4.44", features = ["static-curl", "static-ssl"] }
@@ -57,7 +57,7 @@ regex = "1.7.1"
57
57
  runas = "1.0.0"
58
58
  rust-ini = "0.18.0"
59
59
  semver = "1.0.16"
60
- sentry = { version = "0.31.1", default-features = false, features = [
60
+ sentry = { version = "0.31.2", default-features = false, features = [
61
61
  "anyhow",
62
62
  "curl",
63
63
  "contexts",
@@ -74,6 +74,7 @@ uuid = { version = "1.3.0", features = ["v4", "serde"] }
74
74
  walkdir = "2.3.2"
75
75
  which = "4.4.0"
76
76
  zip = "0.6.4"
77
+ data-encoding = "2.3.3"
77
78
 
78
79
  [dev-dependencies]
79
80
  insta = { version = "1.26.0", features = ["redactions", "yaml"] }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sentry_cli
3
- Version: 2.18.1
3
+ Version: 2.19.1
4
4
  Summary: A command line utility to work with Sentry.
5
5
  Home-page: https://github.com/getsentry/sentry-cli
6
6
  Author: Sentry
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sentry-cli
3
- Version: 2.18.1
3
+ Version: 2.19.1
4
4
  Summary: A command line utility to work with Sentry.
5
5
  Home-page: https://github.com/getsentry/sentry-cli
6
6
  Author: Sentry
@@ -1460,16 +1460,11 @@ impl Api {
1460
1460
  /// Create a new checkin for a monitor
1461
1461
  pub fn create_monitor_checkin(
1462
1462
  &self,
1463
- dsn: Option<Dsn>,
1464
1463
  monitor_slug: &String,
1465
- checkin: &CreateMonitorCheckIn,
1466
- ) -> ApiResult<MonitorCheckIn> {
1464
+ checkin: &ApiCreateMonitorCheckIn,
1465
+ ) -> ApiResult<ApiMonitorCheckIn> {
1467
1466
  let path = &format!("/monitors/{}/checkins/", PathArg(monitor_slug),);
1468
- let resp = if let Some(dsn) = dsn {
1469
- self.request_with_dsn_auth(Method::Post, path, dsn, Some(checkin))?
1470
- } else {
1471
- self.post(path, checkin)?
1472
- };
1467
+ let resp = self.post(path, checkin)?;
1473
1468
  if resp.status() == 404 {
1474
1469
  return Err(ApiErrorKind::ResourceNotFound.into());
1475
1470
  }
@@ -1479,21 +1474,16 @@ impl Api {
1479
1474
  /// Update a checkin for a monitor
1480
1475
  pub fn update_monitor_checkin(
1481
1476
  &self,
1482
- dsn: Option<Dsn>,
1483
1477
  monitor_slug: &String,
1484
1478
  checkin_id: &Uuid,
1485
- checkin: &UpdateMonitorCheckIn,
1486
- ) -> ApiResult<MonitorCheckIn> {
1479
+ checkin: &ApiUpdateMonitorCheckIn,
1480
+ ) -> ApiResult<ApiMonitorCheckIn> {
1487
1481
  let path = &format!(
1488
1482
  "/monitors/{}/checkins/{}/",
1489
1483
  PathArg(monitor_slug),
1490
1484
  PathArg(checkin_id),
1491
1485
  );
1492
- let resp = if let Some(dsn) = dsn {
1493
- self.request_with_dsn_auth(Method::Put, path, dsn, Some(checkin))?
1494
- } else {
1495
- self.put(path, checkin)?
1496
- };
1486
+ let resp = self.put(path, checkin)?;
1497
1487
 
1498
1488
  if resp.status() == 404 {
1499
1489
  return Err(ApiErrorKind::ResourceNotFound.into());
@@ -2478,7 +2468,7 @@ pub struct Monitor {
2478
2468
 
2479
2469
  #[derive(Debug, Serialize, Deserialize)]
2480
2470
  #[serde(rename_all = "snake_case")]
2481
- pub enum MonitorCheckinStatus {
2471
+ pub enum ApiMonitorCheckInStatus {
2482
2472
  Unknown,
2483
2473
  Ok,
2484
2474
  InProgress,
@@ -2486,23 +2476,23 @@ pub enum MonitorCheckinStatus {
2486
2476
  }
2487
2477
 
2488
2478
  #[derive(Debug, Deserialize)]
2489
- pub struct MonitorCheckIn {
2479
+ pub struct ApiMonitorCheckIn {
2490
2480
  pub id: Uuid,
2491
- pub status: Option<MonitorCheckinStatus>,
2481
+ pub status: Option<ApiMonitorCheckInStatus>,
2492
2482
  pub duration: Option<u64>,
2493
2483
  pub environment: Option<String>,
2494
2484
  }
2495
2485
 
2496
2486
  #[derive(Debug, Serialize)]
2497
- pub struct CreateMonitorCheckIn {
2498
- pub status: MonitorCheckinStatus,
2487
+ pub struct ApiCreateMonitorCheckIn {
2488
+ pub status: ApiMonitorCheckInStatus,
2499
2489
  pub environment: String,
2500
2490
  }
2501
2491
 
2502
2492
  #[derive(Debug, Serialize, Default)]
2503
- pub struct UpdateMonitorCheckIn {
2493
+ pub struct ApiUpdateMonitorCheckIn {
2504
2494
  #[serde(skip_serializing_if = "Option::is_none")]
2505
- pub status: Option<MonitorCheckinStatus>,
2495
+ pub status: Option<ApiMonitorCheckInStatus>,
2506
2496
  #[serde(skip_serializing_if = "Option::is_none")]
2507
2497
  pub duration: Option<u64>,
2508
2498
  #[serde(skip_serializing_if = "Option::is_none")]
@@ -0,0 +1,199 @@
1
+ use log::warn;
2
+ use std::process;
3
+ use std::time::{Duration, Instant};
4
+ use uuid::Uuid;
5
+
6
+ use anyhow::Result;
7
+ use clap::{Arg, ArgAction, ArgMatches, Command};
8
+ use console::style;
9
+
10
+ use sentry::protocol::{MonitorCheckIn, MonitorCheckInStatus};
11
+ use sentry::types::Dsn;
12
+
13
+ use crate::api::{Api, ApiCreateMonitorCheckIn, ApiMonitorCheckInStatus, ApiUpdateMonitorCheckIn};
14
+ use crate::config::Config;
15
+ use crate::utils::event::with_sentry_client;
16
+ use crate::utils::system::{print_error, QuietExit};
17
+
18
+ pub fn make_command(command: Command) -> Command {
19
+ command
20
+ .about("Wraps a command")
21
+ .arg(
22
+ Arg::new("monitor_slug")
23
+ .value_name("monitor-slug")
24
+ .help("The monitor slug.")
25
+ .required(true),
26
+ )
27
+ .arg(
28
+ Arg::new("environment")
29
+ .short('e')
30
+ .default_value("production")
31
+ .help("Specify the environment of the monitor."),
32
+ )
33
+ .arg(
34
+ Arg::new("allow_failure")
35
+ .short('f')
36
+ .long("allow-failure")
37
+ .action(ArgAction::SetTrue)
38
+ .help("Run provided command even when Sentry reports an error.")
39
+ .hide(true),
40
+ )
41
+ .arg(
42
+ Arg::new("args")
43
+ .value_name("ARGS")
44
+ .required(true)
45
+ .num_args(1..)
46
+ .last(true),
47
+ )
48
+ }
49
+
50
+ fn run_program(args: Vec<&String>, monitor_slug: &str) -> (bool, Option<i32>, Duration) {
51
+ let started = Instant::now();
52
+ let mut p = process::Command::new(args[0]);
53
+ p.args(&args[1..]);
54
+ p.env("SENTRY_MONITOR_SLUG", monitor_slug);
55
+
56
+ let (success, code) = match p.status() {
57
+ Ok(status) => (status.success(), status.code()),
58
+ Err(err) => {
59
+ eprintln!(
60
+ "{} could not invoke program '{}': {}",
61
+ style("error").red(),
62
+ args[0],
63
+ err
64
+ );
65
+ (false, None)
66
+ }
67
+ };
68
+
69
+ let elapsed = started.elapsed();
70
+ (success, code, elapsed)
71
+ }
72
+
73
+ fn dsn_execute(
74
+ dsn: Dsn,
75
+ args: Vec<&String>,
76
+ monitor_slug: &str,
77
+ environment: &str,
78
+ ) -> (bool, Option<i32>) {
79
+ let check_in_id = Uuid::new_v4();
80
+
81
+ let open_checkin = MonitorCheckIn {
82
+ check_in_id,
83
+ monitor_slug: monitor_slug.to_string(),
84
+ status: MonitorCheckInStatus::InProgress,
85
+ duration: None,
86
+ environment: Some(environment.to_string()),
87
+ monitor_config: None,
88
+ };
89
+
90
+ with_sentry_client(dsn.clone(), |c| c.send_envelope(open_checkin.into()));
91
+
92
+ let (success, code, elapsed) = run_program(args, monitor_slug);
93
+
94
+ let status = if success {
95
+ MonitorCheckInStatus::Ok
96
+ } else {
97
+ MonitorCheckInStatus::Error
98
+ };
99
+
100
+ let duration = Some(elapsed.as_secs_f64());
101
+
102
+ let close_checkin = MonitorCheckIn {
103
+ check_in_id,
104
+ monitor_slug: monitor_slug.to_string(),
105
+ status,
106
+ duration,
107
+ environment: Some(environment.to_string()),
108
+ monitor_config: None,
109
+ };
110
+
111
+ with_sentry_client(dsn, |c| c.send_envelope(close_checkin.into()));
112
+
113
+ (success, code)
114
+ }
115
+
116
+ fn token_execute(
117
+ args: Vec<&String>,
118
+ monitor_slug: &str,
119
+ environment: &str,
120
+ ) -> (bool, Option<i32>, Option<anyhow::Error>) {
121
+ let api = Api::current();
122
+ let monitor_checkin = api.create_monitor_checkin(
123
+ &monitor_slug.to_owned(),
124
+ &ApiCreateMonitorCheckIn {
125
+ status: ApiMonitorCheckInStatus::InProgress,
126
+ environment: environment.to_string(),
127
+ },
128
+ );
129
+
130
+ let (success, code, elapsed) = run_program(args, monitor_slug);
131
+
132
+ match monitor_checkin {
133
+ Ok(checkin) => {
134
+ let status = if success {
135
+ ApiMonitorCheckInStatus::Ok
136
+ } else {
137
+ ApiMonitorCheckInStatus::Error
138
+ };
139
+
140
+ let duration = Some(elapsed.as_secs() * 1000 + u64::from(elapsed.subsec_millis()));
141
+
142
+ api.update_monitor_checkin(
143
+ &monitor_slug.to_owned(),
144
+ &checkin.id,
145
+ &ApiUpdateMonitorCheckIn {
146
+ status: Some(status),
147
+ duration,
148
+ environment: Some(environment.to_string()),
149
+ },
150
+ )
151
+ .ok();
152
+ }
153
+ Err(e) => {
154
+ return (success, code, Some(e.into()));
155
+ }
156
+ }
157
+
158
+ (success, code, None)
159
+ }
160
+
161
+ pub fn execute(matches: &ArgMatches) -> Result<()> {
162
+ let config = Config::current();
163
+ let dsn = config.get_dsn().ok();
164
+
165
+ // Token based auth is deprecated, prefer DSN style auth for monitor checkins.
166
+ // Using token based auth *DOES NOT WORK* when using slugs.
167
+ if dsn.is_none() {
168
+ warn!("Token auth is deprecated for cron monitor checkins and will be removed in the next major version.");
169
+ warn!("Please use DSN auth.");
170
+ }
171
+
172
+ let args: Vec<_> = matches.get_many::<String>("args").unwrap().collect();
173
+ let monitor_slug = matches.get_one::<String>("monitor_slug").unwrap();
174
+ let environment = matches.get_one::<String>("environment").unwrap();
175
+
176
+ let (success, code) = match dsn {
177
+ // Use envelope API when dsn is provided. This is the prefered way to create check-ins,
178
+ // and the legacy API will be removed in the next major CLI version.
179
+ Some(dsn) => dsn_execute(dsn, args, monitor_slug, environment),
180
+ // Use legacy API when DSN is not provided
181
+ None => {
182
+ let (success, code, err) = token_execute(args, monitor_slug, environment);
183
+ if let Some(e) = err {
184
+ if matches.get_flag("allow_failure") {
185
+ print_error(&e);
186
+ } else {
187
+ return Err(e);
188
+ }
189
+ }
190
+ (success, code)
191
+ }
192
+ };
193
+
194
+ if !success {
195
+ return Err(QuietExit(code.unwrap_or(1)).into());
196
+ }
197
+
198
+ Ok(())
199
+ }
@@ -107,7 +107,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
107
107
  if let Some(commits) = matches.get_many::<String>("commits") {
108
108
  for spec in commits {
109
109
  let commit_spec = CommitSpec::parse(spec)?;
110
- if repos.iter().any(|r| r.name == commit_spec.repo) {
110
+ if repos.iter().any(|r| r.name.to_lowercase() == commit_spec.repo.to_lowercase()) {
111
111
  commit_specs.push(commit_spec);
112
112
  } else {
113
113
  bail!("Unknown repo '{}'", commit_spec.repo);
@@ -65,7 +65,6 @@ pub fn make_command(command: Command) -> Command {
65
65
  .action(ArgAction::SetTrue)
66
66
  .help("Don't modify files on disk."),
67
67
  )
68
- .hide(true)
69
68
  }
70
69
 
71
70
  pub fn execute(matches: &ArgMatches) -> Result<()> {
@@ -508,14 +508,18 @@ where
508
508
  {
509
509
  for index in 0..zip.len() {
510
510
  let (name, buffer) = {
511
- let zip_file = zip.by_index(index)?;
511
+ let mut zip_file = zip.by_index(index)?;
512
512
  let name = zip_file.name().to_string();
513
513
 
514
514
  if !options.valid_extension(Path::new(&name).extension()) {
515
515
  continue;
516
516
  }
517
517
 
518
- (name, ByteView::read(zip_file).map_err(Error::new)?)
518
+ let tmp_file = TempFile::create()?;
519
+ let mut tmp_fh = tmp_file.open()?;
520
+ std::io::copy(&mut zip_file, &mut tmp_fh)?;
521
+
522
+ (name, ByteView::map_file(tmp_fh).map_err(Error::new)?)
519
523
  };
520
524
 
521
525
  func(DifSource::Zip(&mut zip, &name), name.clone(), buffer)?;