[jenkins-ci PATCH 20/20] quayadmin: Add delete-tag command

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

 



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

diff --git a/guests/quayadmin b/guests/quayadmin
index ad26c75..63af0f9 100755
--- a/guests/quayadmin
+++ b/guests/quayadmin
@@ -247,6 +247,23 @@ def run_create_tag(config, args):
                                                           args.repo))
 
 
+def run_delete_tag(config, args):
+    endpoint = "/repository/{}/{}/tag/{}".format(args.namespace, args.repo,
+                                                 args.tag)
+
+    res = delete(config, endpoint, debug=args.debug)
+
+    if has_error(args.quiet, res, 204,
+                 "Cannot delete tag {} from repository {}/{}"
+                 .format(args.tag, args.namespace, args.repo)):
+        return 1
+
+    if not args.quiet:
+        print("Tag {} deleted from repository {}/{}".format(args.tag,
+                                                            args.namespace,
+                                                            args.repo))
+
+
 def run_list_builds(config, args):
     endpoint = "/repository/{}/{}/build".format(args.namespace, args.repo)
 
@@ -442,6 +459,16 @@ def build_parser_create_tag(subparser):
     add_arg_image(parser)
 
 
+def build_parser_delete_tag(subparser):
+    parser = subparser.add_parser("delete-tag", help="Delete an existing tag")
+
+    parser.set_defaults(func=run_delete_tag)
+
+    add_arg_namespace(parser)
+    add_arg_repo(parser)
+    add_arg_tag(parser)
+
+
 def build_parser_list_builds(subparser):
     parser = subparser.add_parser("list-builds", help="List repository builds")
 
@@ -510,6 +537,7 @@ def build_parser():
     build_parser_list_tags(subparser)
     build_parser_show_tag(subparser)
     build_parser_create_tag(subparser)
+    build_parser_delete_tag(subparser)
 
     build_parser_list_builds(subparser)
     build_parser_show_build(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