mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-10 13:37:08 +08:00
bake: allow interception to create derived contexts
This patch allows high level clients to define an EvalContext method which can derive a new context given a block and the base parent context. This allows users of the package to intercept evaluation before it begins, and define additional variables and functions that are bound to a single block. Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
@ -124,3 +124,11 @@ var timestampFunc = function.New(&function.Spec{
|
||||
return cty.StringVal(time.Now().UTC().Format(time.RFC3339)), nil
|
||||
},
|
||||
})
|
||||
|
||||
func Stdlib() map[string]function.Function {
|
||||
funcs := make(map[string]function.Function, len(stdlibFunctions))
|
||||
for k, v := range stdlibFunctions {
|
||||
funcs[k] = v
|
||||
}
|
||||
return funcs
|
||||
}
|
||||
|
Reference in New Issue
Block a user