Skip to content

Commit 29918e6

Browse files
committed
Collect commit statuses to update
1 parent 1b28056 commit 29918e6

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

common/github_reports.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ function mark_commit_status_all_prs () {
2222
if [ $(echo $CMSSW_QUEUE | grep '_X' | wc -l) -gt 0 ] ; then
2323
CMSSW_FLAVOR=$(echo $CMSSW_QUEUE | cut -d_ -f4)
2424
fi
25-
if [ "${CMSSW_FLAVOR}" != "X" ] ; then CONTEXT="${CMSSW_FLAVOR}/${CONTEXT}" ; fi
25+
if [ "${CMSSW_FLAVOR}" != "X" ] ; then CMSSW_FLAVOR="default" ; fi
26+
CONTEXT="${CMSSW_FLAVOR}/${CONTEXT}"
2627
if [ "$1" != "" ] ; then CONTEXT="${CONTEXT}/$1" ; fi
2728
else
2829
CONTEXT="${COMMIT_STATUS_CONTEXT}"

update-commit-statues-matching.py

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import github_utils
2+
import argparse
3+
4+
5+
def main():
6+
parser = argparse.ArgumentParser()
7+
parser.add_argument("--repository", "-r")
8+
parser.add_argument("--commit", "-c")
9+
parser.add_argument("--architecture", "-a")
10+
parser.add_argument("--queue", "-u", required=False)
11+
parser.add_argument("--prefix", "-p")
12+
args = parser.parse_args()
13+
14+
status_suffix = args.architecture
15+
if args.queue:
16+
flavor = args.queue.split("_")[3]
17+
if flavor != "X":
18+
status_suffix = flavor + "/" + status_suffix
19+
20+
all_statuses = github_utils.get_combined_statuses(args.commit, args.repository).get(
21+
"statuses", []
22+
)
23+
index = 0
24+
25+
for status in all_statuses:
26+
if (
27+
status["context"].startswith(args.prefix + "/" + status_suffix)
28+
and status["state"] == "pending"
29+
):
30+
with open("update-pr-status-{0}.prop".format(index), "w") as f:
31+
f.write("REPOSITORY=${0}\n".format(args.repository))
32+
f.write("PULL_REQUEST=${0}\n".format(args.commit))
33+
f.write("CONTEXT={0}\n".format(status["context"]))
34+
f.write("STATUS=error\n")
35+
f.write("STATUS_MESSAGE=Stuck due to all nodes being offline\n")
36+
37+
index = index + 1
38+
39+
40+
if __name__ == "__main__":
41+
main()

0 commit comments

Comments
 (0)