Message ID | 20220513193831.4136212-4-mcgrof@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | kdevops: use linux-kdevops for the main tree | expand |
Hi Luis, On Fri, May 13, 2022 at 12:38:30PM -0700, Luis Chamberlain wrote: > Two playbooks share the concept of git cloning kdevops into > the target nodes (guests, cloud hosts, baremetal hosts) so that > expunge files can be used for avoiding tests. If you decide > you want to change the URL for that git tree it may not be > so obvious what to do. > > Fortunately the solution is simple. You just tell ansible to use > the new git tree URL. That's it. It won't remove the old directory > and things work as expected. > > But since we use the kdevops git tree on both fstests and blktests > it is not so obvious to developers that the thing to do here is > to just run 'make fstests' or 'make blktests' and even that is not > as efficient as that will also re-clone the fstests or blktests > tree respectively. When we just want to reset the kdevops git tree > we currently have no semantics to specify that. But since this is > a common post-deployment goal, just add a common playbook that let's > us do common tasks. > > All we need then is the kconfig logic to define when some commmon > tasks might make sense. So to reset your kdevops git tree, all you > have to do now is change the configuration for it, then run: > > make > make kdevops-git-reset > While I do like the idea of having this option, I still do not understand the main use case to have it as a separate make target. Wouldn't the developer already put the custom kdevops tree with CONFIG_WORKFLOW_KDEVOPS_GIT during the initial make menuconfig phase? I am just trying to understand the usecase when someone wants to change the kdevops tree after a test run. Maybe I am missing something here.
On Fri, May 20, 2022 at 04:44:05PM +0200, Pankaj Raghav wrote: > Hi Luis, > > On Fri, May 13, 2022 at 12:38:30PM -0700, Luis Chamberlain wrote: > > Two playbooks share the concept of git cloning kdevops into > > the target nodes (guests, cloud hosts, baremetal hosts) so that > > expunge files can be used for avoiding tests. If you decide > > you want to change the URL for that git tree it may not be > > so obvious what to do. > > > > Fortunately the solution is simple. You just tell ansible to use > > the new git tree URL. That's it. It won't remove the old directory > > and things work as expected. > > > > But since we use the kdevops git tree on both fstests and blktests > > it is not so obvious to developers that the thing to do here is > > to just run 'make fstests' or 'make blktests' and even that is not > > as efficient as that will also re-clone the fstests or blktests > > tree respectively. When we just want to reset the kdevops git tree > > we currently have no semantics to specify that. But since this is > > a common post-deployment goal, just add a common playbook that let's > > us do common tasks. > > > > All we need then is the kconfig logic to define when some commmon > > tasks might make sense. So to reset your kdevops git tree, all you > > have to do now is change the configuration for it, then run: > > > > make > > make kdevops-git-reset > > > > While I do like the idea of having this option, I still do not > understand the main use case to have it as a separate make target. > Wouldn't the developer already put the custom kdevops tree with > CONFIG_WORKFLOW_KDEVOPS_GIT during the initial make menuconfig phase? For initial setup yes. The value of the new make target is for when you already deployed kdevops, and now you want to change the git URL for the guests if they have workflows which clone kdevops for using expunges when testing such as with fstests and blktest. > I am just trying to understand the usecase when someone wants to change > the kdevops tree after a test run. Maybe I am missing something here. That is right, the use case here of the new make target is so that a user can change the target kdevops tree on the guests if they are working with fstests and blktests. Otherwise then the git tree will only change on the host. If you ran 'make fstests' for instance you git cloned fstests, compiled and installed it, but the kdevops tree was also cloned and used on each guest so to ensure only tests which are not expunged for the target test are run. Without this new make target if you wanted to reset the git tree on the guests you'd have to re-run 'make fstests'. Where as with the new target, it's just a one liner. Luis
diff --git a/kconfigs/workflows/Kconfig b/kconfigs/workflows/Kconfig index 7f71470..817335b 100644 --- a/kconfigs/workflows/Kconfig +++ b/kconfigs/workflows/Kconfig @@ -175,6 +175,10 @@ source "workflows/blktests/Kconfig" endmenu endif # KDEVOPS_WORKFLOW_ENABLE_BLKTESTS +config KDEVOPS_WORKFLOW_GIT_CLONES_KDEVOPS_GIT + bool + default y if KDEVOPS_WORKFLOW_ENABLE_FSTESTS || KDEVOPS_WORKFLOW_ENABLE_BLKTESTS + endif # WORKFLOWS_LINUX_TESTS endif # WORKFLOWS_TESTS diff --git a/playbooks/common.yml b/playbooks/common.yml new file mode 100644 index 0000000..48485e3 --- /dev/null +++ b/playbooks/common.yml @@ -0,0 +1,4 @@ +--- +- hosts: all + roles: + - role: common diff --git a/playbooks/roles/common/README.md b/playbooks/roles/common/README.md new file mode 100644 index 0000000..2b0084c --- /dev/null +++ b/playbooks/roles/common/README.md @@ -0,0 +1,38 @@ +common +====== + +The common role lets you add tasks which is commmon to all workflows. +Without this we would be duplicating code. + +Requirements +------------ + +None. + +Role Variables +-------------- + + * kdevops_git_reset: perform a git reset. This is useful in case you want + to change the URL you use for kdevops. + +Dependencies +------------ + +None. + +Example Playbook +---------------- + +Below is an example playbook task: + +``` +--- +- hosts: all + roles: + - role: common +``` + +License +------- + +copyleft-next-0.3.1 diff --git a/playbooks/roles/common/defaults/main.yml b/playbooks/roles/common/defaults/main.yml new file mode 100644 index 0000000..69cd0af --- /dev/null +++ b/playbooks/roles/common/defaults/main.yml @@ -0,0 +1,7 @@ +# SPDX-License-Identifier copyleft-next-0.3.1 +--- + +kdevops_data: "/data/kdevops" +kdevops_git: "https://github.com/linux-kdevops/kdevops.git" + +kdevops_git_reset: False diff --git a/playbooks/roles/common/tasks/main.yml b/playbooks/roles/common/tasks/main.yml new file mode 100644 index 0000000..4482349 --- /dev/null +++ b/playbooks/roles/common/tasks/main.yml @@ -0,0 +1,23 @@ +--- +- name: Import optional extra_args file + include_vars: "{{ item }}" + ignore_errors: yes + with_first_found: + - files: + - "../extra_vars.yml" + - "../extra_vars.yaml" + - "../extra_vars.json" + skip: true + tags: vars + +# Distro agnostic stuff goes below + +- name: git reset kdevops + environment: + GIT_SSL_NO_VERIFY: true + git: + repo: "{{ kdevops_git }}" + dest: "{{ kdevops_data }}" + tags: [ 'kdevops_reset'] + when: + - kdevops_git_reset|bool diff --git a/workflows/common/Makefile b/workflows/common/Makefile index da21d78..6596ed1 100644 --- a/workflows/common/Makefile +++ b/workflows/common/Makefile @@ -32,3 +32,15 @@ WORKFLOW_ARGS += data_user=$(WORKFLOW_DATA_USER) WORKFLOW_ARGS += data_group=$(WORKFLOW_DATA_GROUP) endif # CONFIG_WORKFLOW_INFER_USER_AND_GROUP == y + +ifeq (y,$(CONFIG_KDEVOPS_WORKFLOW_GIT_CLONES_KDEVOPS_GIT)) +kdevops-git-reset: + $(Q)ansible-playbook -f 30 -i hosts playbooks/common.yml --tags vars,kdevops_reset --extra-vars '{ kdevops_git_reset: True }' $(LIMIT_HOSTS) + +kdevops-help-menu: + @echo "Common workflow options:" + @echo "kdevops-git-reset: - Resets your kdevops git tree URL and contents on guests" + @echo + +HELP_TARGETS += kdevops-help-menu +endif # CONFIG_KDEVOPS_WORKFLOW_GIT_CLONES_KDEVOPS_GIT
Two playbooks share the concept of git cloning kdevops into the target nodes (guests, cloud hosts, baremetal hosts) so that expunge files can be used for avoiding tests. If you decide you want to change the URL for that git tree it may not be so obvious what to do. Fortunately the solution is simple. You just tell ansible to use the new git tree URL. That's it. It won't remove the old directory and things work as expected. But since we use the kdevops git tree on both fstests and blktests it is not so obvious to developers that the thing to do here is to just run 'make fstests' or 'make blktests' and even that is not as efficient as that will also re-clone the fstests or blktests tree respectively. When we just want to reset the kdevops git tree we currently have no semantics to specify that. But since this is a common post-deployment goal, just add a common playbook that let's us do common tasks. All we need then is the kconfig logic to define when some commmon tasks might make sense. So to reset your kdevops git tree, all you have to do now is change the configuration for it, then run: make make kdevops-git-reset Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> --- kconfigs/workflows/Kconfig | 4 +++ playbooks/common.yml | 4 +++ playbooks/roles/common/README.md | 38 ++++++++++++++++++++++++ playbooks/roles/common/defaults/main.yml | 7 +++++ playbooks/roles/common/tasks/main.yml | 23 ++++++++++++++ workflows/common/Makefile | 12 ++++++++ 6 files changed, 88 insertions(+) create mode 100644 playbooks/common.yml create mode 100644 playbooks/roles/common/README.md create mode 100644 playbooks/roles/common/defaults/main.yml create mode 100644 playbooks/roles/common/tasks/main.yml