[libvirt PATCH 08/11] ci: helper: Add _make_run_action() function

Andrea Bolognani abologna at redhat.com
Fri Apr 23 15:03:05 UTC 2021


This provides a single place where we can process self._args
before handing the control over to make; later on, we're going
to implement more logic that can be shared by the build, test
and shell actions.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 ci/helper | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/ci/helper b/ci/helper
index 6543a47131..31e05c0e38 100755
--- a/ci/helper
+++ b/ci/helper
@@ -186,6 +186,11 @@ class Application:
         if pty.spawn(["make"] + args) != 0:
             sys.exit("error: 'make' failed")
 
+    def _make_run_action(self, action):
+        target = self._args.target
+        make_target = f"{action}@{target}"
+        self._make_run(make_target)
+
     def _lcitool_run(self, args):
         output = subprocess.check_output([self._args.lcitool] + args)
         return output.decode("utf-8")
@@ -298,13 +303,13 @@ class Application:
             print(msg.replace("STALE_DETAILS", stale_details))
 
     def _action_build(self):
-        self._make_run(f"ci-build@{self._args.target}")
+        self._make_run_action("ci-build")
 
     def _action_test(self):
-        self._make_run(f"ci-test@{self._args.target}")
+        self._make_run_action("ci-test")
 
     def _action_shell(self):
-        self._make_run(f"ci-shell@{self._args.target}")
+        self._make_run_action("ci-shell")
 
     def _action_list_images(self):
         registry_uri = util.get_registry_uri(self._args.namespace,
-- 
2.26.3




More information about the libvir-list mailing list