Re: [PATCH v4 1/3] gen_hosts: use kdevops_workflow_name directly for template selection
Luis Chamberlain <[email protected]>
| Newsgroups | dev.linux.lists.kdevops |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Sep 04, 2025 at 08:05:56AM +0200, Daniel Gomez wrote:
> On 04/09/2025 02.15, Luis Chamberlain wrote:
> > The hosts.j2 template had become unwieldy with 40+ lines of conditional
> > logic to select which workflow template to include. Since kdevops already
> > defines KDEVOPS_WORKFLOW_NAME in Kconfig that's always set (either to the
> > workflow name or "mix" for non-dedicated), we can eliminate ALL conditional
> > logic.
> >
> > The entire hosts.j2 is now just:
> > {% include 'workflows/' + kdevops_workflow_name + '.j2' %}
> >
> > This massive simplification:
> > - Reduces hosts.j2 from 40+ lines to just 1 line of logic
> > - Removes ALL conditional template selection from gen_hosts playbook
> > - Eliminates ALL workflow-specific template overrides from Makefiles
> > - Makes adding new workflows trivial - just define KDEVOPS_WORKFLOW_NAME
> >
> > Additional changes:
> > - Split monolithic hosts.j2 into per-workflow templates under workflows/
> > - Rename default.j2 to mix.j2 to match non-dedicated workflow name
> > - Add missing 'cxl' to KDEVOPS_WORKFLOW_NAME in main Kconfig
> > - Add KDEVOPS_WORKFLOW_NAME to reboot-limit demo workflow
> >
> > Generated-by: Claude AI
> > Signed-off-by: Luis Chamberlain <[email protected]>
> > ---
> > kconfigs/workflows/Kconfig | 9 +
> > playbooks/roles/gen_hosts/tasks/main.yml | 293 ++----------------
> > playbooks/roles/gen_hosts/templates/hosts.j2 | 240 +-------------
> > .../roles/gen_hosts/templates/workflows/ai.j2 | 99 ++++++
> > .../gen_hosts/templates/workflows/blktests.j2 | 58 ++++
> > .../gen_hosts/templates/workflows/cxl.j2 | 7 +
> > .../templates/workflows/fio-tests.j2 | 38 +++
> > .../gen_hosts/templates/workflows/fstests.j2 | 72 +++++
> > .../gen_hosts/templates/workflows/gitr.j2 | 41 +++
> > .../gen_hosts/templates/workflows/linux.j2 | 110 +++++++
> > .../gen_hosts/templates/workflows/ltp.j2 | 41 +++
> > .../gen_hosts/templates/workflows/mix.j2 | 62 ++++
> > .../gen_hosts/templates/workflows/mmtests.j2 | 77 +++++
> > .../gen_hosts/templates/workflows/nfstest.j2 | 41 +++
> > .../gen_hosts/templates/workflows/pynfs.j2 | 7 +
> > .../templates/workflows/reboot-limit.j2 | 33 ++
> > .../templates/workflows/selftests.j2 | 53 ++++
> > .../gen_hosts/templates/workflows/sysbench.j2 | 53 ++++
> > workflows/ai/Makefile | 3 -
> > workflows/blktests/Makefile | 3 -
> > workflows/cxl/Makefile | 2 -
> > workflows/demos/reboot-limit/Kconfig | 5 +
> > workflows/fio-tests/Makefile | 3 -
> > workflows/fstests/Makefile | 3 -
> > workflows/gitr/Makefile | 3 -
> > workflows/linux/Makefile | 1 -
> > workflows/ltp/Makefile | 3 -
> > workflows/mmtests/Makefile | 3 -
> > workflows/nfstest/Makefile | 3 -
> > workflows/pynfs/Makefile | 3 -
> > workflows/selftests/Makefile | 3 -
> > workflows/sysbench/Makefile | 3 -
> > 32 files changed, 841 insertions(+), 534 deletions(-)
> > create mode 100644 playbooks/roles/gen_hosts/templates/workflows/ai.j2
> > create mode 100644 playbooks/roles/gen_hosts/templates/workflows/blktests.j2
> > create mode 100644 playbooks/roles/gen_hosts/templates/workflows/cxl.j2
> > create mode 100644 playbooks/roles/gen_hosts/templates/workflows/fio-tests.j2
> > create mode 100644 playbooks/roles/gen_hosts/templates/workflows/fstests.j2
> > create mode 100644 playbooks/roles/gen_hosts/templates/workflows/gitr.j2
> > create mode 100644 playbooks/roles/gen_hosts/templates/workflows/linux.j2
> > create mode 100644 playbooks/roles/gen_hosts/templates/workflows/ltp.j2
> > create mode 100644 playbooks/roles/gen_hosts/templates/workflows/mix.j2
> > create mode 100644 playbooks/roles/gen_hosts/templates/workflows/mmtests.j2
> > create mode 100644 playbooks/roles/gen_hosts/templates/workflows/nfstest.j2
> > create mode 100644 playbooks/roles/gen_hosts/templates/workflows/pynfs.j2
> > create mode 100644 playbooks/roles/gen_hosts/templates/workflows/reboot-limit.j2
> > create mode 100644 playbooks/roles/gen_hosts/templates/workflows/selftests.j2
> > create mode 100644 playbooks/roles/gen_hosts/templates/workflows/sysbench.j2
> >
>
> ...
>
> > diff --git a/playbooks/roles/gen_hosts/templates/workflows/pynfs.j2 b/playbooks/roles/gen_hosts/templates/workflows/pynfs.j2
> > new file mode 100644
> > index 00000000..6145b1a0
> > --- /dev/null
> > +++ b/playbooks/roles/gen_hosts/templates/workflows/pynfs.j2
> > @@ -0,0 +1,7 @@
> > +{# Workflow template for pynfs #}
> > +[all]
> > +localhost ansible_connection=local
> > +write-your-own-template-for-pynfs-workflow
> > +
> > +[all:vars]
> > +ansible_python_interpreter = "{{ kdevops_python_interpreter }}"
>
> Nit,
>
> Commit 71f085a4d77f ("kdevops: replace ansible hosts generation
> jinja2 templating") from kdevops-history introduced the
> "write-your-own-template-for...". It looks this patch is expanding this to
> other templates too (I only see this in hosts.j2 in kdevops upstream repo). I'd
> suggest to remove it as part of the cleanup done.
I'll send this as a follow up.
I pushed this series.
Luis