diff mbox series

[v1,4/7] tests/docker: add "fetch" sub-command

Message ID 20210310192331.29284-5-alex.bennee@linaro.org
State Superseded
Headers show
Series testing/next (hexagon 2, electric boogaloo) | expand

Commit Message

Alex Bennée March 10, 2021, 7:23 p.m. UTC
This simply wraps up fetching a build from the registry and tagging it
as the local build.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
 tests/docker/docker.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

-- 
2.20.1

Comments

Philippe Mathieu-Daudé March 10, 2021, 8:13 p.m. UTC | #1
On 3/10/21 8:23 PM, Alex Bennée wrote:
> This simply wraps up fetching a build from the registry and tagging it

> as the local build.

> 

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> ---

>  tests/docker/docker.py | 17 +++++++++++++++++

>  1 file changed, 17 insertions(+)


Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
diff mbox series

Patch

diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index 86d31a5fe6..f6f461bbc9 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -515,6 +515,23 @@  def run(self, args, argv):
 
         return 0
 
+class FetchCommand(SubCommand):
+    """ Fetch a docker image from the registry. Args: <tag> <registry>"""
+    name = "fetch"
+
+    def args(self, parser):
+        parser.add_argument("tag",
+                            help="Local tag for image")
+        parser.add_argument("registry",
+                            help="Docker registry")
+
+    def run(self, args, argv):
+        dkr = Docker()
+        dkr.command(cmd="pull", quiet=args.quiet,
+                    argv=["%s/%s" % (args.registry, args.tag)])
+        dkr.command(cmd="tag", quiet=args.quiet,
+                    argv=["%s/%s" % (args.registry, args.tag), args.tag])
+
 
 class UpdateCommand(SubCommand):
     """ Update a docker image. Args: <tag> <actions>"""