From: "Alex Bennée" <alex.bennee@linaro.org>
To: cota@braap.org, famz@redhat.com, berrange@redhat.com,
f4bug@amsat.org, richard.henderson@linaro.org, balrogg@gmail.com,
aurelien@aurel32.net, agraf@suse.de, pbonzini@redhat.com,
stefanha@redhat.com, stefanb@linux.vnet.ibm.com,
marcandre.lureau@redhat.com
Cc: qemu-devel@nongnu.org, "Alex Bennée" <alex.bennee@linaro.org>
Subject: [Qemu-devel] [RFC PATCH 2/3] dcoker: docker.py add check sub-command
Date: Fri, 8 Jun 2018 17:04:31 +0100 [thread overview]
Message-ID: <20180608160432.8734-3-alex.bennee@linaro.org> (raw)
In-Reply-To: <20180608160432.8734-1-alex.bennee@linaro.org>
This command allows you to check if we need to re-build a docker
image. If the image isn't in the repository or the checksums don't
match then we return false and some text (for processing in
makefiles).
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
tests/docker/docker.py | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index 80efa641c5..c2763957c9 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -441,6 +441,28 @@ class CcCommand(SubCommand):
return Docker().command("run", cmd, args.quiet)
+class CheckCommand(SubCommand):
+ """Check if we need to re-build a docker image out of a dockerfile. Arguments: <tag> <dockerfile>"""
+ name = "check"
+ def args(self, parser):
+ parser.add_argument("tag",
+ help="Image Tag")
+ parser.add_argument("dockerfile",
+ help="Dockerfile name")
+
+ def run(self, args, argv):
+ dockerfile = open(args.dockerfile, "rb").read()
+ tag = args.tag
+
+ dkr = Docker()
+ if dkr.image_matches_dockerfile(tag, dockerfile):
+ if not args.quiet:
+ print "Image is up to date."
+ return 0
+ else:
+ print "Image needs updating"
+ return 1
+
def main():
parser = argparse.ArgumentParser(description="A Docker helper",
usage="%s <subcommand> ..." % os.path.basename(sys.argv[0]))
--
2.17.1
next prev parent reply other threads:[~2018-06-08 16:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-08 16:04 [Qemu-devel] [RFC PATCH 0/3] Better docker dependency checking Alex Bennée
2018-06-08 16:04 ` [Qemu-devel] [RFC PATCH 1/3] docker: docker.py don't conflate checksums for extra_files Alex Bennée
2018-06-08 16:04 ` Alex Bennée [this message]
2018-06-08 16:04 ` [Qemu-devel] [RFC PATCH 3/3] docker: remove SUBMAKE_NOCACHE_HACK for debian-sid based images Alex Bennée
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180608160432.8734-3-alex.bennee@linaro.org \
--to=alex.bennee@linaro.org \
--cc=agraf@suse.de \
--cc=aurelien@aurel32.net \
--cc=balrogg@gmail.com \
--cc=berrange@redhat.com \
--cc=cota@braap.org \
--cc=f4bug@amsat.org \
--cc=famz@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=stefanb@linux.vnet.ibm.com \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).