-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathupload-symbols.sh
More file actions
executable file
·53 lines (47 loc) · 1.67 KB
/
upload-symbols.sh
File metadata and controls
executable file
·53 lines (47 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env bash
set -e
token=${1:-$BUGFENDER_SYMBOLICATION_TOKEN}
if [ -z "$token" ]; then
echo 'Symbolication Token is required'
exit 0 # Do not fail, we don't want to break people's BC builds
fi
url=${BUGFENDER_SYMBOLICATION_URL:-https://dashboard.bugfender.com/}
[[ "$url" != */ ]] && url="$url/"
version=$MARKETING_VERSION
build=$CURRENT_PROJECT_VERSION
dsympath="$DWARF_DSYM_FOLDER_PATH/$DWARF_DSYM_FILE_NAME"
if [ -f "$dsympath" ] && [ ! -s "$dsympath" ]; then
echo 'dSYM path leads to an empty file'
echo 'Check that you are not hitting https://developer.apple.com/forums/thread/659187'
exit 0 # Do not fail, we don't want to break people's BC builds
fi
if [ -z "$(find "$dsympath" -type f)" ]; then
echo 'No files found inside dSYM bundle'
echo 'Probably a BitCode enabled build?'
echo 'For now, these have to have symbols uploaded manually through the Dashboard'
exit 0 # Do not fail, we don't want to break people's BC builds
fi
tempdir=$(mktemp -d -t 'bugfender')
zippath="$tempdir/dSYMs.zip"
function cleanup {
rm -f "$zippath"
rmdir "$tempdir"
}
trap cleanup EXIT
zip -r "$zippath" "$dsympath"
resp=$(curl -i# \
-H "Authorization: Bearer $token" \
-F version="$version" \
-F build="$build" \
-F file=@"$zippath" \
"${url}api/upload-symbols"
)
statuscode=$(echo "$resp" | head -n1 | cut -d' ' -f2)
if [ "$statuscode" -eq 100 ]; then
statuscode=$(echo "$resp" | head -n3 | tail -n1 | cut -d' ' -f2)
fi
if [ "$statuscode" -ne 200 ]; then
message=$(echo "$resp" | tail -n1)
echo "Upload failed with code $statuscode and message: $message"
exit 0 # Do not fail, we don't want to break people's BC builds
fi