self-hosted/scripts/backup.sh
Reinaldy Rafli 213423f9d9
fix(scripts): every known flags should be shifted before executing the sentry <foo> command (#3831)
Fixes https://github.com/getsentry/self-hosted/issues/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.
2025-08-07 10:14:02 +07:00

18 lines
412 B
Bash
Executable File

#!/usr/bin/env bash
MINIMIZE_DOWNTIME="${MINIMIZE_DOWNTIME:-}"
REPORT_SELF_HOSTED_ISSUES="${REPORT_SELF_HOSTED_ISSUES:-}"
while (($#)); do
case "$1" in
--report-self-hosted-issues) REPORT_SELF_HOSTED_ISSUES=1 ;;
--no-report-self-hosted-issues) REPORT_SELF_HOSTED_ISSUES=0 ;;
--minimize-downtime) MINIMIZE_DOWNTIME=1 ;;
*) version=$1 ;;
esac
shift
done
cmd="backup $1"
source scripts/_lib.sh
$cmd