You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
templating: adding fieldFrom helper function to retrieve a field from a previous expression (#210)
`field` templating helper function allow to retrieve a key into a
map[string], even if the key is not a valid templating keyword.
`fieldFrom` provides the same feature, expect that it doesn't use the
values map from the task/resolution/steps, but use the previous
templating pipeline as a templating source.
Closes#200
Signed-off-by: Romain Beuque <556072+rbeuque74@users.noreply.github.com>
Copy file name to clipboardExpand all lines: README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -211,6 +211,7 @@ The following templating functions are available:
211
211
|**`Golang`**| Builtin functions from Golang text template |[Doc](https://golang.org/pkg/text/template/#hdr-Actions)|
212
212
|**`Sprig`**| Extended set of functions from the Sprig project |[Doc](https://masterminds.github.io/sprig/)|
213
213
|**`field`**| Equivalent to the dot notation, for entries with forbidden characters |``{{field `config` `foo.bar`}}``|
214
+
|**`fieldFrom`**| Equivalent to the dot notation, for entries with forbidden characters. It takes the previous template expression as source for the templating values. Example: ``{{ `{"foo.foo":"bar"}`| fromJson | fieldFrom `foo.foo` }}`` | ``{{expr | fieldFrom `config``foo.bar`}}`` |
214
215
|**`eval`**| Evaluates the value of a template variable |``{{eval `var1`}}``|
215
216
|**`evalCache`**| Evaluates the value of a template variable, and cache for future usage (to avoid further computation) |``{{evalCache `var1`}}``|
216
217
|**`fromJson`**| Decodes a JSON document into a structure. If the input cannot be decoded as JSON, the function will return an empty string |``{{fromJson `{"a":"b"}`}}``|
0 commit comments