Referenced variable if not found should return null
long-term
R
Representative Llama
Include a project/account level setting to return null in case the reference variable doesn't exist.
Log In
Autopilot
Merged in a post:
Undefined variable behaviour in NG
B
Bronze Barracuda
Currently the behaviour in NG k8s apply step is that we throw exception if an unresolvable expression is provided.
This feature request is to change the above behaviour so that the variable resolution will resolve to null and not throw an exception.
Also if feasible implement a solution where we can define a default value for the variable in case the variable does not exist.
Rohan Gupta
marked this post as
long-term
Shylaja Sundararajan
marked this post as
pending feedback
R
Representative Llama
Shylaja Sundararajan: I checked with excluding the <+manifest.metrics> expression in the shell script and using the quotes in all the scripts which seems to work as expected for that use case.
Can we get an idea of what all things would resolve to the expression itself and what all would resolve as null?!
This would help in deciding if we can go by this approach as of now or not.
cc: Empirical Wren
Shylaja Sundararajan
Hi Raj,
Could you please check on the response in ZD ticket and share details
Regards
Shylaja
R
Representative Llama
Shylaja Sundararajan: Are you talking about ticket 46667 ?! That seems to be marked as solved when the canny got created out of it and not seeing any pending query. If any other ticket can you please share me the ticket and/or add it here for my ref?
Rohan Gupta
Merged in a post:
Expression is not being evaluated - Add settings to choose expression behaviour
R
Representative Llama
User wanted the expression in NG to resolve to null.
C
Constant Tiger
Hey Rohan Gupta, Can we close this as the duplicate of https://ideas.harness.io/continuous-delivery/p/referenced-variable-if-not-found-should-return-null?
Rohan Gupta
marked this post as
long-term
Hi Raj, thank you for your feature request, we have reviewed and have added this to our long term roadmap. We will follow up if there are any further questions
R
Representative Llama
Rohan Gupta: This seems a parity miss from the CG. In case if I set just set the override for one env only, and do not have any default var in service, it would fail the pipeline in another env, which should not be the case IMO.
If this is there for a long time, we need to create the unnecessary variables which adds confusion and adds the requirement to define the vars for a service that does not need it.
IMO it is a bug and a parity miss and should not be in this portal at all but anyhow it does not seem to be the ideal thing in any way.
Rohan Gupta
marked this post as
under review
Thank you for your feature request, we are reviewing with our product and engineering team. Will follow up here
R
Representative Llama
Not sure if this belongs here or is a bug as it was raised 2 months back(46667), but adding some more info on this.
In CG, if some var is not set the value is shown as null and all the config we have works around the check on what to do as default var if the value is not set. Now in the case of NG, it fails the step itself if the value is not set, not having a default value of null or anything else.
We have > 30 common var across services and we do not expect everyone to be provided.