From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2431B30CD84 for ; Thu, 28 Aug 2025 20:28:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756412910; cv=none; b=g+8Eur5ZhQULSej7C2mTNf2hynM4MxzHhc2oRV9Y5359MUxUrLEZaJk2ZzZ8E5G3xjA5UXUwEq8UqNYw/roArFYs2CjqteVNdrxl2h7CpdNlgrcT4lfvgdwFEeLXPLQBxxDtQdYXYTnvt7G1USQDs7CtGFlWJ6PypLOHN8FjoX8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756412910; c=relaxed/simple; bh=Sd4mUWxut+CMlft4YGvd8DW0IwDdMrcbKxfZk9l+BKQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c56DdbHUlJXESFRvoKJwjRf7e3NDnObbK2J69HO/gGX/KclrCWVdgiKgY7WviJqlBmRHSRqWd8/kTCSstIvp1MJ+sBnOP2OaSYEdKlaU5Y3PgD0nB0K6hsQsHAMl2UZbgm52hnf1B1Y8WjHq6fqXFkUsvLJgXkja6NWCFCLLuBE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=a14FRBxy; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="a14FRBxy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F597C4CEF5; Thu, 28 Aug 2025 20:28:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1756412909; bh=Sd4mUWxut+CMlft4YGvd8DW0IwDdMrcbKxfZk9l+BKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a14FRBxyB/FvR6bBdnxNPkytbqasst9zIkiAO2MgoCQJnFsNIItUTVaYqyzsGkdSH 97KtUH4BcnxM+jAM1hNcgm5JnBCu+UKAjdMDK+Ir53LvaSd4jyDJmxrA3ZuG8K1OxI GZZZ6ZYIyZ4eVD45FjFOmqH+YSxjx4Lkh/GxpOaOTvHGcrpGrYbpAzZPqCkriiWKdC C9REhfdk6EmPQJ14G5AP2+7AD49hTKKGjT3Nilw3Fv2KjGRWc7MT3Fd0A0eBk9+Tss 575Btdo81P1sJEdhoJ/VofsXAaClLcITFzRV5vO/8Yx4+A33Qj+LWDz4SH6OQ8R3hj WPAx1dKphS0cA== From: Chuck Lever To: Cc: Chuck Lever Subject: [RFC PATCH 1/2] Set TOPDIR_PATH and generate its sha256sum at run time Date: Thu, 28 Aug 2025 16:28:26 -0400 Message-ID: <20250828202827.3253499-2-cel@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250828202827.3253499-1-cel@kernel.org> References: <20250828202827.3253499-1-cel@kernel.org> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Chuck Lever Commit 42d27579a9d0 ("guestfs: enhance ssh config choice") added a uniquifier to the name of the ssh config to avoid multiple kdevops runs clobbering each other's ssh config entries. It uses the TOPDIR pathname set in the current .config to benefit from the nice convenience of generating an Ansible extra_var using "output yaml". However, if the same user generates all her .configs (that will be run by other users under automation) while in the same directory (say, if they are different branches in the same git repository), the TOPDIR pathname and thus the sha256sum of that pathname will be exactly the same in all of those .config files, allowing the path names of the ephemeral ssh configs to collide. The TOPDIR and its checksum need to be generated not by "make menuconfig" but rather by "make" in order that .config files (as saved in defconfigs/) can be truly portable. Signed-off-by: Chuck Lever --- Kconfig | 15 --------------- Makefile | 4 ++++ scripts/gen-hosts.Makefile | 1 + scripts/ssh.Makefile | 4 ++-- 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/Kconfig b/Kconfig index 3f2bc8cf019a..948befbce4de 100644 --- a/Kconfig +++ b/Kconfig @@ -5,21 +5,6 @@ mainmenu "$(PROJECT) $(PROJECTRELEASE)" -config TOPDIR_PATH - string - output yaml - default $(shell, echo $TOPDIR_PATH) - -config TOPDIR_PATH_HAS_SHA256SUM - bool - output yaml - default y - -config TOPDIR_PATH_SHA256SUM - string - output yaml - default $(shell, ./scripts/compute_sha256sum.sh $(TOPDIR_PATH)) - config HAVE_KDEVOPS_CUSTOM_DEFAULTS bool default n diff --git a/Makefile b/Makefile index 8755577e4d85..b6fdbe67fc07 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,8 @@ export KDEVOPS_NODES := export PYTHONUNBUFFERED=1 export TOPDIR=./ export TOPDIR_PATH = $(shell readlink -f $(TOPDIR)) +export TOPDIR_PATH_HAS_SHA256SUM=y +export TOPDIR_PATH_SHA256SUM = $(shell, ./scripts/compute_sha256sum.sh $(TOPDIR_PATH)) include scripts/refs.Makefile KDEVOPS_NODES_ROLE_TEMPLATE_DIR := $(KDEVOPS_PLAYBOOKS_DIR)/roles/gen_nodes/templates @@ -82,6 +84,8 @@ INCLUDES = -I include/ CFLAGS += $(INCLUDES) ANSIBLE_EXTRA_ARGS += kdevops_version='$(PROJECTRELEASE)' +ANSIBLE_EXTRA_ARGS += topdir_path_has_sha256sum='$(TOPDIR_PATH_HAS_SHA256SUM)' +ANSIBLE_EXTRA_ARGS += topdir_path_sha256sum='$(TOPDIR_PATH_SHA256SUM)' export KDEVOPS_HOSTS_TEMPLATE := hosts.j2 diff --git a/scripts/gen-hosts.Makefile b/scripts/gen-hosts.Makefile index 0d1e0cd77c2e..c809b1da18e5 100644 --- a/scripts/gen-hosts.Makefile +++ b/scripts/gen-hosts.Makefile @@ -3,6 +3,7 @@ KDEVOPS_PLAYBOOKS_DIR_FULL_PATH=$(TOPDIR_PATH)/$(KDEVOPS_PLAYBOOKS_DIR) KDEVOPS_HOSTS_TEMPLATE_DIR=$(KDEVOPS_PLAYBOOKS_DIR_FULL_PATH)/roles/gen_hosts/templates +GENHOSTS_EXTRA_ARGS += topdir_path='$(TOPDIR_PATH)' GENHOSTS_EXTRA_ARGS += kdevops_playbooks_dir='$(KDEVOPS_PLAYBOOKS_DIR)' # Relative path so that ansible can work with it diff --git a/scripts/ssh.Makefile b/scripts/ssh.Makefile index d18a03e094ee..d2a583f45da2 100644 --- a/scripts/ssh.Makefile +++ b/scripts/ssh.Makefile @@ -10,8 +10,8 @@ ifeq (y,$(CONFIG_KDEVOPS_SSH_CONFIG_UPDATE)) SSH_CONFIG_FILE:=$(subst ",,$(CONFIG_KDEVOPS_SSH_CONFIG)) ANSIBLE_EXTRA_ARGS += sshconfig=$(shell realpath $(SSH_CONFIG_FILE)) -ifeq (y,$(CONFIG_TOPDIR_PATH_HAS_SHA256SUM)) -SSH_CONFIG_SUFFIX:=$(CONFIG_TOPDIR_PATH_SHA256SUM) +ifeq (y,$(TOPDIR_PATH_HAS_SHA256SUM)) +SSH_CONFIG_SUFFIX:=$(TOPDIR_PATH_SHA256SUM) else SSH_CONFIG_SUFFIX:=$(CONFIG_KDEVOPS_HOST_PREFIX) endif -- 2.51.0