From nobody Mon Feb 9 17:25:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1694439964; cv=none; d=zohomail.com; s=zohoarc; b=DA8gPNT4UZqeTdLQLDqOpLdIROZjyLjjTsa3OdXqFhQNMwpw4qvFlDvlIny+S+0nfT8uQuWkvYturCpa01Riv17VuXHs6UZ8zvhUBDbYn903Yy8+IThCoW6gXbbaXh5MmEks9tTV1NnjVfy9kGGGKo34F5eYQmDHmgpw63hqTwI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694439964; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JzGzO1XD+9xlb1dGLhM29IOU3YJsjW63rTyCgipcpiQ=; b=nOOmk2mD1k2gbwLydIRoAYOAfiK07NG/8lvEP3cmQzywJKXtPF3OfL6pwCMsxiWKo1vUV5XkhyCebkzRkFGBycvOFNP2s2bnaO/jM6g2f3XG8SDIEZmFbFPgq6UeRHFBkU5Yi6XRlQNgwnsDavlRwqtBIfH0QnJA0h5HIWCGC+8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1694439964048663.4870259214787; Mon, 11 Sep 2023 06:46:04 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-387-9fBe32pcN6ibvhSC0KuZ2g-1; Mon, 11 Sep 2023 09:44:32 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C7E641046331; Mon, 11 Sep 2023 13:44:26 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id B1F7021B2415; Mon, 11 Sep 2023 13:44:26 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 109BE19452D9; Mon, 11 Sep 2023 13:44:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B7BFF19452D2 for ; Mon, 11 Sep 2023 13:44:02 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id AAEF42023163; Mon, 11 Sep 2023 13:44:02 +0000 (UTC) Received: from orca.home.lan (unknown [10.45.225.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A3BD2026D4B; Mon, 11 Sep 2023 13:44:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694439962; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=JzGzO1XD+9xlb1dGLhM29IOU3YJsjW63rTyCgipcpiQ=; b=GZtFB+zpuGnba03gVdOREVqxHnwhJU9vWSh+Rj7iDmb5I1ctyMqmypsUbYquSIxkgbBviW LvELtYscXm7yx76CKEEE0oW0+/yGV+J2TBXDf9Y2+CtwOk4wcY+5KcZUK4081q9WJJJEDN LTvcOsZd5jzdGqvZFuQMztiNHu/2UJc= X-MC-Unique: 9fBe32pcN6ibvhSC0KuZ2g-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt PATCH v2 29/35] ci: helper: Rework _lcitool_run method logic Date: Mon, 11 Sep 2023 15:43:30 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Erik Skultety Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1694440016692100001 This method wasn't even utilized before this patch. This patch adds all the necessary logic to successfully execute a container workload via lcitool (which will later allow us to ditch ci/Makefile). Because container executions via lcitool creates the following inside the container: $ ls script datadir where 'datadir' is the workload directory (in this case a local git repo clone) and 'script' is the code that runs whatever the workload is over 'datadir'. In order to satisfy the ^above, our helper generates a trivial temporary 'script' that will source ci/build.sh and run whatever was specified as --job essentially to simulate the exact steps a GitLab pipeline job would go through. Signed-off-by: Erik Skultety Reviewed-by: Daniel P. Berrang=C3=A9 Erik Skultety : --- ci/helper | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/ci/helper b/ci/helper index 392702ae41..fce370f995 100755 --- a/ci/helper +++ b/ci/helper @@ -11,6 +11,9 @@ import subprocess import sys import textwrap =20 +from pathlib import Path +from tempfile import TemporaryDirectory + import util =20 =20 @@ -201,8 +204,56 @@ class Application: return repo.clone(dest, local=3DTrue) =20 def _lcitool_run(self, args): - output =3D subprocess.check_output([self._args.lcitool] + args) - return output.decode("utf-8") + positional_args =3D ["container"] + opts =3D ["--user", self._args.login] + tmpdir =3D TemporaryDirectory(prefix=3D"scratch", + dir=3DPath(self.repo.working_dir, "ci"= )) + + repo_dest_path =3D Path(tmpdir.name, "libvirt.git").as_posix() + repo_clone =3D self._prepare_repo_copy(self.repo, repo_dest_path) + opts.extend(["--workload-dir", repo_clone.working_dir]) + + if self._args.job =3D=3D "shell": + positional_args.append("shell") + else: + job2func =3D { + "test": "run_test", + "build": "run_build", + "codestyle": "run_codestyle", + "potfile": "run_potfile", + "rpmbuild": "run_rpmbuild", + "website": "run_website_build", + } + + if self._args.engine !=3D "auto": + positional_args.extend(["--engine", self._args.engine]) + + with open(Path(tmpdir.name, "script"), "w") as f: + script_path =3D f.name + contents =3D textwrap.dedent(f"""\ + #!/bin/sh + + cd datadir + . ci/jobs.sh + + {job2func[self._args.job]} + """) + + f.write(contents) + + positional_args.append("run") + opts.extend(["--script", script_path]) + + opts.append(f"{self._args.image_prefix}{self._args.target}:{self._= args.image_tag}") + proc =3D None + try: + proc =3D subprocess.run([self._args.lcitool] + positional_args= + opts) + except KeyboardInterrupt: + sys.exit(1) + finally: + # this will take care of the generated script file above as we= ll + tmpdir.cleanup() + return proc.returncode =20 def _check_stale_images(self): namespace =3D self._args.namespace --=20 2.41.0