From nobody Sun May 5 21:14:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1612976605; cv=none; d=zohomail.com; s=zohoarc; b=Rh0KlQsXcQOD9Kb8pMog6jaI7iW+oB8H9kqwjVvDsKEstmXlRHmdntkTPNuaEb818lAi2xPnrhjzT9vDLpg1dLtNtMWUiuMkxExNcz5pHAHjp7UXH7Mxw0/AYfcDtqUozfFdO6qf2Hqhus2TFJzRBUPpCDnfL0KwYmNZUZmx8ww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612976605; 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=lmCTD6eheqe03O+e6mMpkzY8y+MuLeAtPu80WBpIIeE=; b=X5xcBaKpl7S2QKTA9vCi4LAMeXDPh+BFfAmHM2doF3NzSvGMoyiClndLBD/tFR1ANyLLG1xpn9jMoVHzyCTzNG169GxJYKMNlNki5WhKqJqti2EmWeEhUfA0qPQpo7uBxtVXg9jdSQ4BMp+10Q16y2z0aK0rUIgtfM7r9JGNfdE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1612976604636460.1545033759786; Wed, 10 Feb 2021 09:03:24 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-225-tgLhQKpVNl27JFg2Uq1N-Q-1; Wed, 10 Feb 2021 12:03:19 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1C090801976; Wed, 10 Feb 2021 17:03:13 +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 E77FD60657; Wed, 10 Feb 2021 17:03:12 +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 A7CA357DFA; Wed, 10 Feb 2021 17:03:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11AH0rhq014642 for ; Wed, 10 Feb 2021 12:00:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id E9AAD7D54A; Wed, 10 Feb 2021 17:00:52 +0000 (UTC) Received: from nautilus.redhat.com (unknown [10.40.192.74]) by smtp.corp.redhat.com (Postfix) with ESMTP id 90A827DE00; Wed, 10 Feb 2021 17:00:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612976601; 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=lmCTD6eheqe03O+e6mMpkzY8y+MuLeAtPu80WBpIIeE=; b=Jg8ZyiK70qMV3qWdlL0AziGhLgUSJUJ4ubKI3py/RP18G+eEp3qRPEsWU03DAoa5lLdiof xV0CUw8lQnPKpF+c+t6Kt79er8MoynlhT066Qq13XzhI/llIzr+ENtevGTInQbIRqPIRaH Vk+oPwSwf6QPAOmRtzcYDEv/pURD4KM= X-MC-Unique: tgLhQKpVNl27JFg2Uq1N-Q-1 From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt PATCH 1/4] ci: Specify the shebang sequence for build.sh Date: Wed, 10 Feb 2021 18:00:41 +0100 Message-Id: <9945ad38ec3c42db751098c2bae30a3fd0b9d046.1612976435.git.eskultet@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: eskultet@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This is necessary for the follow up patch, because the default entrypoint for a Dockerfile is exec. Signed-off-by: Erik Skultety Reviewed-by: Andrea Bolognani --- ci/build.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/build.sh b/ci/build.sh index 740b46a935..0f23df1fa3 100644 --- a/ci/build.sh +++ b/ci/build.sh @@ -1,3 +1,5 @@ +#!/bin/sh + # This script is used to build libvirt inside the container. # # You can customize it to your liking, or alternatively use a --=20 2.29.2 From nobody Sun May 5 21:14:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1612976609; cv=none; d=zohomail.com; s=zohoarc; b=XtUm0pZSIGI3K2W42GGh7WCvt6bmR2LAGgHq/4noQ70enSCcHZAi/xakr756/t2Hp1PJP2+B5RislSmyVg3dmiminrnIuwZT4TFDYiBB+ssn+rJEzccxRxJOZWL0sUqebiMMn/E9g+ThPqa9faaLRBFAas+aVGixcfYZ52Ozvzw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612976609; 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=BTrBU9Rkpo+PjX5RCGDLi1bYN91mZtTiuv5iJHAxD4Y=; b=D0fsiV7Z2dsvouBFHwCE9EejgNsIjDljXSPCZwZT/OGB5ftUmPqC+k22zAz+ifvUS1FyQCO0oj1KTC9Q63HEHL/ATfV1vVyCKJ7RuPoask+GZq5Sg8chFiCi+S7iqL0MmJeJiccKgv4L1Wv4p+5LhD3/YvHTCC1pepapKHSc9ck= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1612976608865484.03491090235855; Wed, 10 Feb 2021 09:03:28 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-253-Rw7Tg0UTMqi2nC7DF0S_Wg-1; Wed, 10 Feb 2021 12:03:24 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 958DB80196E; Wed, 10 Feb 2021 17:03:16 +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 673E919C44; Wed, 10 Feb 2021 17:03:16 +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 E363357DFE; Wed, 10 Feb 2021 17:03:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11AH0s8L014652 for ; Wed, 10 Feb 2021 12:00:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id E89EE7D55E; Wed, 10 Feb 2021 17:00:53 +0000 (UTC) Received: from nautilus.redhat.com (unknown [10.40.192.74]) by smtp.corp.redhat.com (Postfix) with ESMTP id E443E72FBB; Wed, 10 Feb 2021 17:00:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612976607; 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=BTrBU9Rkpo+PjX5RCGDLi1bYN91mZtTiuv5iJHAxD4Y=; b=c0jbw4Eo3pGjLeeHWrw+nti6+hy6sHjtXsdH0sGmpE5DdQWLeI3rSGEbYlZPHe1m4ks9sm FFRY0sufZZxp0icYvYqsZR34y0hVoGxrv1yQcAwGlvy0hXAlV5wwn3wMPkJjKdcAFLXmM5 s0UzCvvwpdmBTAN2t/ml781/kcY0iDE= X-MC-Unique: Rw7Tg0UTMqi2nC7DF0S_Wg-1 From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt PATCH 2/4] ci: Run podman command directly without wrapping it with prepare.sh Date: Wed, 10 Feb 2021 18:00:42 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: eskultet@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The prepare.sh script isn't currently used and forces us to make use of sudo to switch the user inside the container from root to $USER which created a problem on our Debian Slim-based containers which don't have the 'sudo' package installed. This patch removes the sudo invocation and instead runs the CMD directly with podman. Summary of the changes: - move the corresponding env variables which we need to be set in the environment from the sudo invocation to the podman invocation - pass --workdir to podman to retain the original behaviour we had with sudo spawning a login shell. - MESON_ARGS env variable doesn't need to propagated to the execution environment anymore (like we had to do with sudo), because it's defined in the Dockerfile Signed-off-by: Erik Skultety Reviewed-by: Andrea Bolognani --- ci/Makefile | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/ci/Makefile b/ci/Makefile index 7938e14c15..1a376a7f0c 100644 --- a/ci/Makefile +++ b/ci/Makefile @@ -82,7 +82,6 @@ CI_HOME_MOUNTS =3D \ $(NULL) =20 CI_SCRIPT_MOUNTS =3D \ - --volume $(CI_SCRATCHDIR)/prepare:$(CI_USER_HOME)/prepare:z \ --volume $(CI_SCRATCHDIR)/build:$(CI_USER_HOME)/build:z \ $(NULL) =20 @@ -150,6 +149,8 @@ CI_GIT_ARGS =3D \ # --user we execute as the same user & group account # as dev so that file ownership matches host # instead of root:root +# --workdir we change to user's home dir in the container +# before running the workload # --volume to pass in the cloned git repo & config # --ulimit lower files limit for performance reasons # --interactive @@ -158,6 +159,11 @@ CI_ENGINE_ARGS =3D \ --rm \ --interactive \ --tty \ + --user $(CI_UID):$(CI_GID) \ + --workdir $(CI_USER_HOME) \ + --env CI_CONT_SRCDIR=3D"$(CI_CONT_SRCDIR)" \ + --env CI_MESON_ARGS=3D"$(CI_MESON_ARGS)" \ + --env CI_NINJA_ARGS=3D"$(CI_NINJA_ARGS)" \ $(CI_PODMAN_ARGS) \ $(CI_PWDB_MOUNTS) \ $(CI_HOME_MOUNTS) \ @@ -178,9 +184,8 @@ ci-prepare-tree: ci-check-engine cp /etc/passwd $(CI_SCRATCHDIR); \ cp /etc/group $(CI_SCRATCHDIR); \ mkdir -p $(CI_SCRATCHDIR)/home; \ - cp "$(CI_PREPARE_SCRIPT)" $(CI_SCRATCHDIR)/prepare; \ cp "$(CI_BUILD_SCRIPT)" $(CI_SCRATCHDIR)/build; \ - chmod +x "$(CI_SCRATCHDIR)/prepare" "$(CI_SCRATCHDIR)/build"; \ + chmod +x "$(CI_SCRATCHDIR)/build"; \ echo "Cloning $(CI_GIT_ROOT) to $(CI_HOST_SRCDIR)"; \ git clone $(CI_GIT_ARGS) $(CI_GIT_ROOT) $(CI_HOST_SRCDIR) || exit 1; \ for mod in $$(git submodule | awk '{ print $$2 }' | sed -E 's,^../,,g') = ; \ @@ -192,18 +197,10 @@ ci-prepare-tree: ci-check-engine fi =20 ci-run-command@%: ci-prepare-tree - $(CI_ENGINE) run $(CI_ENGINE_ARGS) $(CI_IMAGE_PREFIX)$*$(CI_IMAGE_TAG) \ - /bin/bash -c ' \ - $(CI_USER_HOME)/prepare || exit 1; \ - sudo \ - --login \ - --user=3D"#$(CI_UID)" \ - --group=3D"#$(CI_GID)" \ - MESON_OPTS=3D"$$MESON_OPTS" \ - CI_CONT_SRCDIR=3D"$(CI_CONT_SRCDIR)" \ - CI_MESON_ARGS=3D"$(CI_MESON_ARGS)" \ - CI_NINJA_ARGS=3D"$(CI_NINJA_ARGS)" \ - $(CI_COMMAND) || exit 1' + $(CI_ENGINE) run \ + $(CI_ENGINE_ARGS) \ + $(CI_IMAGE_PREFIX)$*$(CI_IMAGE_TAG) \ + $(CI_COMMAND) @test "$(CI_CLEAN)" =3D "1" && rm -rf $(CI_SCRATCHDIR) || : =20 ci-shell@%: --=20 2.29.2 From nobody Sun May 5 21:14:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1612976529; cv=none; d=zohomail.com; s=zohoarc; b=KJAcBKCcnr2hwmm1LNkKCG2lSDqmih1cbtnql4zOrXxyBEDmcPt+7UQADpPxcgZRmzxMeHGQ9SgzoEjTOyyyiyctqQDaDM9OpfyjrfGN8Rzms/ThVkSbJDYiuW3c9OAzlAESVgCe4zyRm+Iexcx96CJ8bHmTNburd84aTgmna+g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612976529; 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=UmNhtUfYVaYZn8zGO0wdPIC2zWU8PmOAqid3AESyT1c=; b=VW4ygWhTr62+m6Ijk+Pa7Z/R7vBkY7qwfl52s7kxVSHv0QLn8INWxHk10iw+RBAgAlt9VvIggaNhcJr6SyDT5JR2RhrKyzbmg+1vbkjtIWMbZgP3v2AUp9CmhnUif42y5HJ0obyTnk1ALQtkClXCJyHTVjBEtOVkszNWfr+hvJs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 16129765284931007.5457786031063; Wed, 10 Feb 2021 09:02:08 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-340-HH87sBTiOOyQ6K56m6I21w-1; Wed, 10 Feb 2021 12:02:04 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 858D88F54C7; Wed, 10 Feb 2021 17:01:00 +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 EE47057; Wed, 10 Feb 2021 17:00: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 BC2AF18095C9; Wed, 10 Feb 2021 17:00:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11AH0twB014664 for ; Wed, 10 Feb 2021 12:00:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id 608A67D573; Wed, 10 Feb 2021 17:00:55 +0000 (UTC) Received: from nautilus.redhat.com (unknown [10.40.192.74]) by smtp.corp.redhat.com (Postfix) with ESMTP id 34A6C722CA; Wed, 10 Feb 2021 17:00:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612976526; 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=UmNhtUfYVaYZn8zGO0wdPIC2zWU8PmOAqid3AESyT1c=; b=PhcuCvBsKBUN0wz1viQmaaj4wLpr+ZYga9C4nBScvdhnL8U3sgKOi5CIAg3LZEJqVhk8C3 nEKge729o8Y6k8Zac90/ZAuw3BhxgNWwbT8agQ47eXVLjUHHNlI2R8pDbI5Wh/z5cJWE9N 4xOAU2etzynwIn5VpoHOVIgFbrVgYR0= X-MC-Unique: HH87sBTiOOyQ6K56m6I21w-1 From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt PATCH 3/4] ci: Expose CI_USER_LOGIN as a Makefile variable for users to use Date: Wed, 10 Feb 2021 18:00:43 +0100 Message-Id: <5a9da8e2091c887c58a50ec7a592e3fdfdcb293e.1612976435.git.eskultet@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: eskultet@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" More often than not I find myself debugging the containers which means that I need to have root inside, but without manually tweaking the Makefile each time the execution would simply fail thanks to the uid/gid mapping we do. What if we expose the CI_USER_LOGIN variable, so that when needed, the root can be simply passed with this variable and voila - you have a root shell inside the container with CWD=3D~root. Signed-off-by: Erik Skultety --- ci/Makefile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ci/Makefile b/ci/Makefile index 1a376a7f0c..84f2f77526 100644 --- a/ci/Makefile +++ b/ci/Makefile @@ -47,13 +47,13 @@ CI_REUSE =3D 0 =20 # We need the container process to run with current host IDs # so that it can access the passed in build directory -CI_UID =3D $(shell id -u) -CI_GID =3D $(shell id -g) +CI_UID =3D $(shell id -u $(CI_USER_LOGIN)) +CI_GID =3D $(shell id -g $(CI_USER_LOGIN)) =20 # We also need the user's login and home directory to prepare the # environment the way some programs expect it -CI_USER_LOGIN =3D $(shell echo "$$USER") -CI_USER_HOME =3D $(shell echo "$$HOME") +CI_USER_LOGIN =3D $(shell whoami) +CI_USER_HOME =3D $(shell eval echo "~$(CI_USER_LOGIN)") =20 CI_ENGINE =3D auto # Container engine we are going to use, can be overridden per make @@ -132,6 +132,13 @@ ifeq ($(CI_ENGINE),podman) --gidmap $(CI_GID):0:1 \ --gidmap $(CI_GID_OTHER):$(CI_GID_OTHER):$(CI_GID_OTHER_RANGE) \ $(NULL) + + # In case we want to debug in the container, having root is actually + # preferable, so reset the CI_PODMAN_ARGS and don't actually perform + # any uid/gid mapping + ifeq ($(CI_UID), 0) + CI_PODMAN_ARGS=3D + endif endif =20 # Args to use when cloning a git repo. @@ -238,6 +245,7 @@ ci-help: @echo @echo " CI_CLEAN=3D0 - do not delete '$(CI_SCRATCHDIR)' after= completion" @echo " CI_REUSE=3D1 - re-use existing '$(CI_SCRATCHDIR)' con= tent" + @echo " CI_USER_LOGIN=3D - which user should run in the container= (default is $$USER)" @echo " CI_ENGINE=3Dauto - container engine to use (podman, docke= r)" @echo " CI_MESON_ARGS=3D - extra arguments passed to meson" @echo " CI_NINJA_ARGS=3D - extra arguments passed to ninja" --=20 2.29.2 From nobody Sun May 5 21:14:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1612976536; cv=none; d=zohomail.com; s=zohoarc; b=PpGAEmoJkmnFUpJTinGGWJynkMRp5ZYxW1Yh9OE0bjb41/GhyRshkw2jv+TKuse0RrmTgbIamJpK7Mb9WFa6GHEQ7mIDJmXQ+f519S+bKIaPUuPbTKyTt/OIjmArJghERvtQvaJFSP89VHSFf+MS9042Uv/NAES8k2d2eb5LY8s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612976536; 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=gvON4odDU82ftfk60qINm3D1J+Q3wcy7Lx173tc1KjU=; b=FYK66rmob0YFNPtv1YdGNp+jbsnY7eHmNWOoh6bGt3XmENtXmegdzQntWRj8JBxF7VhUqJ3v3NL7to6NcKrzwE/rvzRbUZiGSSf+EyBcG8+P9YZKrc1iupou81G9WpyeKngj5KPSfVFP0AqEAJC1/t3sVr2R3lEpTX/LpvsGkWg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1612976536177128.59891152710338; Wed, 10 Feb 2021 09:02:16 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-480-6JdcquzJPueqhNewcHX9Rg-1; Wed, 10 Feb 2021 12:02:12 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id D8322801975; Wed, 10 Feb 2021 17:01:14 +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 B123419C44; Wed, 10 Feb 2021 17:01:14 +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 94AC657DFC; Wed, 10 Feb 2021 17:01:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11AH0ueC014678 for ; Wed, 10 Feb 2021 12:00:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 573F27E655; Wed, 10 Feb 2021 17:00:56 +0000 (UTC) Received: from nautilus.redhat.com (unknown [10.40.192.74]) by smtp.corp.redhat.com (Postfix) with ESMTP id 70C2C7D959; Wed, 10 Feb 2021 17:00:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612976534; 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=gvON4odDU82ftfk60qINm3D1J+Q3wcy7Lx173tc1KjU=; b=WNBtk/D+eGxD87Ex9/mkNINkhYXued94K4/ag2LyjYDKlRUdQD84MO4aoAKI4+fw+c4c3F /y21ONoClv4z2B7YiCMpGFYCKU6H+8Ra9TAy3dlvCOWcbhxQAoUtLjznOtVM2TS1dfKlAK xCcNK4Q3AZjmBa+un66paqOee4RyTeg= X-MC-Unique: 6JdcquzJPueqhNewcHX9Rg-1 From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt PATCH 4/4] ci: Drop the prepare.sh script Date: Wed, 10 Feb 2021 18:00:44 +0100 Message-Id: <35d443a3314a331b0a29299d3fc1bf05567620f1.1612976435.git.eskultet@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: eskultet@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The purpose of this script was to prepare a customized environment in the container, but was actually never used and it required the usage of sudo to switch the environment from root's context to a regular user's one. The thing is that once someone needs a custom script they would very likely to debug something and would also benefit from root privileges in general, so the usage of 'sudo' in such case was a bit cumbersome. Signed-off-by: Erik Skultety --- ci/prepare.sh | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 ci/prepare.sh diff --git a/ci/prepare.sh b/ci/prepare.sh deleted file mode 100644 index da6fc9a1b5..0000000000 --- a/ci/prepare.sh +++ /dev/null @@ -1,13 +0,0 @@ -# This script is used to prepare the environment that will be used -# to build libvirt inside the container. -# -# You can customize it to your liking, or alternatively use a -# completely different script by passing -# -# CI_PREPARE_SCRIPT=3D/path/to/your/prepare/script -# -# to make. -# -# Note that this script will have root privileges inside the -# container, so it can be used for things like installing additional -# packages. --=20 2.29.2