Connect cli to release_docker_hub 7(7). 34/13734/10
authorBengt Thuree <bthuree@linuxfoundation.org>
Thu, 29 Nov 2018 11:22:38 +0000 (22:22 +1100)
committerBengt Thuree <bthuree@linuxfoundation.org>
Fri, 15 Mar 2019 02:44:32 +0000 (13:44 +1100)
This is the seventh, and final part, which adds the
cli part.

Issue:RELENG-1549
Change-Id: I629d575730abd73425dacd5e694a30cadcd85657
Signed-off-by: Bengt Thuree <bthuree@linuxfoundation.org>
lftools/cli/nexus.py

index a1d928a..f4bde7c 100644 (file)
@@ -13,6 +13,7 @@ from os import environ
 import click
 
 from lftools.nexus import cmd as nexuscmd
+import lftools.nexus.release_docker_hub as rdh
 
 NEXUS_URL_ENV = 'NEXUS_URL'
 
@@ -131,3 +132,33 @@ def release(ctx, repos, server):
     if not server and NEXUS_URL_ENV in environ:
         server = environ[NEXUS_URL_ENV]
     nexuscmd.release_staging_repos(repos, server)
+
+
+@docker.command(name="releasedockerhub")
+@click.option(
+    '-o', '--org', type=str, required=True,
+    help='Specify repository organization.')
+@click.option(
+    '-r', '--repo', type=str, default='', required=False,
+    help='Only repos containing this string will be selected. '
+         'Default set to blank string, which is every repo.')
+@click.option(
+    '-s', '--summary', is_flag=True, required=False,
+    help='Prints a summary of missing docker tags.')
+@click.option(
+    '-v', '--verbose', is_flag=True, required=False,
+    help='Prints all collected repo/tag information.')
+@click.option(
+    '-c', '--copy', is_flag=True, required=False,
+    help='Copy missing tags from Nexus3 repos to Docker Hub repos.')
+@click.option(
+    '-p', '--progbar', is_flag=True, required=False, default=False,
+    help='Display a progress bar for the time consuming jobs.')
+@click.pass_context
+def copy_from_nexus3_to_dockerhub(ctx, org, repo, summary, verbose, copy, progbar):
+    """Find missing repos in Docker Hub, Copy from Nexus3.
+
+    Will by default list all missing repos in Docker Hub, compared to Nexus3.
+    If -c (--copy) is provided, it will copy the repos from Nexus3 to Docker Hub.
+    """
+    rdh.start_point(org, repo, summary, verbose, copy, progbar)