Skip to content

Commit

Permalink
Collect commit statuses to update
Browse files Browse the repository at this point in the history
  • Loading branch information
iarspider committed Feb 17, 2025
1 parent 1b28056 commit b27c572
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
3 changes: 2 additions & 1 deletion common/github_reports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ function mark_commit_status_all_prs () {
if [ $(echo $CMSSW_QUEUE | grep '_X' | wc -l) -gt 0 ] ; then
CMSSW_FLAVOR=$(echo $CMSSW_QUEUE | cut -d_ -f4)
fi
if [ "${CMSSW_FLAVOR}" != "X" ] ; then CONTEXT="${CMSSW_FLAVOR}/${CONTEXT}" ; fi
if [ "${CMSSW_FLAVOR}" != "X" ] ; then CMSSW_FLAVOR="default" ; fi
CONTEXT="${CMSSW_FLAVOR}/${CONTEXT}"
if [ "$1" != "" ] ; then CONTEXT="${CONTEXT}/$1" ; fi
else
CONTEXT="${COMMIT_STATUS_CONTEXT}"
Expand Down
41 changes: 41 additions & 0 deletions update-commit-statues-matching.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import github_utils
import argparse


def main():
parser = argparse.ArgumentParser()
parser.add_argument("--repository", "-r")
parser.add_argument("--commit", "-c")
parser.add_argument("--architecture", "-a")
parser.add_argument("--queue", "-u", required=False)
parser.add_argument("--prefix", "-p")
args = parser.parse_args()

status_suffix = args.architecture
if args.queue:
flavor = args.queue.split("_")[3]
if flavor != "X":
status_suffix = flavor + "/" + status_suffix

all_statuses = github_utils.get_combined_statuses(args.commit, args.repository).get(
"statuses", []
)
index = 0

for status in all_statuses:
if (
status["context"].startswith(args.prefix + "/" + status_suffix)
and status["state"] == "pending"
):
with open("update-pr-status-{0}.prop".format(index), "w") as f:
f.write("REPOSITORY={0}\n".format(args.repository))
f.write("PULL_REQUEST={0}\n".format(args.commit))
f.write("CONTEXT={0}\n".format(status["context"]))
f.write("STATUS=error\n")
f.write("STATUS_MESSAGE=Stuck due to all nodes being offline\n")

index = index + 1


if __name__ == "__main__":
main()

0 comments on commit b27c572

Please sign in to comment.