[jenkins-ci PATCH 16/20] quayadmin: Add show-build command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 guests/quayadmin | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/guests/quayadmin b/guests/quayadmin
index 7cc9b5a..a537706 100755
--- a/guests/quayadmin
+++ b/guests/quayadmin
@@ -189,6 +189,27 @@ def run_list_builds(config, args):
         print(build["id"])
 
 
+def run_show_build(config, args):
+    endpoint = "/repository/{}/{}/build/{}".format(args.namespace,
+                                                   args.repo, args.build)
+
+    res = get(config, endpoint, debug=args.debug)
+
+    if has_error(args.quiet, res, 200,
+                 "Cannot query build {} for repository {}/{}"
+                 .format(args.build, args.namespace, args.repo)):
+        return 1
+
+    info = res.json()
+
+    print("build:")
+    print("  namespace: {}".format(args.namespace))
+    print("  repo: {}".format(args.repo))
+    print("  id: {}".format(args.build))
+    print("  phase: {}".format(info["phase"]))
+    print("  started: {}".format(info["started"]))
+
+
 def run_list_triggers(config, args):
     endpoint = "/repository/{}/{}/trigger".format(args.namespace, args.repo)
 
@@ -269,6 +290,10 @@ def add_arg_commit(parser):
     parser.add_argument("commit", help="Git commit hash")
 
 
+def add_arg_build(parser):
+    parser.add_argument("build", help="Build ID")
+
+
 def build_parser_list_repos(subparser):
     parser = subparser.add_parser("list-repos", help="List container repositories")
 
@@ -314,6 +339,16 @@ def build_parser_list_builds(subparser):
     add_arg_repo(parser)
 
 
+def build_parser_show_build(subparser):
+    parser = subparser.add_parser("show-build", help="Show build info")
+
+    parser.set_defaults(func=run_show_build)
+
+    add_arg_namespace(parser)
+    add_arg_repo(parser)
+    add_arg_build(parser)
+
+
 def build_parser_list_triggers(subparser):
     parser = subparser.add_parser("list-triggers", help="List repository triggers")
 
@@ -361,6 +396,7 @@ def build_parser():
     build_parser_delete_repo(subparser)
 
     build_parser_list_builds(subparser)
+    build_parser_show_build(subparser)
 
     build_parser_list_triggers(subparser)
     build_parser_show_trigger(subparser)
-- 
2.21.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux