From nobody Tue May 7 05:00:01 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=1613139605; cv=none; d=zohomail.com; s=zohoarc; b=Kf85+gmxTpABMhhOYqK4WbVOThsIWiHRO+W92ySrSNSMbJIRwApoWh2ERUl/SkLSt5fcqBICiaXXEjJPdmKGis/Vha3AdpSCoeARAgEw7dNRsgruDXCw6NmTGtv412ek71MLSk/UJmS4thr4M6HJDIrmLtZuqhzI3aUwGeTQx+s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613139605; 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=uUb7MV4Ey+jNE21X3u7Peq582/ic1UeemDOVhuIUSOs=; b=k5Z6lv8Z9MGQ2rtj9XYEviIRHhqcYmZtVaKS6edxSqHB3Rn6Rx7L0msChKsghKAQi2AvFGDaynTa2bq+cLl7ijtw/zyDUL/hnnpRASzdoMRUYNpyU+n/MgkGup/bzxUJAgKpBwZ7rW2DtW7+8e7MJA6IsEUa8W5jGaokoSpHU7Q= 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 1613139605070961.7500462877495; Fri, 12 Feb 2021 06:20:05 -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-492-XmDY5HUcOaKaysFwDbko1A-1; Fri, 12 Feb 2021 09:20:00 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A93401E57A; Fri, 12 Feb 2021 14:19:54 +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 621A96E51B; Fri, 12 Feb 2021 14:19:54 +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 C79DE4E58E; Fri, 12 Feb 2021 14:19:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11CEJqmX015647 for ; Fri, 12 Feb 2021 09:19:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id A0A355D735; Fri, 12 Feb 2021 14:19:52 +0000 (UTC) Received: from nautilus.redhat.com (unknown [10.40.192.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id C390A5D6AB; Fri, 12 Feb 2021 14:19:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613139604; 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=uUb7MV4Ey+jNE21X3u7Peq582/ic1UeemDOVhuIUSOs=; b=DSrTFhJjDXJNGp0KQlAECRr9ZydGNe+dmIn6snzQ3euykaN1iDKv2HNpgpuh3Tci/0RiTh 4T0wAjL4sluJcrJCDXnpgI/YruOwHyk+RpJKCpC2OF3H1eEtWAlUz9hW4X9RmCGjekYmlS nOIpsxGikZv5EvPl62qgPWJN/ynIah4= X-MC-Unique: XmDY5HUcOaKaysFwDbko1A-1 From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt PATCH v2 1/4] ci: Specify the shebang sequence for build.sh Date: Fri, 12 Feb 2021 15:19:46 +0100 Message-Id: <47b08d155f31805de238731bbdbce011feef49e9.1613139541.git.eskultet@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Andrea Bolognani , 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.13 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 Tue May 7 05:00:01 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=1613139610; cv=none; d=zohomail.com; s=zohoarc; b=U96Jrr84af7N8dsqxiabEHA5lyxl7ZQUFlD/DGjpZEXYIC1S1V7EDSu5Of4f8smp3FOd5iDVukCvRcUWNjDT2NB63kmqTVpQEtwblRBFk2Q/27kadMcMxwUai0/asMQOxIrZgtwViVqNxHsDmbbfWXlQJb0FxQym/dongBsWFQQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613139610; 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=trNYV4/Til/oYd33BS10F2AsEGpbQDXluBEy4B/PHrc=; b=hBLqmINuDplNRiyfnN2GKq67y07L0VRFLofKOIBYyKmc02ShxW5xnTXImQrqdM55rKTmsr802pHalNZEVXd6eUeqvbJXTYOmI/Px7sdpIbiCo4YQ3UCLyOlYzyLzLKvoPWyGMX72d78CqE88GnkMEbq1PoqBlXZ48et4QvzhqKE= 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 1613139609869761.6946069990333; Fri, 12 Feb 2021 06:20:09 -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-578-8YazyMZwO5OI2F-yfXKNAQ-1; Fri, 12 Feb 2021 09:20:03 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2D90C6EE4E; Fri, 12 Feb 2021 14:19:57 +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 C52126C95D; Fri, 12 Feb 2021 14:19:56 +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 8B8044EE76; Fri, 12 Feb 2021 14:19:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11CEJsVk015657 for ; Fri, 12 Feb 2021 09:19:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id F19D162A25; Fri, 12 Feb 2021 14:19:53 +0000 (UTC) Received: from nautilus.redhat.com (unknown [10.40.192.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0257B5D74A; Fri, 12 Feb 2021 14:19:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613139608; 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=trNYV4/Til/oYd33BS10F2AsEGpbQDXluBEy4B/PHrc=; b=CRwHHUyl1Sd9ua+L+TrkDk8LBcjtz7GyvCRo8LIljvLdqBczooGZ9m9XwKB4znWkPdKGol cSDXu60UNCxdpSBk+dM9wbCwlCmZ0R5u7HWxSZ3YYtVOgkuKPWBHpUvmY/W36alg1mlJmA ddPQP1IiYFwfrr0kuSsg74Ma4+SghCY= X-MC-Unique: 8YazyMZwO5OI2F-yfXKNAQ-1 From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt PATCH v2 2/4] ci: Run podman command directly without wrapping it with prepare.sh Date: Fri, 12 Feb 2021 15:19:47 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Andrea Bolognani , 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.14 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_OPTS 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..9308738d2d 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 Tue May 7 05:00:01 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=1613139628; cv=none; d=zohomail.com; s=zohoarc; b=BJztWC1fe9SeAQ9tuKkAlu6kkbcEEfVXlDjyPwZDy77Ans0W31jljEpD6qx5S907YjOeope4IgTjwiQZ+mYi4FM/sF3kkyroQc7cMThTtTdID2mNYf45AUnFO8UFQZgHROwc8AzSotfLFU64JBPNB43+T9m4vWVNHIcazMyJQAw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613139628; 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=SYbDNQNhZBFelkHQFzBn1Jp9ZUEVtLhr2N0UhfstGaA=; b=EtyidmFucYaeV12KS1IuvVNFVsJrccQf4VyBZfK7mFfdPj9MkbHtzXbpXISs8o35AvMPM7pHKMQxc3gRwFt5n7ONagNWAQuDoGnl4xjDPXAx1F2V5YuK3u4Aq4X2t7UFV/XfbPwBsTk9HnYc3inRMVfimPNoWRN/ToqLwFarCsA= 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 1613139628386608.460069413651; Fri, 12 Feb 2021 06:20: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-417-mCo82HgFO5CMLWRi9Qd-1w-1; Fri, 12 Feb 2021 09:20:24 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B4A32835E55; Fri, 12 Feb 2021 14:20:04 +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 812726FEF0; Fri, 12 Feb 2021 14:20:04 +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 356DCCF45; Fri, 12 Feb 2021 14:20:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11CEJt6K015670 for ; Fri, 12 Feb 2021 09:19:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id 34A4262460; Fri, 12 Feb 2021 14:19:55 +0000 (UTC) Received: from nautilus.redhat.com (unknown [10.40.192.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4EC3E6A8F7; Fri, 12 Feb 2021 14:19:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613139627; 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=SYbDNQNhZBFelkHQFzBn1Jp9ZUEVtLhr2N0UhfstGaA=; b=hQuyl4N1a+gzNh0hAnJU/f1LoxihGAnvxv/MbVlFoSPmWBb16LTrVrENIJrxI+c33yhEKB MW0HsLnIzvQmOChLwRG2+RkUdGG4rrJbngOzwn/mGfQBmwbAcY4GyIePbXtXpsK6srnqLj DOP+mrxZAJ2aQMjt+h7bnO4Rej1pNRw= X-MC-Unique: mCo82HgFO5CMLWRi9Qd-1w-1 From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt PATCH v2 3/4] ci: Drop the prepare.sh script Date: Fri, 12 Feb 2021 15:19:48 +0100 Message-Id: <720a3f3e828b851380f217e51b75af5d0c8b88f1.1613139541.git.eskultet@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Andrea Bolognani , 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.13 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 Reviewed-by: Andrea Bolognani --- 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 From nobody Tue May 7 05:00:01 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=1613139633; cv=none; d=zohomail.com; s=zohoarc; b=cAOX7CBgDzvjmHCZjqxqR31rFJu8cndHKTglXOJvpZnlIsbyl6bpsj6sRoC+21TatdqfvdnUCo4QssvOMuzUJu1u9hd+yDY4GCjZ+9ATMOazimSd8JG/kQoGWDOYileVzXiU6tBZMpS5OgP6feFH+ntbD6I+whNVOUqNvpsK/iU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613139633; 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=2eFDFDvjWbmkxGcHgOwIDV6Bm92tLN6ty1rhOlIGUSI=; b=QTniTwlfcqoemjyOqDfpB3Uq00oi8G1gPwYvCCrsk+UDLdONvnmEB06vkRQ38Nc4ZVqq0bRPr/bKfkMrXw9xCL6gLdJOftvAVeBsZw5JfnbuZyVHfyDPNpP4bHNbAozU1Opx9oU+och7ECwoRaPNo/9ntIy8OdXEHfgzDoIzMvM= 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 1613139633576904.913783279974; Fri, 12 Feb 2021 06:20:33 -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-200-OG5WmRCaN3iZRIler09Q0g-1; Fri, 12 Feb 2021 09:20:30 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BFB432FD17; Fri, 12 Feb 2021 14:20:07 +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 E800F6D0A7; Fri, 12 Feb 2021 14:20:06 +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 9B07C18095C9; Fri, 12 Feb 2021 14:20:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11CEJu2Z015680 for ; Fri, 12 Feb 2021 09:19:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 651CD669F3; Fri, 12 Feb 2021 14:19:56 +0000 (UTC) Received: from nautilus.redhat.com (unknown [10.40.192.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id A1FDE62A24; Fri, 12 Feb 2021 14:19:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613139632; 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=2eFDFDvjWbmkxGcHgOwIDV6Bm92tLN6ty1rhOlIGUSI=; b=gHT56XeM1eZ6FGypfWqTts+64qy/sdcuFf+iPmkibozUByAbC2SVHwiyjAYGj5FVrFf+6p cRmhiILnxAYQJF5cFglTkN738RRGtF03XkqoSUk+GhYGoU0d8QbTyrs/tYysJWFWcEZYrN bU0kHe+K6UBTGnQavldgma+1plFJ3dU= X-MC-Unique: OG5WmRCaN3iZRIler09Q0g-1 From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt PATCH v2 4/4] ci: Makefile: Expose the CI_USER_LOGIN variable for users to use Date: Fri, 12 Feb 2021 15:19:49 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.14 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 in 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 Reviewed-by: Andrea Bolognani --- ci/Makefile | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/ci/Makefile b/ci/Makefile index 9308738d2d..05a50c021c 100644 --- a/ci/Makefile +++ b/ci/Makefile @@ -45,15 +45,15 @@ CI_CLEAN =3D 1 # preserved env 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) - -# We also need the user's login and home directory to prepare the +# We 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)") + +# We also 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_USER_LOGIN)") +CI_GID =3D $(shell id -g "$(CI_USER_LOGIN)") =20 CI_ENGINE =3D auto # Container engine we are going to use, can be overridden per make @@ -124,14 +124,16 @@ ifeq ($(CI_ENGINE),podman) CI_UID_OTHER_RANGE =3D $(shell echo $$(($(CI_MAX_UID)-$(CI_UID)))) CI_GID_OTHER_RANGE =3D $(shell echo $$(($(CI_MAX_GID)-$(CI_GID)))) =20 - CI_PODMAN_ARGS =3D \ - --uidmap 0:1:$(CI_UID) \ - --uidmap $(CI_UID):0:1 \ - --uidmap $(CI_UID_OTHER):$(CI_UID_OTHER):$(CI_UID_OTHER_RANGE) \ - --gidmap 0:1:$(CI_GID) \ - --gidmap $(CI_GID):0:1 \ - --gidmap $(CI_GID_OTHER):$(CI_GID_OTHER):$(CI_GID_OTHER_RANGE) \ - $(NULL) + ifneq ($(CI_UID), 0) + CI_PODMAN_ARGS =3D \ + --uidmap 0:1:$(CI_UID) \ + --uidmap $(CI_UID):0:1 \ + --uidmap $(CI_UID_OTHER):$(CI_UID_OTHER):$(CI_UID_OTHER_RANGE) \ + --gidmap 0:1:$(CI_GID) \ + --gidmap $(CI_GID):0:1 \ + --gidmap $(CI_GID_OTHER):$(CI_GID_OTHER):$(CI_GID_OTHER_RANGE) \ + $(NULL) + endif endif =20 # Args to use when cloning a git repo. @@ -239,6 +241,7 @@ ci-help: @echo " CI_CLEAN=3D0 - do not delete '$(CI_SCRATCHDIR)' after= completion" @echo " CI_REUSE=3D1 - re-use existing '$(CI_SCRATCHDIR)' con= tent" @echo " CI_ENGINE=3Dauto - container engine to use (podman, docke= r)" + @echo " CI_USER_LOGIN=3D$$USER - which user should run in the con= tainer" @echo " CI_MESON_ARGS=3D - extra arguments passed to meson" @echo " CI_NINJA_ARGS=3D - extra arguments passed to ninja" @echo --=20 2.29.2