Project

General

Profile

coordination #108527

coordination #80142: [saga][epic] Scale out: Redundant/load-balancing deployments of openQA, easy containers, containers on kubernetes

[epic] os-autoinst plugins (or wheels or leaves or scrolls) for scalable code reuse of helper functions and segmented test distributions

Added by okurz 3 months ago. Updated about 2 months ago.

Status:
Blocked
Priority:
Normal
Assignee:
Category:
Feature requests
Target version:
Start date:
2021-01-08
Due date:
% Done:

0%

Estimated time:
(Total: 0.00 h)
Difficulty:

Description

Motivation

A common problem within test distributions is that they need common functionalities shared but often resort to "copy-pasting" which is bad. E.g. #106922 shows a problem related to the helper function lib::utils::ensure_unlocked_desktop which we also have in os-autoinst-distri-opensuse. We want to keep os-autoinst-distri-openQA as separate distribution so that we have a good showcase of a realistic openQA test distribution that we as SUSE QE Tools care about ourselves without being as simple as a plain "example" test distribution and also not as complicated or "monolithic" as os-autoinst-distri-opensuse. We should look for a way to better share code among test distributions, e.g. could be git submodules, git subrepos, perl helper packages, etc.

Considered approaches for improving scalability of code reuse within the scope of os-autoinst and test distributions

Discussing different approaches how to "share code" or functionality.

  1. copy-paste: Easiest but hard to maintain, that's what we want to avoid
    1. What we currently do in many cases
  2. Include more in os-autoinst directly,
    1. We already do that within the "distribution.pm", and e.g. os-autoinst-distri-opensuse inherits with its "susedistribution.pm"
    2. e.g. comparable to os-autoinst/distribution.pm ensure_installed which already has install functions for Fedora and Debian (last changed 7 years ago, maybe not even used by them at all). The current if/else is not nice, better would be proper inheritance
    3. Easiest might be code that does not use needle tags
    4. If we include helper code which is relying on needle tags
      1. then the needle tags are becoming part of the API so on changes proper deprecation process should be conducted.
      2. New needles are stored by default in test distribution code, so not "automatically" forwarded to os-autoinst
      3. We could still try to include just a single needle, like an "example" or "template"
      4. We needed support for multiple needle repositories
  3. helper functions in plugin repositories that can be loaded into os-autoinst or the test distribution by

    1. git submodule
    2. git subrepo
    3. package, e.g. dependencies.yaml same as we do for os-autoinst and os-autoinst-distri-opensuse possible, and then provide as openSUSE package and others, e.g. Debian, can easily maintain their version on top or contribute back upstream
    4. os-autoinst pulls specified plugin dependencies, like salt formulas or "collections" from https://galaxy.ansible.com/ or https://github.com/junegunn/vim-plug

      1. similar to our custom git ref loading we could specify even tags, versions, etc., see CASEDIR in https://github.com/os-autoinst/os-autoinst/blob/master/doc/backend_vars.asciidoc
        1. cache "most used plugins and versions" on a central openQA instance, similar to assets, then included in worker cache -> 5. we need a catchy name similar to "galaxy/formulas/collections", maybe "colors" (you know, chameleon, changing colors), branches, leaves, roots, rockets, wheels, magic with scrolls, spells, potions, "something-to-sleep-over"
  4. Maybe we just need to provide better and more "customization" points within os-autoinst which can be used for overriding and encourage test writers to contribute there

  5. Functions should be small and simple for easier overriding

Implementation suggestions

  • Create a folder using perl modules, e.g. x11_start_program from https://github.com/os-autoinst/os-autoinst-distri-openQA/blob/master/lib/susedistribution.pm#L8 without the actual needle and leave it to the test distribution to provide it.
    • Start with a local git repository, e.g. file://…
    • Afterwards provide in github repo
  • Provide the example as part of os-autoinst-distri-openQA, e.g. if a YAML file plugins.yaml exists next to a main.pm load all plugins from there
  • Provide template project with template README and template test definitions
  • Copy-pasting template project can make updating and maintaining hard, better provide a helper like "os-autoinst-plugin" with commands, like "ansible-galaxy". This tool can create initial folder structure ("os-autoinst-plugin and a very bare Makefile where e.g. "make test" just calls "os-autoinst-plugin test"
  • Start with "os-autoinst-plugin" which only supports one subcommand, "help"
  • Provide os-autoinst-plugin in openSUSE subpackage
  • folder structure "lib" is automatically added to perl library search path, "needles" is added to needle search path, "tests" is added to test search path
  • Include the one example needle as part of the plugin, e.g. https://github.com/os-autoinst/os-autoinst-needles-openQA/blob/master/desktop-runner-20191108.json
  • Prefix needle names with plugin name to prevent conflicts
  • What if a plugin wants to use another plugin? For now I would not allow that. Otherwise plugin maintainer needs to spell out a list of dependencies to be pulled in, at best in machine-readable format
  • Provide a github action

  • We also need to care about needles


Subtasks

action #81899: [easy][beginner] Move code from isotovideo to a module size:MWorkableokurz

action #108530: os-autoinst plugins: x11_start_program from os-autoinst-distri-openQA dynamically loaded from another git repo size:MBlockedcdywan


Related issues

Copied from openQA Project - coordination #106922: [epic][sporadic] openqa_from_git fails in dashboard due to ensure_unlocked_desktop not expecting password entry screen in case of locked desktop auto_review:"match=desktop-runner,screenlock timed out.*":retryBlocked2022-02-16

History

#1 Updated by okurz 3 months ago

  • Copied from coordination #106922: [epic][sporadic] openqa_from_git fails in dashboard due to ensure_unlocked_desktop not expecting password entry screen in case of locked desktop auto_review:"match=desktop-runner,screenlock timed out.*":retry added

#2 Updated by okurz 3 months ago

  • Status changed from New to Blocked
  • Assignee set to okurz

ok, we have one specific subtask. Let's start with that and see where it leads us.

Also available in: Atom PDF