[jenkins-ci PATCH 2/2] quayadmin: Add create-build command

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

 



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

diff --git a/guests/quayadmin b/guests/quayadmin
index 02be0f4..8099d6a 100755
--- a/guests/quayadmin
+++ b/guests/quayadmin
@@ -318,6 +318,29 @@ def run_show_build(config, args):
     print("  started: {}".format(info["started"]))
 
 
+def run_create_build(config, args):
+    endpoint = "/repository/{}/{}/build/".format(args.namespace, args.repo)
+    payload = {
+        "archive_url": args.archive_url,
+    }
+
+    res = post(config, endpoint, payload=payload, debug=args.debug)
+
+    if has_error(args.quiet, res, 201,
+                 "Cannot create build for repository {}/{}"
+                 .format(args.namespace, args.repo)):
+        return 1
+
+    if args.quiet:
+        return 0
+
+    info = res.json()
+
+    print("Build {} created in repository {}/{}".format(info["id"],
+                                                        args.namespace,
+                                                        args.repo))
+
+
 def run_list_triggers(config, args):
     endpoint = "/repository/{}/{}/trigger/".format(args.namespace, args.repo)
 
@@ -415,6 +438,10 @@ def add_arg_image(parser):
     parser.add_argument("image", help="Image ID")
 
 
+def add_arg_archive_url(parser):
+    parser.add_argument("archive_url", help="Archive URL")
+
+
 def build_parser_list_repos(subparser):
     parser = subparser.add_parser("list-repos", help="List container repositories")
 
@@ -510,6 +537,16 @@ def build_parser_show_build(subparser):
     add_arg_build(parser)
 
 
+def build_parser_create_build(subparser):
+    parser = subparser.add_parser("create-build", help="Create a new build")
+
+    parser.set_defaults(func=run_create_build)
+
+    add_arg_namespace(parser)
+    add_arg_repo(parser)
+    add_arg_archive_url(parser)
+
+
 def build_parser_list_triggers(subparser):
     parser = subparser.add_parser("list-triggers", help="List repository triggers")
 
@@ -563,6 +600,7 @@ def build_parser():
 
     build_parser_list_builds(subparser)
     build_parser_show_build(subparser)
+    build_parser_create_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