Skip to content

Commit

Permalink
Better handle Koji build state
Browse files Browse the repository at this point in the history
  • Loading branch information
msrb committed Feb 22, 2022
1 parent 2e9440c commit 3e749f7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions wait-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# Return codes:
# 0 success
# 100 no build found for given package name
# 1 failure
# 150 bad params

if [ $# -ne 1 ]; then
Expand All @@ -22,17 +22,20 @@ state="free"
while true
do
"${koji_bin}" watch-task "${task_id}"
# Are we really done? The state of the task should be "closed"
# Are we done?
# free/open/assigned means not done yet
# closed/failed/cancelled means that the task is finished
state=$("${koji_bin}" taskinfo "${task_id}" | grep '^State: ' | awk -F' ' '{ print $2 }')
if [ "${state}" == "free" ] || [ "${state}" == "open" ]; then
if [ "${state}" == "free" ] || [ "${state}" == "open" ] || [ "${state}" == "assigned" ]; then
# Nope, the task is still in progress -- let's continue watching it...
continue
fi
# We are really done here!
break
done

if [ "${state}" == "failed" ]; then
# "closed" means success, everything else is a failure
if [ "${state}" != "closed" ]; then
exit 1
fi

Expand Down

0 comments on commit 3e749f7

Please sign in to comment.