api/koji: return pending status until all jobs are finished

Previously, the compose status returned failure as soon as possible.
koji-osbuild considers the job as done when its status == failure and proceeds
with uploading the logs to koji and marking the job as failed. However, not
all osbuild-composer jobs might be done at this point so the logs might be
incomplete making the debugging hard.

This commit changes the behaviour: Now, the compose status is pending until
ALL jobs belonging to it are finished.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
Ondřej Budai 2020-11-30 08:57:56 +01:00 committed by Ondřej Budai
parent e10a7f1ccc
commit 00cd4cb346

View file

@ -230,6 +230,10 @@ func composeStatusFromJobStatus(js *worker.JobStatus, initResult *worker.KojiIni
return "failure"
}
if js.Finished.IsZero() {
return "pending"
}
if initResult.KojiError != "" {
return "failure"
}
@ -243,10 +247,6 @@ func composeStatusFromJobStatus(js *worker.JobStatus, initResult *worker.KojiIni
}
}
if js.Finished.IsZero() {
return "pending"
}
if result.KojiError == "" {
return "success"
}