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.
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/Cargo.lock +14 -13
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/Cargo.toml +4 -3
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/PKG-INFO +1 -1
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/sentry_cli.egg-info/PKG-INFO +1 -1
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/api.rs +13 -23
- sentry_cli-2.19.1/src/commands/monitors/run.rs +199 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/releases/set_commits.rs +1 -1
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/sourcemaps/inject.rs +0 -1
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/dif_upload.rs +6 -2
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/sourcemaps/inject.rs +253 -14
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/sourcemaps.rs +112 -77
- sentry_cli-2.18.1/src/commands/monitors/run.rs +0 -127
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/LICENSE +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/MANIFEST.in +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/README.md +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/build.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/pyproject.toml +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/sentry_cli.egg-info/SOURCES.txt +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/sentry_cli.egg-info/dependency_links.txt +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/sentry_cli.egg-info/top_level.txt +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/setup.cfg +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/setup.py +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/bashsupport.sh +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/bash_hook.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/debug_files/bundle_jvm.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/debug_files/bundle_sources.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/debug_files/check.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/debug_files/find.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/debug_files/mod.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/debug_files/print_sources.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/debug_files/upload.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/deploys/list.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/deploys/mod.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/deploys/new.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/events/list.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/events/mod.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/files/delete.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/files/list.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/files/mod.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/files/upload.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/info.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/issues/mod.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/issues/mute.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/issues/resolve.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/issues/unresolve.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/login.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/mod.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/monitors/list.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/monitors/mod.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/organizations/list.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/organizations/mod.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/projects/list.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/projects/mod.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/react_native/appcenter.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/react_native/gradle.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/react_native/mod.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/react_native/xcode.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/releases/archive.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/releases/delete.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/releases/finalize.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/releases/info.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/releases/list.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/releases/mod.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/releases/new.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/releases/propose_version.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/releases/restore.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/repos/list.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/repos/mod.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/send_envelope.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/send_event.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/sourcemaps/explain.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/sourcemaps/mod.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/sourcemaps/resolve.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/sourcemaps/upload.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/uninstall.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/update.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/upload_dif.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/upload_dsym.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/commands/upload_proguard.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/config.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/constants.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/main.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/android.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/appcenter.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/args.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/chunks.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/codepush.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/cordova.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/dif.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/enc.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/event.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/file_search.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/file_upload.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/formatting.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/fs.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/http.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/logging.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/mod.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/progress.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/releases.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/retry.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/snapshots/sentry_cli__utils__vcs__generate_patch_default_twenty.snap +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/snapshots/sentry_cli__utils__vcs__generate_patch_ignore_missing.snap +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/snapshots/sentry_cli__utils__vcs__generate_patch_set_base.snap +0 -0
- {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
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/snapshots/sentry_cli__utils__vcs__get_commits_from_git.snap +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/system.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/ui.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/update.rs +0 -0
- {sentry_cli-2.18.1 → sentry_cli-2.19.1}/src/utils/vcs.rs +0 -0
- {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.
|
|
2162
|
+
version = "0.31.2"
|
|
2163
2163
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2164
|
-
checksum = "
|
|
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.
|
|
2175
|
+
version = "0.31.2"
|
|
2176
2176
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2177
|
-
checksum = "
|
|
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.
|
|
2186
|
+
version = "0.31.2"
|
|
2187
2187
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2188
|
-
checksum = "
|
|
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.
|
|
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.
|
|
2269
|
+
version = "0.31.2"
|
|
2269
2270
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2270
|
-
checksum = "
|
|
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.
|
|
2283
|
+
version = "0.31.2"
|
|
2283
2284
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2284
|
-
checksum = "
|
|
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.
|
|
2296
|
+
version = "0.31.2"
|
|
2296
2297
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2297
|
-
checksum = "
|
|
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.
|
|
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.
|
|
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"] }
|
|
@@ -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: &
|
|
1466
|
-
) -> ApiResult<
|
|
1464
|
+
checkin: &ApiCreateMonitorCheckIn,
|
|
1465
|
+
) -> ApiResult<ApiMonitorCheckIn> {
|
|
1467
1466
|
let path = &format!("/monitors/{}/checkins/", PathArg(monitor_slug),);
|
|
1468
|
-
let resp =
|
|
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: &
|
|
1486
|
-
) -> ApiResult<
|
|
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 =
|
|
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
|
|
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
|
|
2479
|
+
pub struct ApiMonitorCheckIn {
|
|
2490
2480
|
pub id: Uuid,
|
|
2491
|
-
pub status: Option<
|
|
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
|
|
2498
|
-
pub status:
|
|
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
|
|
2493
|
+
pub struct ApiUpdateMonitorCheckIn {
|
|
2504
2494
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
2505
|
-
pub status: Option<
|
|
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);
|
|
@@ -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
|
-
|
|
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)?;
|