moleike / haskell-jsonnet

🎏 Haskell implementation of Jsonnet
https://hackage.haskell.org/package/jsonnet
Other
21 stars 6 forks source link

External variables #38

Closed moleike closed 2 years ago

moleike commented 3 years ago

Any Jsonnet value can be bound to an external variable, even functions, which are accessible anywhere in the config, or any file, using std.extVar("foo")

jsonnet --ext-str version="0.9" --ext-code dry-run=true ...
local build_image_version = std.extVar('version');
local dry_run = std.extVar('dry-run');
...
local run(name, commands) = {  
  name: name,  
  image: 'foo/build-image:%s' % build_image_version,  
  commands: commands,
};