I have a jsonnet function that accepts boolean values as parameters. Suppose I have a jsonnet file called deploy.jsonnet
:
function (image='', isReady) {
local config = self,
deploy: if isReady then [ do deployment ]
else [don't do deployment]
I pass values to this function like:
jsonnet -A name=new-deployment -A isReady=true deploy.jsonnet
but the problem is that -A
always provides values as String so the conditional check will fail with the message:
RUNTIME ERROR: Condition must be boolean, got string.
./deploy.jsonnet:(133:45)-(148:15) object <anonymous>
During manifestation
Also I didn't see an option to parse a string to boolean value.
Question is - is there any way to pass boolean value to a function in jsonnet or can we parse a string to boolean?