Skip to content

Commit c0ff2f4

Browse files
Add opt in error monitoring to reset and clean scripts (#2021)
* add opt in error monitoring to clean script * reorganize utility scripts to go into utility folder
1 parent fab1635 commit c0ff2f4

File tree

6 files changed

+33
-10
lines changed

6 files changed

+33
-10
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ var/
3737
pip-log.txt
3838
pip-delete-this-directory.txt
3939
sentry_install_log*.txt
40+
sentry_clean_log*.txt
4041

4142
# Unit test / coverage reports
4243
htmlcov/

reset.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

unit-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
FORCE_CLEAN=1 "./clean.sh"
3+
FORCE_CLEAN=1 "./utilities/clean.sh"
44
fail=0
55
for test_file in _unit-test/*-test.sh; do
66
echo "🙈 Running $test_file ..."

utilities/clean.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
log_name=clean
3+
4+
source utilities/set-up-error-reporting-for-scripts.sh
5+
source utilities/docker-cleanup.sh

clean.sh renamed to utilities/docker-cleanup.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@
33
# The purpose of this script is to make it easy to reset a local self-hosted
44
# install to a clean state, optionally targeting a particular version.
55

6-
set -euo pipefail
7-
86
if [ -n "${DEBUG:-}" ]; then
97
set -x
108
fi
119

12-
source install/dc-detect-version.sh
13-
1410
function confirm() {
1511
read -p "$1 [y/n] " confirmation
1612
if [ "$confirmation" != "y" ]; then
@@ -26,7 +22,6 @@ function confirm() {
2622
# the only refs where these component versions are pinned, so enforce that
2723
# we're targeting a valid tag here. Do this early in order to fail fast.
2824

29-
version="${1:-}"
3025
if [ -n "$version" ]; then
3126
set +e
3227
git rev-parse --verify --quiet "refs/tags/$version" >/dev/null
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Needed variables to source error-handling script
5+
MINIMIZE_DOWNTIME="${MINIMIZE_DOWNTIME:-}"
6+
STOP_TIMEOUT=60
7+
8+
# Save logs in order to send envelope to Sentry
9+
log_file=sentry_"$log_name"_log-$(date +'%Y-%m-%d_%H-%M-%S').txt
10+
exec &> >(tee -a "$log_file")
11+
version=""
12+
13+
while (($#)); do
14+
case "$1" in
15+
--report-self-hosted-issues) REPORT_SELF_HOSTED_ISSUES=1 ;;
16+
--no-report-self-hosted-issues) REPORT_SELF_HOSTED_ISSUES=0 ;;
17+
*) version=$1 ;;
18+
esac
19+
shift
20+
done
21+
22+
# Source files needed to set up error-handling
23+
source install/dc-detect-version.sh
24+
source install/detect-platform.sh
25+
source install/error-handling.sh
26+
trap_with_arg cleanup ERR INT TERM EXIT

0 commit comments

Comments
 (0)