forked from plctlab/riscv-ci
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ml-gcc-watcher.sh
52 lines (41 loc) · 1.11 KB
/
ml-gcc-watcher.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# Usage:
# CI_JOB_TOKEN=secret $0
# watch the list in every 1 hour
FREQ=3600
# how many items in the list
BATCH_SIZE=100
# JOB URL
JOB_URL="https://ci.rvperf.org/job/ml-fsf-gcc-master-ubuntu1804/buildWithParameters"
# Pleasee make sure your $HOME/.pwclientrc has this config:
# # Sample .pwclientrc file for the gcc project,
# # running on patchwork.ozlabs.org.
# #
# # Just append this file to your existing ~/.pwclientrc
# # If you do not already have a ~/.pwclientrc, then copy this file to
# # ~/.pwclientrc, and uncomment the following two lines:
# # [options]
# # default=gcc
#
# [gcc]
# url = https://patchwork.ozlabs.org/xmlrpc/
# Make sure you have installed pwclient
check_pwclient () {
echo TODO
}
function trigger_ci () {
curl "$JOB_URL?token=${CI_JOB_TOKEN}&patch_id=$1"
}
function fetch_and_trigger () {
pwclient list -p gcc -N "$BATCH_SIZE" | tail -n +3 > DEBUG.fetch
cat DEBUG.fetch | cut -f1 -d' ' DEBUG.fetch \
| while read ID; do
grep -q -w "$ID" DATA.fetched && continue
trigger_ci "$ID"
echo "$ID" >> DATA.fetched
done
}
while true; do
fetch_and_trigger
sleep "$FREQ"
done