Dynamically evaluate expressions
rejected
G
Glorious Pinniped
We'd like the ability to evaluate expressions before the pipeline runs. For example, we have a Service that has two manifests (one OCI Helm and one HTTP Helm). We want the user to be able to select the connector they want to use and have the primary manifest pre-populate using some kind of expression but, because expressions aren't evaluated yet, this causes unintended behavior. Primarily, this causes issues with other inputs for these manifests since we are also allowing the end user to select the Chart Version. In this scenario, the version inputs for both the manifests will show up which can cause confusion for our users. We have a workaround currently but, would like to have a way to dynamically evaluate the expressions before the user runs the pipeline and use those expression values to make decisions on whether or not certain other fields should be shown or pre-populated.
Log In
Canny AI
Merged in a post:
How to populate the value of Variable B based on the value of Variable A in a Harness
E
Established Canidae
How to populate the value of Variable B based on the value of Variable A in a Harness.
Explanation:
Variable A:
The value of Variable A uses <+input> to allow user input.
allowedValues restricts the input to predefined options like Option1, Option2, and Option3.
Variable B:
The value of Variable B is determined dynamically based on the value of Variable A using Harness's expression language.
Logic:
If Variable A is Option1, then Variable B is set to ValueForOption1.
If Variable A is Option2, then Variable B is set to ValueForOption2.
If Variable A is Option3, then Variable B is set to ValueForOption3.
The else block provides a fallback value if none of the conditions are met.
N
Nofar Bluestein
Hey,
Thank you for your question.
All pipeline variables can be referenced in runtime and can be used in the pipeline stage/steps. Using run/shell step you could have a script that check the value of the variable and can export a value, based on your specific use case, to another variable.
I think this documentation can help you understand this better: https://developer.harness.io/docs/platform/variables-and-expressions/harness-variables/
Since we use the idea portal for enhancement requests, If you need assistant with working with variables, please refer to the documentation below, or reach to support.
Thank you,
Nofar Bluestein
CI product manager
Rohan Gupta
rejected
Unfortunately the only way to do this is via code, the UI cannot process the dynamic values until the pipeline runs. We tried solving this use case in the past and were unable to,