diff mbox series

[for,2.10,v3,4/6] docker: docker.py make --no-cache skip checksum test

Message ID 20170807153934.29477-5-alex.bennee@linaro.org
State Superseded
Headers show
Series Various docker fixes | expand

Commit Message

Alex Bennée Aug. 7, 2017, 3:39 p.m. UTC
If you invoke with NOCACHE=1 we pass --no-cache in the argv to
docker.py but may still not force a rebuild if the dockerfile checksum
hasn't changed. By testing for its presence we can force builds
without having to manually remove the docker image.

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

---
 tests/docker/docker.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

-- 
2.13.0

Comments

Fam Zheng Aug. 8, 2017, 1:43 a.m. UTC | #1
On Mon, 08/07 16:39, Alex Bennée wrote:
> If you invoke with NOCACHE=1 we pass --no-cache in the argv to

> docker.py but may still not force a rebuild if the dockerfile checksum

> hasn't changed. By testing for its presence we can force builds

> without having to manually remove the docker image.

> 

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

> ---

>  tests/docker/docker.py | 3 ++-

>  1 file changed, 2 insertions(+), 1 deletion(-)

> 

> diff --git a/tests/docker/docker.py b/tests/docker/docker.py

> index ee40ca04d9..aab1648cc5 100755

> --- a/tests/docker/docker.py

> +++ b/tests/docker/docker.py

> @@ -261,7 +261,8 @@ class BuildCommand(SubCommand):

>          tag = args.tag

>  

>          dkr = Docker()

> -        if dkr.image_matches_dockerfile(tag, dockerfile):

> +        if "--no-cache" not in argv and \

> +           dkr.image_matches_dockerfile(tag, dockerfile):

>              if not args.quiet:

>                  print "Image is up to date."

>          else:

> -- 

> 2.13.0

> 

> 


NACK.

Please add "--no-cache" to BuildCommand.args, and use args.no_cache.diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index ee40ca04d9..530bc62d40 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -251,6 +251,8 @@ class BuildCommand(SubCommand):
         parser.add_argument("--add-current-user", "-u", dest="user",
                             action="store_true",
                             help="Add the current user to image's passwd")
+        parser.add_argument("--no-cache", action="store_true",
+                            help="Disable docker cache and checksum")
         parser.add_argument("tag",
                             help="Image Tag")
         parser.add_argument("dockerfile",

Alex Bennée Aug. 8, 2017, 8:51 a.m. UTC | #2
Fam Zheng <famz@redhat.com> writes:

> On Mon, 08/07 16:39, Alex Bennée wrote:

>> If you invoke with NOCACHE=1 we pass --no-cache in the argv to

>> docker.py but may still not force a rebuild if the dockerfile checksum

>> hasn't changed. By testing for its presence we can force builds

>> without having to manually remove the docker image.

>>

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

>> ---

>>  tests/docker/docker.py | 3 ++-

>>  1 file changed, 2 insertions(+), 1 deletion(-)

>>

>> diff --git a/tests/docker/docker.py b/tests/docker/docker.py

>> index ee40ca04d9..aab1648cc5 100755

>> --- a/tests/docker/docker.py

>> +++ b/tests/docker/docker.py

>> @@ -261,7 +261,8 @@ class BuildCommand(SubCommand):

>>          tag = args.tag

>>

>>          dkr = Docker()

>> -        if dkr.image_matches_dockerfile(tag, dockerfile):

>> +        if "--no-cache" not in argv and \

>> +           dkr.image_matches_dockerfile(tag, dockerfile):

>>              if not args.quiet:

>>                  print "Image is up to date."

>>          else:

>> --

>> 2.13.0

>>

>>

>

> NACK.

>

> Please add "--no-cache" to BuildCommand.args, and use args.no_cache.

>

> diff --git a/tests/docker/docker.py b/tests/docker/docker.py

> index ee40ca04d9..530bc62d40 100755

> --- a/tests/docker/docker.py

> +++ b/tests/docker/docker.py

> @@ -251,6 +251,8 @@ class BuildCommand(SubCommand):

>          parser.add_argument("--add-current-user", "-u", dest="user",

>                              action="store_true",

>                              help="Add the current user to image's passwd")

> +        parser.add_argument("--no-cache", action="store_true",

> +                            help="Disable docker cache and checksum")

>          parser.add_argument("tag",

>                              help="Image Tag")

>          parser.add_argument("dockerfile",


Fair enough, I just didn't want to clash with what usually gets passed
directly to the docker command.


--
Alex Bennée
Fam Zheng Aug. 8, 2017, 12:39 p.m. UTC | #3
On Tue, 08/08 09:51, Alex Bennée wrote:
> 

> Fam Zheng <famz@redhat.com> writes:

> 

> > On Mon, 08/07 16:39, Alex Bennée wrote:

> >> If you invoke with NOCACHE=1 we pass --no-cache in the argv to

> >> docker.py but may still not force a rebuild if the dockerfile checksum

> >> hasn't changed. By testing for its presence we can force builds

> >> without having to manually remove the docker image.

> >>

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

> >> ---

> >>  tests/docker/docker.py | 3 ++-

> >>  1 file changed, 2 insertions(+), 1 deletion(-)

> >>

> >> diff --git a/tests/docker/docker.py b/tests/docker/docker.py

> >> index ee40ca04d9..aab1648cc5 100755

> >> --- a/tests/docker/docker.py

> >> +++ b/tests/docker/docker.py

> >> @@ -261,7 +261,8 @@ class BuildCommand(SubCommand):

> >>          tag = args.tag

> >>

> >>          dkr = Docker()

> >> -        if dkr.image_matches_dockerfile(tag, dockerfile):

> >> +        if "--no-cache" not in argv and \

> >> +           dkr.image_matches_dockerfile(tag, dockerfile):

> >>              if not args.quiet:

> >>                  print "Image is up to date."

> >>          else:

> >> --

> >> 2.13.0

> >>

> >>

> >

> > NACK.

> >

> > Please add "--no-cache" to BuildCommand.args, and use args.no_cache.

> >

> > diff --git a/tests/docker/docker.py b/tests/docker/docker.py

> > index ee40ca04d9..530bc62d40 100755

> > --- a/tests/docker/docker.py

> > +++ b/tests/docker/docker.py

> > @@ -251,6 +251,8 @@ class BuildCommand(SubCommand):

> >          parser.add_argument("--add-current-user", "-u", dest="user",

> >                              action="store_true",

> >                              help="Add the current user to image's passwd")

> > +        parser.add_argument("--no-cache", action="store_true",

> > +                            help="Disable docker cache and checksum")

> >          parser.add_argument("tag",

> >                              help="Image Tag")

> >          parser.add_argument("dockerfile",

> 

> Fair enough, I just didn't want to clash with what usually gets passed

> directly to the docker command.


Hmm, if we care about clashing maybe it's better to call it --no-checksum?

Fam
diff mbox series

Patch

diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index ee40ca04d9..aab1648cc5 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -261,7 +261,8 @@  class BuildCommand(SubCommand):
         tag = args.tag
 
         dkr = Docker()
-        if dkr.image_matches_dockerfile(tag, dockerfile):
+        if "--no-cache" not in argv and \
+           dkr.image_matches_dockerfile(tag, dockerfile):
             if not args.quiet:
                 print "Image is up to date."
         else: