Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add opt in error monitoring to reset and clean scripts #2021

Merged

Conversation

hubertdeng123
Copy link
Member

Adds error monitoring to reset.sh and clean.sh

@chadwhitacre
Copy link
Member

Here's a new one:

$ ./clean.sh 
▶ Initializing Docker Compose ...

▶ Detecting Docker platform
template: :1:2: executing "" at <.Architecture>: reflect: indirection through nil pointer to embedded struct field Info
FAIL: Unsupported docker architecture .
$

@hubertdeng123
Copy link
Member Author

is this an issue that you're seeing after running the script?

clean.sh Outdated
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved a significant part of this file to docker_cleanup so that this can serve as a top level file for error-reporting

reset.sh Outdated Show resolved Hide resolved
@chadwhitacre
Copy link
Member

chadwhitacre commented Mar 14, 2023

Not a fan of this diff. Why the excessive duplication? The only thing different is the logfile name and the install.sh call. If it's that hard to dedupe then maybe we should just drop the install.sh from reset.sh entirely (and remove clean.sh).

$ diff -rub clean.sh reset.sh
--- clean.sh	2023-03-14 17:46:08
+++ reset.sh	2023-03-14 17:46:08
@@ -1,11 +1,13 @@
 #!/usr/bin/env bash
 set -euo pipefail
 
+# Variables needing default values set in order to source install/error-handling
 MINIMIZE_DOWNTIME="${MINIMIZE_DOWNTIME:-}"
 STOP_TIMEOUT=60
+MSYSTEM="${MSYSTEM:-}"
 
 # Save logs in order to send envelope to Sentry
-log_file=sentry_clean_log-$(date +'%Y-%m-%d_%H-%M-%S').txt
+log_file=sentry_reset_log-$(date +'%Y-%m-%d_%H-%M-%S').txt
 exec &> >(tee -a "$log_file")
 version=$1
 
@@ -23,3 +25,4 @@
 source install/error-handling.sh
 trap_with_arg cleanup ERR INT TERM EXIT
 source docker_cleanup.sh $version
+source install.sh

@hubertdeng123 hubertdeng123 force-pushed the hubertdeng123/add-error-monitoring-clean-reset-scripts branch from 1932e15 to 66181e0 Compare March 14, 2023 23:26
@hubertdeng123
Copy link
Member Author

How's this instead? Still some duplicate code but it's much cleaner

$ diff -rub clean.sh reset.sh
--- clean.sh    2023-03-14 16:27:17
+++ reset.sh    2023-03-14 16:27:17
@@ -1,5 +1,9 @@
 #!/usr/bin/env bash
-log_name=clean
 
+# Needed variable to source install script
+MSYSTEM="${MSYSTEM:-}"
+log_name=reset
+
 source set-up-error-reporting-for-scripts.sh
 source docker-cleanup.sh
+source install.sh

@hubertdeng123 hubertdeng123 merged commit c0ff2f4 into master Mar 16, 2023
@hubertdeng123 hubertdeng123 deleted the hubertdeng123/add-error-monitoring-clean-reset-scripts branch March 16, 2023 23:04
@hubertdeng123 hubertdeng123 mentioned this pull request Mar 17, 2023
2 tasks
@github-actions github-actions bot locked and limited conversation to collaborators Apr 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants