public inbox for kdevops@lists.linux.dev
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: kdevops@lists.linux.dev, da.gomez@samsung.com, p.raghav@samsung.com
Cc: Luis Chamberlain <mcgrof@kernel.org>
Subject: [PATCH 4/6] provision: move all provisioning things to its own Makefile
Date: Thu, 25 Jan 2024 12:35:05 -0800	[thread overview]
Message-ID: <20240125203507.430113-5-mcgrof@kernel.org> (raw)
In-Reply-To: <20240125203507.430113-1-mcgrof@kernel.org>

The provisioning aspect of kdevops is creating clutter at the
top level Makefile. Move it all into its own file so to be able
to easily identify related tasks and to easily extend it.

We keep augmenting KDEVOPS_BRING_UP_DEPS with KDEVOPS_BRING_UP_DEPS_EARLY
in the top level Makefile so we can in between add makefiles for tools
which we want to include in between and make it clear these requirements
will be met before KDEVOPS_PROVISIONED_DEVCONFIG, ie running the devconfig
playbook for general setup.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 Makefile                   | 69 +----------------------------------
 scripts/provision.Makefile | 74 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+), 68 deletions(-)
 create mode 100644 scripts/provision.Makefile

diff --git a/Makefile b/Makefile
index be686b279e2c..67e13edbf6ff 100644
--- a/Makefile
+++ b/Makefile
@@ -85,77 +85,10 @@ endif # CONFIG_NEEDS_LOCAL_DEVELOPMENT_PATH
 
 ANSIBLE_EXTRA_ARGS += $(LOCAL_DEVELOPMENT_ARGS)
 
-# Provisioning methods should set this to their target which will ensure
-# systems will be up after this.
-KDEVOPS_PROVISION_METHOD :=
-
-# Provisioning methods should set this to their target which will ensure
-# the systems will be removed after this
-KDEVOPS_PROVISION_DESTROY_METHOD :=
-
-# The default guard for ssh provisioning. Provisioning methods can set the
-# KDEVOPS_PROVISIONED_SSH to this if they are OK with the default guard.
-KDEVOPS_PROVISIONED_SSH_DEFAULT_GUARD := .provisioned_once_ssh
-
-# This is empty on purpose so to support terraform which does this for us
-# on the terraform provider and bare metal where it is assumed you already
-# have ssh setup. Later we can grow this for other bare metal setups or to
-# consume / gather existing topologies. To be clear, terraform providers are
-# in charge of figuring out ssh configuration updates for you in kdevops.
-KDEVOPS_PROVISIONED_SSH :=
-
-# You should augment this with targets which should be after ssh is
-# ready to go to each node, and before devconfig playbook is run.
-# The devconfig playbook can be used with tags to ensure deps / setup
-# for early deps are run.
-KDEVOPS_BRING_UP_DEPS_EARLY  :=
-
-# This is shared task.
-KDEVOPS_PROVISIONED_DEVCONFIG := .provisioned_once_devconfig
-
-KDEVOPS_BRING_UP_DEPS :=
-KDEVOPS_DESTROY_DEPS :=
-
-include scripts/dynamic-kconfig.Makefile
-
-ifeq (y,$(CONFIG_TERRAFORM))
-include scripts/terraform.Makefile
-endif # CONFIG_TERRAFORM
-
-ifeq (y,$(CONFIG_VAGRANT))
-include scripts/vagrant.Makefile
-endif
-
-ifeq (y,$(CONFIG_GUESTFS))
-include scripts/guestfs.Makefile
-endif
-
-KDEVOPS_MRPROPER += $(KDEVOPS_PROVISIONED_SSH)
-KDEVOPS_MRPROPER += $(KDEVOPS_PROVISIONED_DEVCONFIG)
-
-$(KDEVOPS_PROVISIONED_DEVCONFIG):
-	$(Q)if [[ "$(CONFIG_KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK)" != "" ]]; then \
-		ansible-playbook $(ANSIBLE_VERBOSE) -i \
-			$(KDEVOPS_HOSTFILE) $(KDEVOPS_PLAYBOOKS_DIR)/$(KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK) ;\
-	fi
-	$(Q)touch $(KDEVOPS_PROVISIONED_DEVCONFIG)
-
-# Provisioning split into 4 steps:
-#
-# 1) Provisioning method, if one is defined
-# 2) Ensuring we can use ansible with ssh, if required
-# 3) Installing early dependencies, if any, which independent of any workflow
-# 4) Optionally run the devconfig playbook for configuration (which may include
-#    extra tools)
-#
-# Anything deps after this is dealt with on each respective workflow.
-KDEVOPS_BRING_UP_DEPS += $(KDEVOPS_PROVISION_METHOD)
-KDEVOPS_BRING_UP_DEPS += $(KDEVOPS_PROVISIONED_SSH)
+include scripts/provision.Makefile
 KDEVOPS_BRING_UP_DEPS += $(KDEVOPS_BRING_UP_DEPS_EARLY)
 KDEVOPS_BRING_UP_DEPS += $(KDEVOPS_PROVISIONED_DEVCONFIG)
 
