Skip to content

Commit fbc1f06

Browse files
committed
Switch from .reporterrors file to flag + envvar
1 parent 9df7e7d commit fbc1f06

File tree

2 files changed

+54
-36
lines changed

2 files changed

+54
-36
lines changed

install/error-handling.sh

Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ echo "${_group}Setting up error handling ..."
33
export SENTRY_DSN='https://[email protected]/3'
44
export SENTRY_ORG=self-hosted
55
export SENTRY_PROJECT=installer
6-
export REPORT_ERRORS=0
76

87
function send_event {
98
local sentry_cli="docker run --rm -v $basedir:/work -e SENTRY_ORG=$SENTRY_ORG -e SENTRY_PROJECT=$SENTRY_PROJECT -e SENTRY_DSN=$SENTRY_DSN getsentry/sentry-cli"
@@ -12,67 +11,69 @@ function send_event {
1211
command popd > /dev/null
1312
}
1413

15-
reporterrors="$basedir/.reporterrors"
16-
if [[ -f $reporterrors ]]; then
17-
echo -n "Found a .reporterrors file. What does it say? "
18-
cat $reporterrors
19-
if [[ "$(cat $reporterrors)" == "yes" ]]; then
20-
export REPORT_ERRORS=1
21-
else
22-
export REPORT_ERRORS=0
23-
fi
24-
else
14+
if [[ -z "${REPORT_SELF_HOSTED_ISSUES:-}" ]]; then
2515
if [[ $PROMPTABLE == "0" ]]; then
2616
echo
27-
echo "Hey, so ... we would love to find out when you hit an issue with this here"
28-
echo "installer you are running. Turns out there is an app for that, called Sentry."
29-
echo "Would you be willing to let us automatically send data to Sentry from this "
30-
echo "installer? If so, add this to your automation:"
17+
echo "Hey, so ... we would love to automatically find out about issues with your"
18+
echo "Sentry instance so that we can improve the product. Turns out there is an app"
19+
echo "for that, called Sentry. Would you be willing to let us automatically send data"
20+
echo "about your instance upstream to Sentry for development and debugging purposes?"
21+
echo "If so, rerun with:"
22+
echo
23+
echo " ./install.sh --report-self-hosted-issues"
24+
echo
25+
echo " or"
3126
echo
32-
echo " echo yes > /path/to/sentry/.reporterrors"
27+
echo " REPORT_SELF_HOSTED_ISSUES=1 ./install.sh"
3328
echo
3429
echo "(Btw, we send this to our own self-hosted Sentry instance, not to Sentry SaaS,"
3530
echo "so that we can be in this together.)"
3631
echo
37-
echo "Here's the info we may collect in order to help us improve the installer:"
32+
echo "Here's the info we may collect:"
3833
echo
3934
echo " - OS username"
4035
echo " - IP address"
4136
echo " - install log"
37+
echo " - runtime errors"
4238
echo " - performance data"
4339
echo
4440
echo "Thirty (30) day retention. No marketing. Privacy policy at sentry.io/privacy."
4541
echo
46-
echo "For now we are defaulting to not sending data, but our plan is to hard-require"
47-
echo "a choice from you starting in version 22.10.0, because let's be honest, none of"
48-
echo "you will act on this otherwise. To avoid disruption you can use one of these"
49-
echo "flags:"
42+
echo "For now we are defaulting to not reporting upstream, but our plan is to"
43+
echo "hard-require a choice from you starting in version 22.10.0, because let's be"
44+
echo "honest, none of you will act on this otherwise. To avoid disruption you can use"
45+
echo "one of these flags:"
5046
echo
51-
echo " echo no > /path/to/sentry/.reporterrors"
47+
echo " --report-self-hosted-issues"
48+
echo " --no-report-self-hosted-issues"
5249
echo
53-
echo "We'll probably also add an env var and/or CLI flag before then, too. See:"
50+
echo "or the REPORT_SELF_HOSTED_ISSUES environment variable:"
5451
echo
55-
echo " https://github.com/getsentry/team-ospo/issues/36"
52+
echo " REPORT_SELF_HOSTED_ISSUES=1 to send data"
53+
echo " REPORT_SELF_HOSTED_ISSUES=0 to not send data"
5654
echo
5755
echo "Thanks for using Sentry."
5856
echo
57+
export REPORT_SELF_HOSTED_ISSUES=0 # opt-in for now
5958
else
6059
echo
61-
echo "Hey, so ... we would love to find out when you hit an issue with this here"
62-
echo "installer you are running. Turns out there is an app for that, called Sentry."
63-
echo "Are you okay with us sending info to Sentry when you run this installer?"
60+
echo "Hey, so ... we would love to automatically find out about issues with your"
61+
echo "Sentry instance so that we can improve the product. Turns out there is an app"
62+
echo "for that, called Sentry. Would you be willing to let us automatically send data"
63+
echo "about your instance upstream to Sentry for development and debugging purposes?"
6464
echo
6565
echo " y / yes / 1"
6666
echo " n / no / 0"
6767
echo
6868
echo "(Btw, we send this to our own self-hosted Sentry instance, not to Sentry SaaS,"
6969
echo "so that we can be in this together.)"
7070
echo
71-
echo "Here's the info we may collect in order to help us improve the installer:"
71+
echo "Here's the info we may collect:"
7272
echo
7373
echo " - OS username"
7474
echo " - IP address"
7575
echo " - install log"
76+
echo " - runtime errors"
7677
echo " - performance data"
7778
echo
7879
echo "Thirty (30) day retention. No marketing. Privacy policy at sentry.io/privacy."
@@ -83,24 +84,31 @@ else
8384
do
8485
read -p "y or n? " yn
8586
case $yn in
86-
y | yes | 1) export REPORT_ERRORS=1; echo "yes" > $reporterrors; echo; echo -n "Thank you.";;
87-
n | no | 0) export REPORT_ERRORS=0; echo "no" > $reporterrors; echo; echo -n "Understood.";;
87+
y | yes | 1) export REPORT_SELF_HOSTED_ISSUES=1; echo; echo -n "Thank you.";;
88+
n | no | 0) export REPORT_SELF_HOSTED_ISSUES=0; echo; echo -n "Understood.";;
8889
*) yn="";;
8990
esac
9091
done
9192

