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

bug-1901997: handle invalid BuildID for redacted crash reports #6777

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add support for --pause to process_crashes.sh
This makes it possible to adjust a crash report for testing a specific
processing scenario.
willkg committed Oct 31, 2024

Unverified

This user has not yet uploaded their public signing key.
commit 159928b437965bf58ec3d39086f93860ed817214
31 changes: 28 additions & 3 deletions bin/process_crashes.sh
Original file line number Diff line number Diff line change
@@ -9,17 +9,23 @@
#
# Usage: ./bin/process_crashes.sh
#
# This should be run inside the app container.
#
# You can use it with fetch_crashids. For example:
#
# socorro-cmd fetch_crashids --num=1 | ./bin/process_crashes.sh
#
# Make sure to run the processor to do the actual processing.
# You can pause after fetching crash ids and before uploading them to the cloud
# storage bucket. This lets you adjust the crash reports.
#
# ./bin/process_crashes.sh --pause afd59adc-1cfd-4aa3-af2f-6b9ed0241029
#
# Note: This should be called from inside a container.
# Make sure to run the processor to do the actual processing.

set -euo pipefail

DATADIR=./crashdata_tryit_tmp
PAUSE=0

function cleanup {
# Cleans up files generated by the script
@@ -29,10 +35,24 @@ function cleanup {
# Set up cleanup function to run on script exit
trap cleanup EXIT

# If there's at least one argument, check for options
if [[ $# -ne 0 ]]; then
if [[ $1 == "--pause" ]]; then
PAUSE=1
shift
fi
fi

# Check for crash ids
if [[ $# -eq 0 ]]; then
if [ -t 0 ]; then
# If stdin is a terminal, then there's no input
echo "Usage: process_crashes.sh CRASHID [CRASHID ...]"
echo "Usage: process_crashes.sh [--pause] CRASHID [CRASHID ...]"
exit 1
fi

if [[ "${PAUSE}" == "1" ]]; then
echo "Can't use PAUSE and process crash ids from stdin. Exiting."
exit 1
fi

@@ -45,6 +65,11 @@ mkdir "${DATADIR}" || echo "${DATADIR} already exists."
# Pull down the data for all crashes
./socorro-cmd fetch_crash_data "${DATADIR}" $@

# Pause (if requested) to let user make changes to crash data
if [[ "${PAUSE}" == "1" ]]; then
read -r -n 1 -p "Pausing... Any key to continue." pauseinput
fi

# Make the bucket and sync contents
./socorro-cmd gcs create "${CRASHSTORAGE_GCS_BUCKET}"
./socorro-cmd gcs upload "${DATADIR}" "${CRASHSTORAGE_GCS_BUCKET}"