vidispine / hull

The incredible HULL - Helm Uniform Layer Library - is a Helm library chart to improve Helm chart based workflows
https://github.com/vidispine/hull
Apache License 2.0
231 stars 13 forks source link

Enhancement of Helm Helper Function Templates for Superior Intuitiveness, Readability, and Efficiency #277

Closed JuryA closed 9 months ago

JuryA commented 10 months ago

This pull request presents an extensive array of refinements within the Hull Named Templates, with special emphasis on enhancing intuitiveness. The principal updates are as follows:

  1. Refinement of hull.util.merge:

    • This includes optimization of variable assignment and logic in _util.tpl.
    • A focus has been placed on simplifying condition checks and enhancing clarity in the merge-to-YAML conversion process, making the code more intuitive for users.
  2. Enhancement of hull.util.field:

    • Aimed at augmenting readability, efficiency, and intuitiveness in the template.
    • Features an intuitive approach for setting default indentation values and an efficient method for key presence verification in the specification.
    • Involves the construction of key-value pairs using a dictionary, which are then converted to YAML before indentation, for a more intuitive understanding.
  3. Simplification of hull.util.yaml:

    • This update simplifies the template logic, emphasizing intuitiveness and the removal of unnecessary condition checks.
    • It streamlines YAML generation using a dictionary object, making the process more straightforward and intuitive.
  4. Refinement of hull.util.include.k8s:

    • Focuses on improvements in readability, efficiency, and intuitiveness.
    • Includes relocating default values for $hullObjectBaseKeys, $hullObjectKeys, and $spec to more suitable locations.
    • Simplifies conditional checks and assignments within the range loop using pipe operators, enhancing the intuitiveness of the code.
  5. Elimination of Trailing Whitespaces in Template Comments:

    • Addresses inconsistencies in whitespace within the comment sections of various helper functions and methods.
    • Removes trailing spaces to ensure uniformity in comment structure and adds a newline at the end of each file to enhance readability and coding standards compliance.

By emphasizing intuitiveness, this PR significantly improves the readability, maintainability, and efficiency of the Helm helper function templates' code.

gre9ory commented 10 months ago

Hi @JuryA, great to see you here (again). Thank you for this PR!

Currently the gated pipeline fails with this syntax problem:

[ERROR] templates/: parse error at (hull-test/charts/hull/templates/_util.tpl:51): unexpected "{" in operand
Error: 1 chart(s) linted, 1 chart(s) failed

I am not sure if I can make the errors from our internal pipelines more transparent, will need to check this.

You should also be able to run the tests locally of course, sadly I think the documentation on that is lacking. Will look into it. If you need help on executing tests locally I am happy to help, personally I run them using VSCode and the Gauge plugin which is pretty convenient.

gre9ory commented 9 months ago

@JuryA I am preparing the next releases to be out this week,

Do you want me to incorporate above changes into the next releases or do you plan on contributing more work on this PR since it is currently still in draft mode?

gre9ory commented 9 months ago

@JuryA The proposed code changes have been manually merged to the latest releases. I will close this PR for now.

JuryA commented 9 months ago

Thank you! I must admit that there were a few issues I overlooked in my initial review. I hope you were able to identify them. Currently, I am fully engaged with my regular work commitments, which unfortunately leaves me with limited availability to address these activities at the moment. I appreciate your understanding and patience.