92-
echo " Your answer is cached in '.reporterrors', remove it to see this"
93-
echo "prompt again."
93+
echo " To avoid this prompt in the future, use one of these flags:"
94+
echo
95+
echo " --report-self-hosted-issues"
96+
echo " --no-report-self-hosted-issues"
97+
echo
98+
echo "or the REPORT_SELF_HOSTED_ISSUES environment variable:"
99+
echo
100+
echo " REPORT_SELF_HOSTED_ISSUES=1 to send data"
101+
echo " REPORT_SELF_HOSTED_ISSUES=0 to not send data"
94102
echo
95103
sleep 5
96104
fi
97105
fi
98106

99107
# Make sure we can use sentry-cli if we need it.
100-
if [ "$REPORT_ERRORS" == 1 ]; then
108+
if [ "$REPORT_SELF_HOSTED_ISSUES" == 1 ]; then
101109
if ! docker pull getsentry/sentry-cli:latest; then
102-
echo "Failed to pull sentry-cli, won't report errors after all."
103-
export REPORT_ERRORS=0
110+
echo "Failed to pull sentry-cli, won't report to Sentry after all."
111+
export REPORT_SELF_HOSTED_ISSUES=0
104112
fi;
105113
fi;
106114

@@ -139,7 +147,7 @@ cleanup () {
139147
fi
140148
echo "$traceback"
141149

142-
if [ "$REPORT_ERRORS" == 1 ]; then
150+
if [ "$REPORT_SELF_HOSTED_ISSUES" == 1 ]; then
143151
local traceback_hash=$(echo -n $traceback | docker run --rm busybox md5sum | cut -d' ' -f1)
144152
send_event "$traceback_hash" "$cmd_exit"
145153
fi

install/parse-cli.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ Options:
1818
branch of a \`self-hosted\` Git working copy.
1919
--skip-user-creation Skip the initial user creation prompt (ideal for non-
2020
interactive installs).
21+
--report-self-hosted-issues
22+
Report error and performance data about your self-hosted
23+
instance upstream to Sentry. See sentry.io/privacy for
24+
our privacy policy.
25+
--no-report-self-hosted-issues
26+
Do not report error and performance data about your
27+
self-hosted instance upstream to Sentry.
2128
EOF
2229
}
2330

@@ -33,6 +40,7 @@ fi
3340
SKIP_USER_CREATION="${SKIP_USER_CREATION:-}"
3441
MINIMIZE_DOWNTIME="${MINIMIZE_DOWNTIME:-}"
3542
SKIP_COMMIT_CHECK="${SKIP_COMMIT_CHECK:-}"
43+
REPORT_SELF_HOSTED_ISSUES="${REPORT_SELF_HOSTED_ISSUES:-}"
3644

3745
while (( $# )); do
3846
case "$1" in
@@ -44,6 +52,8 @@ while (( $# )); do
4452
--skip-user-creation) SKIP_USER_CREATION=1;;
4553
--minimize-downtime) MINIMIZE_DOWNTIME=1;;
4654
--skip-commit-check) SKIP_COMMIT_CHECK=1;;
55+
--report-self-hosted-issues) REPORT_SELF_HOSTED_ISSUES=1;;
56+
--no-report-self-hosted-issues) REPORT_SELF_HOSTED_ISSUES=0;;
4757
--) ;;
4858
*) echo "Unexpected argument: $1. Use --help for usage information."; exit 1;;
4959
esac

0 commit comments

Comments
 (0)