From nobody Sun Feb 8 05:07:51 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549389284349118.30304199932777; Tue, 5 Feb 2019 09:54:44 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 56CB3C0641E2; Tue, 5 Feb 2019 17:54:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F01256152F; Tue, 5 Feb 2019 17:54:41 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8F02B3F604; Tue, 5 Feb 2019 17:54:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x15HrYUH002957 for ; Tue, 5 Feb 2019 12:53:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2B4F560E3F; Tue, 5 Feb 2019 17:53:34 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6706960BF1; Tue, 5 Feb 2019 17:53:29 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Tue, 5 Feb 2019 17:53:06 +0000 Message-Id: <20190205175306.6859-10-berrange@redhat.com> In-Reply-To: <20190205175306.6859-1-berrange@redhat.com> References: <20190205175306.6859-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH v2 9/9] docker: add a makefile for building docker images locally X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 05 Feb 2019 17:54:43 +0000 (UTC) Add a simple makefile that can generate dockerfiles and run local builds of them. Signed-off-by: Daniel P. Berrang=C3=A9 --- .gitignore | 1 + dockerfiles/Makefile | 33 +++++++++++++++++++++++++++++++++ guests/lcitool | 15 +++++++++++++-- 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 dockerfiles/Makefile diff --git a/.gitignore b/.gitignore index b25c15b..c92cb0e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *~ +dockerfiles/*.docker diff --git a/dockerfiles/Makefile b/dockerfiles/Makefile new file mode 100644 index 0000000..0075840 --- /dev/null +++ b/dockerfiles/Makefile @@ -0,0 +1,33 @@ + +LCITOOL =3D ../guests/lcitool + +HOSTS =3D $(shell $(LCITOOL) -a hosts) + +CROSS_HOST =3D libvirt-debian-9 + +ARCHES =3D $(shell $(LCITOOL) -a arches -h $(CROSS_HOST)) + +CONFIGS =3D $(wildcard ../guests/host_vars/*/docker.yml) + +DOCKERFILES =3D $(shell $(LCITOOL) -a dockerfiles) + +DOCKERIMAGES =3D $(DOCKERFILES:%.docker=3D%) + +all: $(DOCKERFILES) + +buildenv-%.docker: $(LCITOOL) $(CONFIGS) + case $@ in \ + *cross*) \ + HOST=3D`echo $@ | sed -e 's/-cross-.*//' -e 's/buildenv-//' -e 's= /.docker//'` && \ + ARCH=3D`echo $@ | sed -e 's/^.*-cross-//' -e 's/.docker//'` && \ + $(LCITOOL) -a dockerfile -p libvirt -h $$HOST -x $$ARCH > $@ ;; \ + *) \ + HOST=3D`echo $@ | sed -e 's/buildenv-//' -e 's/.docker//'` && \ + $(LCITOOL) -a dockerfile -p libvirt -h $$HOST > $@ ;; \ + esac + +buildenv-%: buildenv-%.docker + docker build --tag $@ -f $< . + +clean: + rm -f *.docker *~ diff --git a/guests/lcitool b/guests/lcitool index dc5741e..a5ae817 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -313,8 +313,9 @@ class Application: build build projects on hosts =20 informational actions: - hosts list all known hosts - projects list all known projects + hosts list all known hosts + projects list all known projects + dockerfiles list all known dockerfiles =20 uncommon actions: dockerfile generate Dockerfile (doesn't access the host) @@ -415,6 +416,16 @@ class Application: for project in self._projects.expand_pattern("all"): print(project) =20 + def _action_dockerfiles(self, _hosts, _projects, _revision, _cross_arc= h): + for host in self._inventory.expand_pattern("all"): + facts =3D self._inventory.get_facts(host) + package_format =3D facts["package_format"] + if package_format not in ["deb", "rpm"]: + continue + print ("buildenv-%s.docker" % host) + for arch in facts.get("cross_build", {}).get("arches", {}).key= s(): + print ("buildenv-%s-cross-%s.docker" % (host, arch)) + def _action_install(self, hosts, _projects, _revision, _cross_arch): base =3D Util.get_base() =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list