[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 29/30] tests/docker: remove FROM qemu/ support from docker.py
From: |
Alex Bennée |
Subject: |
[PATCH v2 29/30] tests/docker: remove FROM qemu/ support from docker.py |
Date: |
Wed, 14 Sep 2022 16:59:49 +0100 |
We want to migrate from docker.py to building our images directly with
docker/podman. Before we get there we need to make sure we don't
re-introduce our layered builds so bug out if we see FROM qemu/ in a
Dockerfile.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20220826172128.353798-24-alex.bennee@linaro.org>
---
tests/docker/docker.py | 38 ++++++++++----------------------------
1 file changed, 10 insertions(+), 28 deletions(-)
diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index d0af2861b8..3a1ed7cb18 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -205,22 +205,17 @@ def _read_qemu_dockerfile(img_name):
return _read_dockerfile(df)
-def _dockerfile_preprocess(df):
- out = ""
+def _dockerfile_verify_flat(df):
+ "Verify we do not include other qemu/ layers"
for l in df.splitlines():
if len(l.strip()) == 0 or l.startswith("#"):
continue
from_pref = "FROM qemu/"
if l.startswith(from_pref):
- # TODO: Alternatively we could replace this line with "FROM $ID"
- # where $ID is the image's hex id obtained with
- # $ docker images $IMAGE --format="{{.Id}}"
- # but unfortunately that's not supported by RHEL 7.
- inlining = _read_qemu_dockerfile(l[len(from_pref):])
- out += _dockerfile_preprocess(inlining)
- continue
- out += l + "\n"
- return out
+ print("We no longer support multiple QEMU layers.")
+ print("Dockerfiles should be flat, ideally created by lcitool")
+ return False
+ return True
class Docker(object):
@@ -309,23 +304,10 @@ def build_image(self, tag, docker_dir, dockerfile,
if argv is None:
argv = []
- # pre-calculate the docker checksum before any
- # substitutions we make for caching
- checksum = _text_checksum(_dockerfile_preprocess(dockerfile))
+ if not _dockerfile_verify_flat(dockerfile):
+ return -1
- if registry is not None:
- sources = re.findall("FROM qemu\/(.*)", dockerfile)
- # Fetch any cache layers we can, may fail
- for s in sources:
- pull_args = ["pull", "%s/qemu/%s" % (registry, s)]
- if self._do(pull_args, quiet=quiet) != 0:
- registry = None
- break
- # Make substitutions
- if registry is not None:
- dockerfile = dockerfile.replace("FROM qemu/",
- "FROM %s/qemu/" %
- (registry))
+ checksum = _text_checksum(dockerfile)
tmp_df = tempfile.NamedTemporaryFile(mode="w+t",
encoding='utf-8',
@@ -371,7 +353,7 @@ def image_matches_dockerfile(self, tag, dockerfile):
checksum = self.get_image_dockerfile_checksum(tag)
except Exception:
return False
- return checksum == _text_checksum(_dockerfile_preprocess(dockerfile))
+ return checksum == _text_checksum(dockerfile)
def run(self, cmd, keep, quiet, as_user=False):
label = uuid.uuid4().hex
--
2.34.1
- [PATCH v2 14/30] tests/docker: flatten debian-powerpc-test-cross, (continued)
- [PATCH v2 14/30] tests/docker: flatten debian-powerpc-test-cross, Alex Bennée, 2022/09/14
- [PATCH v2 16/30] tests/docker: remove amd64 qemu/debian10 dependency, Alex Bennée, 2022/09/14
- [PATCH v2 13/30] tests/docker: update and flatten debian-sparc64-cross, Alex Bennée, 2022/09/14
- [PATCH v2 15/30] tests/docker: remove tricore qemu/debian10 dependency, Alex Bennée, 2022/09/14
- [PATCH v2 19/30] gitlab-ci/custom-runners: Disable -static-pie for ubuntu-20.04-aarch64, Alex Bennée, 2022/09/14
- [PATCH v2 27/30] tests/docker: update and flatten debian-hexagon-cross, Alex Bennée, 2022/09/14
- [PATCH v2 17/30] tests/vm: Remove obsolete Fedora VM test, Alex Bennée, 2022/09/14
- [PATCH v2 29/30] tests/docker: remove FROM qemu/ support from docker.py,
Alex Bennée <=
- [PATCH v2 11/30] tests/docker: update and flatten debian-mips64-cross, Alex Bennée, 2022/09/14
- [PATCH v2 22/30] tests/docker: flatten debian-riscv64-test-cross, Alex Bennée, 2022/09/14
- [PATCH v2 25/30] tests/docker: update and flatten debian-amd64-cross, Alex Bennée, 2022/09/14
- [PATCH v2 26/30] tests/docker: update and flatten debian-loongarch-cross, Alex Bennée, 2022/09/14
- [PATCH v2 28/30] tests/docker: update and flatten debian-toolchain, Alex Bennée, 2022/09/14
- [PATCH v2 18/30] configure: explicitly set cflags for --disable-pie, Alex Bennée, 2022/09/14