Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test and use rules to components mapping #10693

Merged
merged 27 commits into from
Jun 15, 2023

Commits on Jun 13, 2023

  1. Configuration menu
    Copy the full SHA
    766503d View commit details
    Browse the repository at this point in the history
  2. Enforce component mapping

    If a rule isn't part of any component, the build will fail.
    The enforcement will be efficient for the `linux_os` benchmark.
    jan-cerny committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    4ef6a60 View commit details
    Browse the repository at this point in the history
  3. Add a simple test for component consistency

    Also introduces a `ssg.components` module to the project which
    can be used later in other tools and build system to work with
    component files data.
    
    This commit adds a simple test case `test_components.py` which
    tests that
    - components don't map to rules that don't exist
    - all rules are mapped to at least 1 component
    - the rule is assigned to component according to templates or
      template parameters
    jan-cerny committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    2dacfff View commit details
    Browse the repository at this point in the history
  4. Add test for component based on platforms

    This test checks if a rule is mapped to component if it uses
    a package platform or other platforms that can be easily used
    to determine to which component the rule should belong to.
    jan-cerny committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    06c2448 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    699a453 View commit details
    Browse the repository at this point in the history
  6. remove env_yaml

    jan-cerny committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    e2fcfbe View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    5569fc7 View commit details
    Browse the repository at this point in the history
  8. Extract method

    This commit extracts method `__process_rule` to reduce the code
    complexity of the original method, as suggested by CodeClimate.
    jan-cerny committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    32aa53b View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    06726fb View commit details
    Browse the repository at this point in the history
  10. Reduce complexity of main function

    This aims to address the CodeClimate code complexity problem
    in the `main()`.
    jan-cerny committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    1487959 View commit details
    Browse the repository at this point in the history
  11. Reduce amount of parameters

    jan-cerny committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    1c21ea0 View commit details
    Browse the repository at this point in the history
  12. Avoid many return statements

    CodeClimate emits a warning if there is too many return
    statements in a single function.
    jan-cerny committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    caeb48d View commit details
    Browse the repository at this point in the history
  13. Use ssg.components module in _load_components

    This change reduces code duplication.
    jan-cerny committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    f442dd4 View commit details
    Browse the repository at this point in the history
  14. Allow products to specify the components directory

    Products can decide to use components or they can define their own set
    of components. Products specify a path to the directory with component
    files by the `components_root` key in the `product.yml`.
    This allows products like OCP to use components.
    jan-cerny committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    a13ed04 View commit details
    Browse the repository at this point in the history
  15. Extract function

    Extract function get_rule_to_components_mapping and move it to
    the ssg.components module in order to simplify the BuildLoader
    class.
    jan-cerny committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    3a0b1eb View commit details
    Browse the repository at this point in the history
  16. Simplify function test_platform

    The reason is to avoid code duplication.
    jan-cerny committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    a6c8c87 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    6211e68 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    aef1955 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    daa860f View commit details
    Browse the repository at this point in the history
  20. Add components to resolved rules

    This change will add the mapping of a rule to component to the
    resolved rules. Developers that build the content will be able
    to see all components that the given rule is assigned to in
    the resolved rule yamls.
    jan-cerny committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    4c97b55 View commit details
    Browse the repository at this point in the history
  21. Make the parameters required

    This will prevent everyone from running the script without its
    parameters.
    jan-cerny committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    9649fc9 View commit details
    Browse the repository at this point in the history
  22. Create template testing plugins

    This will allow developers to add additional tests for component
    mapping when a component assignement will be depending on the
    template used in the rule.
    jan-cerny committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    052e0c1 View commit details
    Browse the repository at this point in the history
  23. Replace must by should

    If this this behavior cannot be overridden using the world "must"
    or "shall" would be better. This applies to all the reasons in this file.
    jan-cerny committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    c7fbf85 View commit details
    Browse the repository at this point in the history
  24. Fix a traceback

    Addressing:
     loader.process_directory_tree(subdir)
      File "/__w/content/content/ssg/build_yaml.py", line 1265, in process_directory_tree
        self._load_group_process_and_recurse(start_dir)
      File "/__w/content/content/ssg/build_yaml.py", line 1259, in _load_group_process_and_recurse
        self._process_rules()
      File "/__w/content/content/ssg/build_yaml.py", line 1383, in _process_rules
        if not self._process_rule(rule):
      File "/__w/content/content/ssg/build_yaml.py", line 1372, in _process_rule
        rule.components = self.rule_to_components[rule.id_]
    TypeError: 'NoneType' object has no attribute '__getitem__'
    jan-cerny committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    f424f0d View commit details
    Browse the repository at this point in the history
  25. Remove a space

    jan-cerny committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    0156763 View commit details
    Browse the repository at this point in the history
  26. Fix CodeClimate problem

    Avoid code duplication in ssg/components.py. The mapping functions
    are similar, they differ only in attribute and the type of the
    dicitionary values. By unifying the code into a single private function
    we can avoid this duplication.
    jan-cerny committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    4cdee0c View commit details
    Browse the repository at this point in the history

Commits on Jun 14, 2023

  1. Configuration menu
    Copy the full SHA
    5d20bde View commit details
    Browse the repository at this point in the history