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

Is there an idiomatic way to access Chart and Release objects #301

Closed eshepelyuk closed 7 months ago

eshepelyuk commented 9 months ago

Hello When using hull I need to access .Chart and .Release objects. Currently I am doing it like this

tag: _HT!{{ (index . "$").Chart.Version }}

Is there simpler/proper/idiomatic way of doing this ?

gre9ory commented 9 months ago

Hi @eshepelyuk,

at this time no. It is currently the only way to do this (and should work fine I think).

But saying this, would be nice to have a shorter way to do simple access to Chart and Release data.

A new transformation, maybe _HT~, which gives access to the the root context. In analogy to _HT*it may return simple values and complete array and dicts addressed via dot notation I think, eg:

_HT~Chart.Version
_HT~Release.Name

If you need more precise access to e.g. a dependency in .Chart:

dependencies: # A list of the chart requirements (optional)
  - name: The name of the chart (nginx)
    version: The version of the chart ("1.2.3")

you should use the flexible _HT! with (index . "$") anyways.

@Baum053 Was thinking that could maybe something you like to a look at?

Baum053 commented 9 months ago

Will try to get some time for this next week, definitly sounds like a good idea.

eshepelyuk commented 9 months ago

Thanks, folks.

Baum053 commented 8 months ago

Wanted to give a little update since it is taking a bit longer. First tests are looking good, probably we will introduce a notation like this

_HT**Chart.Version

The problem we are currently fighting with is that the Chart object we get back sadly for some reasons has lowercase properties instead of uppercase: https://helm.sh/docs/topics/charts/#the-chartyaml-file This will probably end up confusing for a lot of people so we try to do it directly in a way that both cases work.

eshepelyuk commented 8 months ago

As helm docs saying https://helm.sh/docs/topics/charts/#predefined-values Screenshot_2024-02-22-09-48-39-567.jpeg

Baum053 commented 7 months ago

Happy to announce we were finally able to release this feature. It is now available in the newest releases 1.29.7, 1.28.6 and 1.27.15

We documentated it shortly here: https://github.com/vidispine/hull/blob/main/hull/doc/transformations.md#get-chartrelease-informations For more examples how it can be used you can check the section test-get-transformation-on-root in our test file main/hull/files/test/HULL/sources/cases/basic/basic.values.hull.yaml

gre9ory commented 7 months ago

Thanks @Baum053!