This simply calls the underlying Makefile target, but allows
additional arguments to be specified in a more convenient and
discoverable way.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
ci/helper | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/ci/helper b/ci/helper
index 420e9b73c2..8eb521ae40 100755
--- a/ci/helper
+++ b/ci/helper
@@ -17,6 +17,7 @@
# <
http://www.gnu.org/licenses/>.
import argparse
+import os
import pathlib
import pty
import shutil
@@ -26,6 +27,34 @@ import sys
class Parser:
def __init__(self):
+ # Options that are common to all actions that use containers
+ containerparser = argparse.ArgumentParser(add_help=False)
+ containerparser.add_argument(
+ "target",
+ help="build on target OS",
+ )
+ containerparser.add_argument(
+ "--engine",
+ choices=["auto", "podman", "docker"],
+ default="auto",
+ help="container engine to use",
+ )
+ containerparser.add_argument(
+ "--login",
+ default=os.getlogin(), # exempt from syntax-check
+ help="login to use inside the container",
+ )
+ containerparser.add_argument(
+ "--image-prefix",
+
default="registry.gitlab.com/libvirt/libvirt/ci-",
+ help="use container images from non-default location",
+ )
+ containerparser.add_argument(
+ "--image-tag",
+ default=":latest",
+ help="use container images with non-default tags",
+ )
+
# Options that are common to all actions that use lcitool
lcitoolparser = argparse.ArgumentParser(add_help=False)
lcitoolparser.add_argument(
@@ -43,6 +72,14 @@ class Parser:
)
subparsers.required = True
+ # shell action
+ shellparser = subparsers.add_parser(
+ "shell",
+ help="start a shell in a container",
+ parents=[containerparser],
+ )
+ shellparser.set_defaults(func=Application.action_shell)
+
# list-images action
listimagesparser = subparsers.add_parser(
"list-images",
@@ -78,6 +115,14 @@ class Application:
target,
]
+ if self.args.action == "shell":
+ args.extend([
+ f"CI_ENGINE={self.args.engine}",
+ f"CI_USER_LOGIN={self.args.login}",
+ f"CI_IMAGE_PREFIX={self.args.image_prefix}",
+ f"CI_IMAGE_TAG={self.args.image_tag}",
+ ])
+
if pty.spawn(["make"] + args) != 0:
sys.exit("error: 'make' failed")
@@ -155,6 +200,9 @@ class Application:
print(f"cirrus/{host}")
self.generate_vars(host)
+ def action_shell(self):
+ self.make_run(f"ci-shell(a){self.args.target}")
+
def action_list_images(self):
self.make_run(f"ci-list-images")
--
2.26.2