blob: 7b3d462efde1339f024ac5421b88389d15c4e245 (
plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
#!/bin/bash
set -euf -o pipefail +x
scripts=$(dirname $0)
# shellcheck source=jenkins-helpers.sh
. $scripts/jenkins-helpers.sh
# shellcheck source=pw-helpers.sh
. $scripts/pw-helpers.sh
convert_args_to_variables "$@"
obligatory_variables check result pw_dir pw_token
declare check result pw_dir pw_token
verbose="${verbose-true}"
if ! [ -d "$pw_dir" ]; then
exit 0
fi
while IFS= read -r -d '' pw_file; do
(
declare -A pw
# shellcheck disable=SC1090
source "$pw_file"
project="${pw[project]}"
build_url="${pw[${project}_build_url]}"
# BE CAREFUL WITH $pw_token
set +x
# shellcheck disable=SC2064
trap "pw_deinit $project" EXIT
pw_init "$project" "$pw_token"
if $verbose; then
set -x
fi
case "$check-$result" in
triggered-*)
desc="Test started"
url="${build_url}console"
state="pending"
;;
apply-fail)
desc="Patch failed to apply"
url="${build_url}artifact/artifacts/jenkins/pw-apply.log"
state="fail"
;;
apply-merged)
desc="Patch is already merged"
url="${build_url}artifact/artifacts/jenkins/pw-apply.log"
# We can test patches hours after they have been
# submitted, and the patches can be merged into master
# branch already. Mark such cases as WARNING.
state="warning"
;;
apply-pass)
desc="Patch applied"
url="${build_url}console"
state="pending"
;;
test-fail)
desc="Testing failed"
url="${build_url}artifact/artifacts/artifacts.precommit/notify/mail-body.txt"
state="fail"
;;
test-pass)
desc="Testing passed"
url="${build_url}artifact/artifacts/artifacts.precommit/notify/mail-body.txt"
state="success"
;;
test-ignore)
# Testing failed due to sporadic failure. Allow retrigger
# testing of this patch in the next round.
desc="Build did not complete; will be retriggered"
url="${build_url}artifact/artifacts/artifacts.precommit/"
state="pending"
;;
esac
${pw[${project}_check_cmd]} --state "$state" \
--description "$desc" --url "$url"
)
done < <(find "$pw_dir" -type f -print0)
|