From ee8a56e64dce68258610a5971342fce22bf78a47 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Tue, 12 Mar 2024 08:18:52 -0700 Subject: [PATCH] Various phases: consistent format of failure message composetracker expects the failure message to be in a specific form, but some phases weren't using it. They were phrasing it slightly differently, which throws off composetracker's parsing. We could extend composetracker to handle both forms, but it seems simpler to just make all the phases use a consistent form. Signed-off-by: Adam Williamson (cherry picked from commit 9f8377abab2c600e25541ea0012ae58a67e7ce66) --- pungi/phases/image_container.py | 2 +- pungi/phases/kiwibuild.py | 2 +- pungi/phases/osbs.py | 2 +- pungi/phases/osbuild.py | 2 +- tests/test_image_container_phase.py | 2 +- tests/test_osbs_phase.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pungi/phases/image_container.py b/pungi/phases/image_container.py index f7139263..9ff30273 100644 --- a/pungi/phases/image_container.py +++ b/pungi/phases/image_container.py @@ -76,7 +76,7 @@ class ImageContainerThread(WorkerThread): ) if koji.watch_task(task_id, log_file) != 0: raise RuntimeError( - "ImageContainer: task %s failed: see %s for details" + "ImageContainer task failed: %s. See %s for details" % (task_id, log_file) ) diff --git a/pungi/phases/kiwibuild.py b/pungi/phases/kiwibuild.py index 328a8bb3..2c06b3f1 100644 --- a/pungi/phases/kiwibuild.py +++ b/pungi/phases/kiwibuild.py @@ -148,7 +148,7 @@ class RunKiwiBuildThread(WorkerThread): ) if koji.watch_task(task_id, log_file) != 0: raise RuntimeError( - "kiwiBuild: task %s failed: see %s for details" % (task_id, log_file) + "kiwiBuild task failed: %s. See %s for details" % (task_id, log_file) ) # Refresh koji session which may have timed out while the task was diff --git a/pungi/phases/osbs.py b/pungi/phases/osbs.py index e5ddcb60..c6a337b0 100644 --- a/pungi/phases/osbs.py +++ b/pungi/phases/osbs.py @@ -134,7 +134,7 @@ class OSBSThread(WorkerThread): # though there is not much there). if koji.watch_task(task_id, log_file) != 0: raise RuntimeError( - "OSBS: task %s failed: see %s for details" % (task_id, log_file) + "OSBS task failed: %s. See %s for details" % (task_id, log_file) ) scratch = config.get("scratch", False) diff --git a/pungi/phases/osbuild.py b/pungi/phases/osbuild.py index 35d3318f..6c5b7e5a 100644 --- a/pungi/phases/osbuild.py +++ b/pungi/phases/osbuild.py @@ -185,7 +185,7 @@ class RunOSBuildThread(WorkerThread): ) if koji.watch_task(task_id, log_file) != 0: raise RuntimeError( - "OSBuild: task %s failed: see %s for details" % (task_id, log_file) + "OSBuild task failed: %s. See %s for details" % (task_id, log_file) ) # Refresh koji session which may have timed out while the task was diff --git a/tests/test_image_container_phase.py b/tests/test_image_container_phase.py index 36282c25..ab6a301b 100644 --- a/tests/test_image_container_phase.py +++ b/tests/test_image_container_phase.py @@ -227,7 +227,7 @@ class ImageContainerThreadTest(helpers.PungiTestCase): (self.compose, self.compose.variants["Server"], self.cfg.copy()), 1 ) - self.assertRegex(str(ctx.exception), r"task 12345 failed: see .+ for details") + self.assertRegex(str(ctx.exception), r"task failed: 12345. See .+ for details") self.assertRepoFile() self.assertKojiCalls(self.cfg) self.assertEqual(add_metadata.call_args_list, []) diff --git a/tests/test_osbs_phase.py b/tests/test_osbs_phase.py index d5c9febc..7836e651 100644 --- a/tests/test_osbs_phase.py +++ b/tests/test_osbs_phase.py @@ -576,7 +576,7 @@ class OSBSThreadTest(helpers.PungiTestCase): with self.assertRaises(RuntimeError) as ctx: self.t.process((self.compose, self.compose.variants["Server"], cfg), 1) - self.assertRegex(str(ctx.exception), r"task 12345 failed: see .+ for details") + self.assertRegex(str(ctx.exception), r"task failed: 12345. See .+ for details") @mock.patch("pungi.phases.osbs.get_file_from_scm") @mock.patch("pungi.phases.osbs.kojiwrapper.KojiWrapper")