-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
35 lines (30 loc) · 936 Bytes
/
build.sh
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
#!/usr/bin/env bash
curl -s --show-error -N \
-F "username=$1" \
-F "password=$2" \
-F "tmc=@$3" \
-F "project=$4" \
-F "filter=$5" \
-F "languages=$6" \
-F "version=$7" \
-F "method=zkbindings" \
https://zeugwerk.dev/api.php | tee response
status="$(tail -n1 response)"
artifact="$(tail -n2 response | head -n1 | cut -d '=' -f2)"
# Status is not SUCCESS and not UNSTABLE
if [[ "$status" != *"HTTP/1.1 201"* ]] && [[ "$status" != *"HTTP/1.1 202"* ]]; then
exit 1
fi
# We got an artifact that we can extract
if [[ "$status" = *"HTTP/1.1 202"* ]]; then
wget -q --user=$1 --password=$2 -O 'artifact.zip' $artifact
if [[ $? -ne 0 ]]; then
exit 202
fi
# return code 0 means no errors
# return code 1 means there was an error or warning, but processing was successful anyway
unzip -q -o 'artifact.zip'
if [[ $? -gt 1 ]]; then
exit 202
fi
fi