summarylogtreecommitdiffstats
path: root/upload-symbol-archive
blob: 3a7b45c82277db1e273d625ccd258dc2cee5bc17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash -e

die() {
  echo >&2 "$@"
  exit 1
}

(( $# >= 2 )) || die "Usage: $0 TOKEN-FILE SYMBOL-ARCHIVE..."
token="$1"
shift

[[ -f $token && -s $token ]] || die "Invalid TOKEN-FILE ${token@Q}"

for zip; do
  [[ $(file -Ebi "$zip") == application/zip* ]] || die "Invalid SYMBOL-ARCHIVE ${zip@Q}"
done

for zip; do
  echo >&2 "Uploading ${zip@Q} ..."
  curl -X POST -H "Auth-Token: $(<"$token")" -F "${zip##*/}=@$zip" \
    https://crash-stats.mozilla.com/symbols/upload
  echo
done