From nobody Fri May 3 07:16:30 2024 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 1550143861700515.5395802956641; Thu, 14 Feb 2019 03:31:01 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9139E36883; Thu, 14 Feb 2019 11:30:59 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1F7FB60C54; Thu, 14 Feb 2019 11:30:59 +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 C8BD7181A010; Thu, 14 Feb 2019 11:30:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1EBUpHX000472 for ; Thu, 14 Feb 2019 06:30:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3B3211024904; Thu, 14 Feb 2019 11:30:51 +0000 (UTC) Received: from dhcp-17-197.lcy.redhat.com (unknown [10.42.17.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id AADD91019601; Thu, 14 Feb 2019 11:30:50 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 14 Feb 2019 11:30:44 +0000 Message-Id: <20190214113048.18408-2-berrange@redhat.com> In-Reply-To: <20190214113048.18408-1-berrange@redhat.com> References: <20190214113048.18408-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 1/5] make: add a rule for running a 'syntax-check' with flake8 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 14 Feb 2019 11:31:00 +0000 (UTC) Signed-off-by: Daniel P. Berrang=C3=A9 --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1ba6b21 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ + + +syntax-check: + flake8 guests/lcitool --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 07:16:30 2024 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 1550143899782370.7179846640573; Thu, 14 Feb 2019 03:31:39 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A119681DE8; Thu, 14 Feb 2019 11:31:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6C0C260C67; Thu, 14 Feb 2019 11:31:37 +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 20AB1181A00C; Thu, 14 Feb 2019 11:31:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1EBUqna000481 for ; Thu, 14 Feb 2019 06:30:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 303BC1024904; Thu, 14 Feb 2019 11:30:52 +0000 (UTC) Received: from dhcp-17-197.lcy.redhat.com (unknown [10.42.17.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7DA15101E846; Thu, 14 Feb 2019 11:30:51 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 14 Feb 2019 11:30:45 +0000 Message-Id: <20190214113048.18408-3-berrange@redhat.com> In-Reply-To: <20190214113048.18408-1-berrange@redhat.com> References: <20190214113048.18408-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 2/5] lcitool: use subparsers for commands 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 14 Feb 2019 11:31:38 +0000 (UTC) Currently only a single global parser is used for all commands. This means that every command accepts every argument which is undesirable as users don't know what to pass. It also prevents the parser from generating useful help information. Python's argparse module supports multi-command binaries in a very easy way by adding subparsers, each of which has their own distinct arguments. It can then generate suitable help text on a per command basis. This also means commands can use positional arguments for data items that are always passed. $ ./guests/lcitool -h usage: lcitool [-h] {install,update,build,hosts,projects,dockerfile} ... libvirt CI guest management tool positional arguments: {install,update,build,hosts,projects,dockerfile} commands install perform unattended host installation update prepare hosts and keep them updated build build projects on hosts hosts list all known hosts projects list all known projects dockerfile generate a host docker file optional arguments: -h, --help show this help message and exit $ ./guests/lcitool install -h usage: lcitool install [-h] hosts positional arguments: hosts list of hosts to act on (accepts globs) optional arguments: -h, --help show this help message and exit $ ./guests/lcitool dockerfile -h usage: lcitool dockerfile [-h] hosts projects positional arguments: hosts list of hosts to act on (accepts globs) projects list of projects to consider (accepts globs) optional arguments: -h, --help show this help message and exit Signed-off-by: Daniel P. Berrang=C3=A9 --- guests/lcitool | 135 ++++++++++++++++++++++++++++--------------------- 1 file changed, 78 insertions(+), 57 deletions(-) diff --git a/guests/lcitool b/guests/lcitool index 726e3bb..35a6b68 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -307,43 +307,72 @@ class Application: conflict_handler=3D"resolve", formatter_class=3Dargparse.RawDescriptionHelpFormatter, description=3D"libvirt CI guest management tool", - epilog=3Dtextwrap.dedent(""" - common actions: - install perform unattended host installation - update prepare hosts and keep them updated - build build projects on hosts + ) =20 - informational actions: - hosts list all known hosts - projects list all known projects + subparser =3D self._parser.add_subparsers(help=3D"commands") + subparser.required =3D True + subparser.dest =3D "command" =20 - uncommon actions: - dockerfile generate Dockerfile (doesn't access the host) + def add_hosts_arg(parser): + parser.add_argument( + "hosts", + help=3D"list of hosts to act on (accepts globs)", + ) =20 - glob patterns are supported for HOSTS and PROJECTS - """), - ) - self._parser.add_argument( - "-a", - metavar=3D"ACTION", - required=3DTrue, - help=3D"action to perform (see below)", - ) - self._parser.add_argument( - "-h", - metavar=3D"HOSTS", - help=3D"list of hosts to act on", - ) - self._parser.add_argument( - "-p", - metavar=3D"PROJECTS", - help=3D"list of projects to consider", - ) - self._parser.add_argument( - "-g", - metavar=3D"GIT_REVISION", - help=3D"git revision to build (remote/branch)", - ) + def add_projects_arg(parser): + parser.add_argument( + "projects", + help=3D"list of projects to consider (accepts globs)", + ) + + def add_gitrev_arg(parser): + parser.add_argument( + "-g", "--git-revision", + help=3D"git revision to build (remote/branch)", + ) + + installparser =3D subparser.add_parser( + "install", help=3D"perform unattended host installation", + formatter_class=3Dargparse.RawDescriptionHelpFormatter) + installparser.set_defaults(func=3Dself._action_install) + + add_hosts_arg(installparser) + + updateparser =3D subparser.add_parser( + "update", help=3D"prepare hosts and keep them updated", + formatter_class=3Dargparse.RawDescriptionHelpFormatter) + updateparser.set_defaults(func=3Dself._action_update) + + add_hosts_arg(updateparser) + add_projects_arg(updateparser) + add_gitrev_arg(updateparser) + + buildparser =3D subparser.add_parser( + "build", help=3D"build projects on hosts", + formatter_class=3Dargparse.RawDescriptionHelpFormatter) + buildparser.set_defaults(func=3Dself._action_build) + + add_hosts_arg(buildparser) + add_projects_arg(buildparser) + add_gitrev_arg(buildparser) + + hostsparser =3D subparser.add_parser( + "hosts", help=3D"list all known hosts", + formatter_class=3Dargparse.RawDescriptionHelpFormatter) + hostsparser.set_defaults(func=3Dself._action_hosts) + + projectsparser =3D subparser.add_parser( + "projects", help=3D"list all known projects", + formatter_class=3Dargparse.RawDescriptionHelpFormatter) + projectsparser.set_defaults(func=3Dself._action_projects) + + dockerfileparser =3D subparser.add_parser( + "dockerfile", help=3D"generate a host docker file", + formatter_class=3Dargparse.RawDescriptionHelpFormatter) + dockerfileparser.set_defaults(func=3Dself._action_dockerfile) + + add_hosts_arg(dockerfileparser) + add_projects_arg(dockerfileparser) =20 def _execute_playbook(self, playbook, hosts, projects, git_revision): base =3D Util.get_base() @@ -404,20 +433,20 @@ class Application: raise Error( "Failed to run {} on '{}': {}".format(playbook, hosts, ex)) =20 - def _action_hosts(self, _hosts, _projects, _revision): + def _action_hosts(self, args): for host in self._inventory.expand_pattern("all"): print(host) =20 - def _action_projects(self, _hosts, _projects, _revision): + def _action_projects(self, args): for project in self._projects.expand_pattern("all"): print(project) =20 - def _action_install(self, hosts, _projects, _revision): + def _action_install(self, args): base =3D Util.get_base() =20 flavor =3D self._config.get_flavor() =20 - for host in self._inventory.expand_pattern(hosts): + for host in self._inventory.expand_pattern(args.hosts): facts =3D self._inventory.get_facts(host) =20 # Both memory size and disk size are stored as GiB in the @@ -484,16 +513,18 @@ class Application: except Exception as ex: raise Error("Failed to install '{}': {}".format(host, ex)) =20 - def _action_update(self, hosts, projects, git_revision): - self._execute_playbook("update", hosts, projects, git_revision) + def _action_update(self, args): + self._execute_playbook("update", args.hosts, args.projects, + args.git_revision) =20 - def _action_build(self, hosts, projects, git_revision): - self._execute_playbook("build", hosts, projects, git_revision) + def _action_build(self, args): + self._execute_playbook("build", args.hosts, args.projects, + args.git_revision) =20 - def _action_dockerfile(self, hosts, projects, _revision): + def _action_dockerfile(self, args): mappings =3D self._projects.get_mappings() =20 - hosts =3D self._inventory.expand_pattern(hosts) + hosts =3D self._inventory.expand_pattern(args.hosts) if len(hosts) > 1: raise Error("Can't generate Dockerfile for multiple hosts") host =3D hosts[0] @@ -507,7 +538,7 @@ class Application: if package_format not in ["deb", "rpm"]: raise Error("Host {} doesn't support Dockerfiles".format(host)) =20 - projects =3D self._projects.expand_pattern(projects) + projects =3D self._projects.expand_pattern(args.projects) for project in projects: if project not in facts["projects"]: raise Error( @@ -573,18 +604,8 @@ class Application: """).format(**varmap)) =20 def run(self): - cmdline =3D self._parser.parse_args() - action =3D cmdline.a - hosts =3D cmdline.h - projects =3D cmdline.p - git_revision =3D cmdline.g - - method =3D "_action_{}".format(action.replace("-", "_")) - - if hasattr(self, method): - getattr(self, method).__call__(hosts, projects, git_revision) - else: - raise Error("Invalid action '{}'".format(action)) + args =3D self._parser.parse_args() + args.func(args) =20 =20 if __name__ =3D=3D "__main__": --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 07:16:30 2024 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 1550143880902163.0827000967107; Thu, 14 Feb 2019 03:31:20 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B862D7DCC2; Thu, 14 Feb 2019 11:31:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8E4EA60C54; Thu, 14 Feb 2019 11:31:17 +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 514A2181A010; Thu, 14 Feb 2019 11:31:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1EBUra4000492 for ; Thu, 14 Feb 2019 06:30:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id F2C741019601; Thu, 14 Feb 2019 11:30:52 +0000 (UTC) Received: from dhcp-17-197.lcy.redhat.com (unknown [10.42.17.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6ED31101E846; Thu, 14 Feb 2019 11:30:52 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 14 Feb 2019 11:30:46 +0000 Message-Id: <20190214113048.18408-4-berrange@redhat.com> In-Reply-To: <20190214113048.18408-1-berrange@redhat.com> References: <20190214113048.18408-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 3/5] lcitool: allow restricting host list to those supporting docker 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 14 Feb 2019 11:31:19 +0000 (UTC) Add a '-d' arg to the 'hosts' command to restrict the output to only include hosts on which dockerfiles can be built Signed-off-by: Daniel P. Berrang=C3=A9 --- guests/lcitool | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/guests/lcitool b/guests/lcitool index 35a6b68..374ba50 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -361,6 +361,11 @@ class Application: formatter_class=3Dargparse.RawDescriptionHelpFormatter) hostsparser.set_defaults(func=3Dself._action_hosts) =20 + hostsparser.add_argument( + "-d", "--dockerfiles", + action=3D"store_true", + help=3D"Only list hosts supporting dockerfiles") + projectsparser =3D subparser.add_parser( "projects", help=3D"list all known projects", formatter_class=3Dargparse.RawDescriptionHelpFormatter) @@ -435,6 +440,11 @@ class Application: =20 def _action_hosts(self, args): for host in self._inventory.expand_pattern("all"): + if args.dockerfiles: + facts =3D self._inventory.get_facts(host) + package_format =3D facts["package_format"] + if package_format not in ["deb", "rpm"]: + continue print(host) =20 def _action_projects(self, args): --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 07:16:30 2024 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 1550143864842952.9580056337844; Thu, 14 Feb 2019 03:31:04 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 74620A787C; Thu, 14 Feb 2019 11:31:02 +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 254CC101E84F; Thu, 14 Feb 2019 11:31:02 +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 B1D713F602; Thu, 14 Feb 2019 11:31:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1EBUrGT000504 for ; Thu, 14 Feb 2019 06:30:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id C75B8101E846; Thu, 14 Feb 2019 11:30:53 +0000 (UTC) Received: from dhcp-17-197.lcy.redhat.com (unknown [10.42.17.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id 40C541024952; Thu, 14 Feb 2019 11:30:53 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 14 Feb 2019 11:30:47 +0000 Message-Id: <20190214113048.18408-5-berrange@redhat.com> In-Reply-To: <20190214113048.18408-1-berrange@redhat.com> References: <20190214113048.18408-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 4/5] make: add a simple build target that generates all dockerfiles 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 14 Feb 2019 11:31:03 +0000 (UTC) This is useful for local testing of docker changes, and can also be called to rebuild the content needed for the libvirt-dockerfiles repository. Signed-off-by: Daniel P. Berrang=C3=A9 --- Makefile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Makefile b/Makefile index 1ba6b21..d2c89e9 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,23 @@ =20 +LCITOOL =3D guests/lcitool + +HOST_VARS =3D $(wildcard guests/host_vars/*/*.yml) +PROJECT_VARS =3D $(wildcard guests/vars/projects/*.yml) + +all: dockerfiles =20 syntax-check: flake8 guests/lcitool + +.PHONY: dockerfiles + +DOCKERHOSTS=3D$(shell $(LCITOOL) hosts -d) + +build/dockerfiles/%.docker: Makefile $(LCITOOL) $(HOST_VARS) $(PROJECT_VAR= S) + mkdir -p build/dockerfiles + $(LCITOOL) dockerfile $* libvirt > $@ + +dockerfiles: $(DOCKERHOSTS:%=3Dbuild/dockerfiles/%.docker) + +clean: + rm -rf build/ --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 07:16:30 2024 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 1550143884644190.36623129266786; Thu, 14 Feb 2019 03:31:24 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1718D99D32; Thu, 14 Feb 2019 11:31:22 +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 CA9A72618B; Thu, 14 Feb 2019 11:31:21 +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 725533F603; Thu, 14 Feb 2019 11:31:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1EBUs2o000513 for ; Thu, 14 Feb 2019 06:30:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9954C101E84F; Thu, 14 Feb 2019 11:30:54 +0000 (UTC) Received: from dhcp-17-197.lcy.redhat.com (unknown [10.42.17.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id 141CF1019601; Thu, 14 Feb 2019 11:30:53 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 14 Feb 2019 11:30:48 +0000 Message-Id: <20190214113048.18408-6-berrange@redhat.com> In-Reply-To: <20190214113048.18408-1-berrange@redhat.com> References: <20190214113048.18408-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 5/5] Add project for CI testing libvirt-jenkins-ci 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 14 Feb 2019 11:31:23 +0000 (UTC) A build task will validate that the dockerfile generator is able to create output, and a syntax-check task will run flake8 Signed-off-by: Daniel P. Berrang=C3=A9 --- guests/playbooks/build/jobs/defaults.yml | 2 ++ .../build/projects/libvirt-jenkins-ci.yml | 15 +++++++++++++++ guests/vars/projects/libvirt-jenkins-ci.yml | 4 ++++ jobs/defaults.yaml | 2 ++ projects/libvirt-jenkins-ci.yaml | 14 ++++++++++++++ 5 files changed, 37 insertions(+) create mode 100644 guests/playbooks/build/projects/libvirt-jenkins-ci.yml create mode 100644 guests/vars/projects/libvirt-jenkins-ci.yml create mode 100644 projects/libvirt-jenkins-ci.yaml diff --git a/guests/playbooks/build/jobs/defaults.yml b/guests/playbooks/bu= ild/jobs/defaults.yml index 1c241fe..73cef08 100644 --- a/guests/playbooks/build/jobs/defaults.yml +++ b/guests/playbooks/build/jobs/defaults.yml @@ -52,6 +52,8 @@ git_urls: default: https://github.com/libvirt/libvirt-go-xml.git libvirt-go: default: https://github.com/libvirt/libvirt-go.git + libvirt-jenkins-ci: + default: https://github.com/libvirt/libvirt-jenkins-ci.git libvirt-ocaml: default: https://github.com/libvirt/libvirt-ocaml.git libvirt-perl: diff --git a/guests/playbooks/build/projects/libvirt-jenkins-ci.yml b/guest= s/playbooks/build/projects/libvirt-jenkins-ci.yml new file mode 100644 index 0000000..0314009 --- /dev/null +++ b/guests/playbooks/build/projects/libvirt-jenkins-ci.yml @@ -0,0 +1,15 @@ +--- +- set_fact: + name: libvirt-jenkins-ci + machines: '{{ rpm_machines }}' + git_url: '{{ git_urls["libvirt-jenkins-ci"][git_remote] }}' + +- include: '{{ playbook_base }}/jobs/prepare.yml' +- include: '{{ playbook_base }}/jobs/generic-build-job.yml' + vars: + command: | + $MAKE all +- include: '{{ playbook_base }}/jobs/generic-syntax-check-job.yml' + vars: + command: | + $MAKE syntax-check diff --git a/guests/vars/projects/libvirt-jenkins-ci.yml b/guests/vars/proj= ects/libvirt-jenkins-ci.yml new file mode 100644 index 0000000..e8c6fa5 --- /dev/null +++ b/guests/vars/projects/libvirt-jenkins-ci.yml @@ -0,0 +1,4 @@ +--- +packages: + - python3 + - python3-flake8 diff --git a/jobs/defaults.yaml b/jobs/defaults.yaml index 6b39724..19abb78 100644 --- a/jobs/defaults.yaml +++ b/jobs/defaults.yaml @@ -51,6 +51,8 @@ default: https://github.com/libvirt/libvirt-go-xml.git libvirt-go: default: https://github.com/libvirt/libvirt-go.git + libvirt-jenkins-ci: + default: https://github.com/libvirt/libvirt-jenkins-ci.git libvirt-ocaml: default: https://github.com/libvirt/libvirt-ocaml.git libvirt-perl: diff --git a/projects/libvirt-jenkins-ci.yaml b/projects/libvirt-jenkins-ci= .yaml new file mode 100644 index 0000000..04d13c4 --- /dev/null +++ b/projects/libvirt-jenkins-ci.yaml @@ -0,0 +1,14 @@ + +- project: + name: libvirt-jenkins-ci + machines: '{rpm_machines}' + title: libvirt Jenkins CI + git_url: '{git_urls[libvirt-jenkins-ci][default]}' + jobs: + - generic-build-job: + command: | + $MAKE all + - generic-syntax-check-job: + parent_jobs: 'libvirt-jenkins-ci-build' + command: | + $MAKE syntax-check --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list