mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 20:39:08 +01:00
1675c047c7
The method used for uploading release artifacts to Sentry has been updated to allow `sentry-cli` to associate our minified bundles with the corresponding source map file. This should help Sentry display rich stack traces. Previously Sentry had used the `sourceMappingURL` to associate source maps with bundles, but we recently removed this in #10695. The hope is that this change to the upload process will ensure the mapping works correctly without the `sourceMappingURL` comment. The `upload_bundles` function was removed because the later `upload_sourcemaps` function actually uploaded both the bundles and source maps. The `--rewrite` flag was added to enable a newer "rewrite" feature of the Sentry CLI that they recommend using [1]. This rewrite is where they associate source maps with bundles. The `url-prefix` has been updated to be `metamask` rather than `sourcemaps`. I don't think `sourcemaps` was ever the correct prefix. We normalize our errors to have the path `metamask/` before sending any reports to Sentry. [1]: https://docs.sentry.io/product/cli/releases/#sentry-cli-sourcemaps
73 lines
1.5 KiB
Bash
Executable File
73 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -x
|
|
set -e
|
|
set -u
|
|
set -o pipefail
|
|
|
|
readonly __SCRIPT_NAME__="${0##*/}"
|
|
readonly __SEE_HELP_MESSAGE__="See '${__SCRIPT_NAME__} --help' for more information."
|
|
|
|
function die {
|
|
local message="${1}"
|
|
|
|
printf 'ERROR: %s\n' "${message}" >&2
|
|
|
|
exit 1
|
|
}
|
|
|
|
function show_help {
|
|
cat << EOF
|
|
${__SCRIPT_NAME__}"
|
|
Upload JavaScript bundles and sourcemaps to Sentry
|
|
|
|
Options:
|
|
-h, --help Show help text
|
|
-r, --release <release> Sentry release to upload files to (defaults to 'VERSION' environment variable)
|
|
EOF
|
|
}
|
|
|
|
function upload_sourcemaps {
|
|
local release="${1}"; shift
|
|
|
|
sentry-cli releases --org 'metamask' --project 'metamask' files "${release}" upload-sourcemaps ./dist/chrome/*.js ./dist/sourcemaps/ --rewrite --url-prefix 'metamask'
|
|
}
|
|
|
|
function main {
|
|
local release=VERSION
|
|
|
|
while :; do
|
|
case "${1-default}" in
|
|
-h|--help)
|
|
show_help
|
|
exit
|
|
;;
|
|
-r|--release)
|
|
if [[ -z $2 ]]
|
|
then
|
|
printf "'release' option requires an argument.\\n" >&2
|
|
printf '%s\n' "${__SEE_HELP_MESSAGE__}" >&2
|
|
exit 1
|
|
fi
|
|
release="${2}"
|
|
shift
|
|
;;
|
|
*)
|
|
break
|
|
esac
|
|
|
|
shift
|
|
done
|
|
|
|
if [[ -z $release ]]
|
|
then
|
|
die 'Required parameter "release" missing; either include parameter or set VERSION environment variable'
|
|
fi
|
|
|
|
printf 'uploading source files and sourcemaps for Sentry release "%s"...\n' "${release}"
|
|
upload_sourcemaps "${release}"
|
|
printf 'all done!\n'
|
|
}
|
|
|
|
main "${@}"
|