From 00cd4cb346628030dba1a53b4286b28cef622dca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Budai?= Date: Mon, 30 Nov 2020 08:57:56 +0100 Subject: [PATCH] api/koji: return pending status until all jobs are finished MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- internal/kojiapi/server.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/kojiapi/server.go b/internal/kojiapi/server.go index ef330fb48..963b11e7c 100644 --- a/internal/kojiapi/server.go +++ b/internal/kojiapi/server.go @@ -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" }