-KDEVOPS_DESTROY_DEPS += $(KDEVOPS_PROVISION_DESTROY_METHOD)
-
 ifeq (y,$(CONFIG_WORKFLOWS))
 include workflows/Makefile
 endif # CONFIG_WORKFLOWS
diff --git a/scripts/provision.Makefile b/scripts/provision.Makefile
new file mode 100644
index 000000000000..3767e3332e44
--- /dev/null
+++ b/scripts/provision.Makefile
@@ -0,0 +1,74 @@
+# SPDX-License-Identifier: copyleft-next-0.3.1
+
+# Provisioning methods should set this to their target which will ensure
+# systems will be up after this.
+KDEVOPS_PROVISION_METHOD :=
+
+# Provisioning methods should set this to their target which will ensure
+# the systems will be removed after this
+KDEVOPS_PROVISION_DESTROY_METHOD :=
+
+# The default guard for ssh provisioning. Provisioning methods can set the
+# KDEVOPS_PROVISIONED_SSH to this if they are OK with the default guard.
+KDEVOPS_PROVISIONED_SSH_DEFAULT_GUARD := .provisioned_once_ssh
+
+# This is empty on purpose so to support terraform which does this for us
+# on the terraform provider and bare metal where it is assumed you already
+# have ssh setup. Later we can grow this for other bare metal setups or to
+# consume / gather existing topologies. To be clear, terraform providers are
+# in charge of figuring out ssh configuration updates for you in kdevops.
+KDEVOPS_PROVISIONED_SSH :=
+
+# You should augment this with targets which should be after ssh is
+# ready to go to each node, and before devconfig playbook is run.
+# The devconfig playbook can be used with tags to ensure deps / setup
+# for early deps are run.
+KDEVOPS_BRING_UP_DEPS_EARLY  :=
+
+# This is shared task.
+KDEVOPS_PROVISIONED_DEVCONFIG := .provisioned_once_devconfig
+
+KDEVOPS_BRING_UP_DEPS :=
+KDEVOPS_DESTROY_DEPS :=
+
+include scripts/dynamic-kconfig.Makefile
+
+ifeq (y,$(CONFIG_TERRAFORM))
+include scripts/terraform.Makefile
+endif # CONFIG_TERRAFORM
+
+ifeq (y,$(CONFIG_VAGRANT))
+include scripts/vagrant.Makefile
+endif
+
+ifeq (y,$(CONFIG_GUESTFS))
+include scripts/guestfs.Makefile
+endif
+
+KDEVOPS_MRPROPER += $(KDEVOPS_PROVISIONED_SSH)
+KDEVOPS_MRPROPER += $(KDEVOPS_PROVISIONED_DEVCONFIG)
+
+$(KDEVOPS_PROVISIONED_DEVCONFIG):
+	$(Q)if [[ "$(CONFIG_KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK)" != "" ]]; then \
+		ansible-playbook $(ANSIBLE_VERBOSE) -i \
+			$(KDEVOPS_HOSTFILE) $(KDEVOPS_PLAYBOOKS_DIR)/$(KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK) ;\
+	fi
+	$(Q)touch $(KDEVOPS_PROVISIONED_DEVCONFIG)
+
+# Provisioning split into 4 steps:
+#
+# 1) Provisioning method, if one is defined
+# 2) Ensuring we can use ansible with ssh, if required
+# 3) Installing early dependencies, if any, which independent of any workflow
+# 4) Optionally run the devconfig playbook for configuration (which may include
+#    extra tools)
+#
+# The last two are dealt with in the top level Makefile so to allow us to
+# define early dependencies from the top level Makefile and make it clear
+# that the devconfig playbook runs last.
+#
+# Anything deps after this is dealt with on each respective workflow.
+KDEVOPS_BRING_UP_DEPS += $(KDEVOPS_PROVISION_METHOD)
+KDEVOPS_BRING_UP_DEPS += $(KDEVOPS_PROVISIONED_SSH)
+
+KDEVOPS_DESTROY_DEPS += $(KDEVOPS_PROVISION_DESTROY_METHOD)
-- 
2.42.0


  parent reply	other threads:[~2024-01-25 20:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-25 20:35 [PATCH 0/6] Fix ordering for systemd remote journal support Luis Chamberlain
2024-01-25 20:35 ` [PATCH 1/6] mirror: add a smart git check Luis Chamberlain
2024-01-25 20:35 ` [PATCH 2/6] bringup: split provisioning into 2 steps Luis Chamberlain
2024-01-25 20:35 ` [PATCH 3/6] bringup: share bringup method targe and agument by two steps Luis Chamberlain
2024-01-25 20:35 ` Luis Chamberlain [this message]
2024-01-25 20:35 ` [PATCH 5/6] bringup: move journal-server setup early Luis Chamberlain
2024-01-25 20:35 ` [PATCH 6/6] journal-server: fix by adjusting ordering Luis Chamberlain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240125203507.430113-5-mcgrof@kernel.org \
    --to=mcgrof@kernel.org \
    --cc=da.gomez@samsung.com \
    --cc=kdevops@lists.linux.dev \
    --cc=p.raghav@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox