From nobody Sun Feb 8 18:09:07 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1692986226; cv=none; d=zohomail.com; s=zohoarc; b=PWk9JGUqjWPt6w9ZDE+Bjfp0L8e2VCrsMaWWHBGkJwkydZOXPgOuMnWR72dBA8XgKrmPtoqcLNrPYIcHiiDIZABHd+dskXXvgRG1M8G8GINA0AUFLROGVtcmSEg5TVXZWk4Z8xslj8SVY5uwI3+OCc/2dyVchpWgk0kxd7SGY1M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692986226; 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=Dr3sEkV331s73i+4EW6mobRyNg9I+gqBHXm7YKd0oGA=; b=KSpheXuvYsGQPiyKxODFWPJhyiLUcXr3Jyx4EzzbUag4dit4PD/wbKp58F0Lvd4sMELpxRmesHOorVvs+lfdwBt6DwJj5KaymdrxVu/w6rzQbKYEqq0HM/Svj9+MbvC0x0JgKwh6uXP1Eg1IpHSWYJTe6rVO+rVPXc4klizBGtc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1692986226853127.11963181656415; Fri, 25 Aug 2023 10:57:06 -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-269-H5BOu30sNMOKE_ZIFOkEJA-1; Fri, 25 Aug 2023 13:56:14 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5A4D38D40AD; Fri, 25 Aug 2023 17:56:09 +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 4804540C2073; Fri, 25 Aug 2023 17:56:09 +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 2952619465B7; Fri, 25 Aug 2023 17:56:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5DB5019465B5 for ; Fri, 25 Aug 2023 17:56:06 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 3F648403161; Fri, 25 Aug 2023 17:56:06 +0000 (UTC) Received: from orca.. (unknown [10.45.225.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB81A4021B9; Fri, 25 Aug 2023 17:56:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692986225; 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=Dr3sEkV331s73i+4EW6mobRyNg9I+gqBHXm7YKd0oGA=; b=idmV5Yo/GBKZLYwCOgE+gi5pFI1R/hF1ZZHzfpRxu+kialTWwfmoEhTIjC5ZRCaSALhUyL R1Us+IBK08ZCz7C16X4RdpM5jKdAS19yZdAXRfcw3QzjjaBhBHmTNAf/v8QLS8uneMnz35 r06y47I4a0y9Z/rE3rOBdF4uFgWOr6I= X-MC-Unique: H5BOu30sNMOKE_ZIFOkEJA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt PATCH 29/33] ci: helper: Rework _lcitool_run method logic Date: Fri, 25 Aug 2023 19:55:37 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1692986227719100009 Content-Type: text/plain; charset="utf-8"; x-default="true" 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 --- ci/helper | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/ci/helper b/ci/helper index d704d1f711..887e64ece1 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 @@ -216,8 +219,51 @@ 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/build.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}") + subprocess.run([self._args.lcitool] + positional_args + opts) + + # this will take care of the generated script file above as well + tmpdir.cleanup() =20 def _check_stale_images(self): namespace =3D self._args.namespace --=20 2.41.0