Skip to content

Commit 213423f

Browse files
authored
fix(scripts): every known flags should be shifted before executing the sentry <foo> command (#3831)
Fixes #3526 Previously, if this was executed: ```bash ./scripts/backup.sh --no-report-self-hosted-issues ``` The final backup command that will be executed is: ```bash docker compose run -v "${PWD}/sentry:/sentry-data/backup" --rm -T -e SENTRY_LOG_LEVEL=CRITICAL web export --no-report-self-hosted-issues /sentry-data/backup/backup.json ``` Which is invalid. This PR strips all known flags specific to self-hosted before passing it onto Sentry. One other option is to enable "ignore unknown options" on click (the CLI dependency) on Sentry, but I don't want to go to that route.
1 parent abe68ba commit 213423f

File tree

4 files changed

+40
-10
lines changed

4 files changed

+40
-10
lines changed

scripts/_lib.sh

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,24 +78,15 @@ function restore() {
7878
}
7979

8080
# Needed variables to source error-handling script
81-
MINIMIZE_DOWNTIME="${MINIMIZE_DOWNTIME:-}"
8281
export STOP_TIMEOUT=60
8382

8483
# Save logs in order to send envelope to Sentry
8584
log_file="sentry_${cmd%% *}_log-$(date +%Y-%m-%d_%H-%M-%S).txt"
8685
exec &> >(tee -a "$log_file")
8786
version=""
8887

89-
while (($#)); do
90-
case "$1" in
91-
--report-self-hosted-issues) export REPORT_SELF_HOSTED_ISSUES=1 ;;
92-
--no-report-self-hosted-issues) export REPORT_SELF_HOSTED_ISSUES=0 ;;
93-
*) version=$1 ;;
94-
esac
95-
shift
96-
done
97-
9888
# Source files needed to set up error-handling
89+
source install/_lib.sh
9990
source install/dc-detect-version.sh
10091
source install/detect-platform.sh
10192
source install/error-handling.sh

scripts/backup.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
#!/usr/bin/env bash
2+
MINIMIZE_DOWNTIME="${MINIMIZE_DOWNTIME:-}"
3+
REPORT_SELF_HOSTED_ISSUES="${REPORT_SELF_HOSTED_ISSUES:-}"
4+
5+
while (($#)); do
6+
case "$1" in
7+
--report-self-hosted-issues) REPORT_SELF_HOSTED_ISSUES=1 ;;
8+
--no-report-self-hosted-issues) REPORT_SELF_HOSTED_ISSUES=0 ;;
9+
--minimize-downtime) MINIMIZE_DOWNTIME=1 ;;
10+
*) version=$1 ;;
11+
esac
12+
shift
13+
done
14+
215
cmd="backup $1"
316
source scripts/_lib.sh
417
$cmd

scripts/reset.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
#!/usr/bin/env bash
2+
MINIMIZE_DOWNTIME="${MINIMIZE_DOWNTIME:-}"
3+
REPORT_SELF_HOSTED_ISSUES="${REPORT_SELF_HOSTED_ISSUES:-}"
4+
5+
while (($#)); do
6+
case "$1" in
7+
--report-self-hosted-issues) REPORT_SELF_HOSTED_ISSUES=1 ;;
8+
--no-report-self-hosted-issues) REPORT_SELF_HOSTED_ISSUES=0 ;;
9+
--minimize-downtime) MINIMIZE_DOWNTIME=1 ;;
10+
*) version=$1 ;;
11+
esac
12+
shift
13+
done
14+
215
cmd=reset
316
source scripts/_lib.sh
417
$cmd

scripts/restore.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
#!/usr/bin/env bash
2+
MINIMIZE_DOWNTIME="${MINIMIZE_DOWNTIME:-}"
3+
REPORT_SELF_HOSTED_ISSUES="${REPORT_SELF_HOSTED_ISSUES:-}"
4+
5+
while (($#)); do
6+
case "$1" in
7+
--report-self-hosted-issues) REPORT_SELF_HOSTED_ISSUES=1 ;;
8+
--no-report-self-hosted-issues) REPORT_SELF_HOSTED_ISSUES=0 ;;
9+
--minimize-downtime) MINIMIZE_DOWNTIME=1 ;;
10+
*) version=$1 ;;
11+
esac
12+
shift
13+
done
14+
215
cmd="restore $1"
316
source scripts/_lib.sh
417

0 commit comments

Comments
 (0)