[PATCH v2 02/25] tests/docker: don't use BUILDKIT in GitLab either

Daniel P. Berrangé posted 25 patches 4 years, 10 months ago
There is a newer version of this series
[PATCH v2 02/25] tests/docker: don't use BUILDKIT in GitLab either
Posted by Daniel P. Berrangé 4 years, 10 months ago
Using BUILDKIT breaks with certain container registries such as CentOS,
with docker build reporting an error such as

  failed to solve with frontend dockerfile.v0:
  failed to build LLB: failed to load cache key:
  unexpected status code
  https://registry.centos.org/v2/centos/manifests/7:
  403 Forbidden

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 tests/docker/docker.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index 36b7868406..d1d0da9419 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -222,7 +222,9 @@ class Docker(object):
     def __init__(self):
         self._command = _guess_engine_command()
 
-        if "docker" in self._command and "TRAVIS" not in os.environ:
+        if ("docker" in self._command and
+            "TRAVIS" not in os.environ and
+            "CI" not in os.environ):
             os.environ["DOCKER_BUILDKIT"] = "1"
             self._buildkit = True
         else:
-- 
2.29.2


Re: [PATCH v2 02/25] tests/docker: don't use BUILDKIT in GitLab either
Posted by Wainer dos Santos Moschetta 4 years, 10 months ago
Hi,

On 1/14/21 10:02 AM, Daniel P. Berrangé wrote:
> Using BUILDKIT breaks with certain container registries such as CentOS,
> with docker build reporting an error such as
>
>    failed to solve with frontend dockerfile.v0:
>    failed to build LLB: failed to load cache key:
>    unexpected status code
>    https://registry.centos.org/v2/centos/manifests/7:
>    403 Forbidden
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>   tests/docker/docker.py | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tests/docker/docker.py b/tests/docker/docker.py
> index 36b7868406..d1d0da9419 100755
> --- a/tests/docker/docker.py
> +++ b/tests/docker/docker.py
> @@ -222,7 +222,9 @@ class Docker(object):
>       def __init__(self):
>           self._command = _guess_engine_command()
>   
> -        if "docker" in self._command and "TRAVIS" not in os.environ:
> +        if ("docker" in self._command and
> +            "TRAVIS" not in os.environ and
> +            "CI" not in os.environ):


The variable CI is also exported in Travis. But if you want to keep this 
guard specific to gitlab then you can use GITLAB_CI.

- Wainer

>               os.environ["DOCKER_BUILDKIT"] = "1"
>               self._buildkit = True
>           else:


Re: [PATCH v2 02/25] tests/docker: don't use BUILDKIT in GitLab either
Posted by Daniel P. Berrangé 4 years, 10 months ago
On Fri, Jan 15, 2021 at 10:53:34AM -0300, Wainer dos Santos Moschetta wrote:
> Hi,
> 
> On 1/14/21 10:02 AM, Daniel P. Berrangé wrote:
> > Using BUILDKIT breaks with certain container registries such as CentOS,
> > with docker build reporting an error such as
> > 
> >    failed to solve with frontend dockerfile.v0:
> >    failed to build LLB: failed to load cache key:
> >    unexpected status code
> >    https://registry.centos.org/v2/centos/manifests/7:
> >    403 Forbidden
> > 
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > ---
> >   tests/docker/docker.py | 4 +++-
> >   1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tests/docker/docker.py b/tests/docker/docker.py
> > index 36b7868406..d1d0da9419 100755
> > --- a/tests/docker/docker.py
> > +++ b/tests/docker/docker.py
> > @@ -222,7 +222,9 @@ class Docker(object):
> >       def __init__(self):
> >           self._command = _guess_engine_command()
> > -        if "docker" in self._command and "TRAVIS" not in os.environ:
> > +        if ("docker" in self._command and
> > +            "TRAVIS" not in os.environ and
> > +            "CI" not in os.environ):
> 
> 
> The variable CI is also exported in Travis. But if you want to keep this
> guard specific to gitlab then you can use GITLAB_CI.

Ah good point, more specific is probably better.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|