Currently, when a variable "my_variable" is defined, it can be referenced in any tasks with "${my_variable}".
Sometimes, a variable might needs some changes, to provide a few:
- a string variable "my_variable" needs to be provided to a task in lower case
- a date variable "my_date" needs to be formatted as a string to be provided to a webservice

The current solution is to use a `Jython Script` which can transform such variable:
- releaseVariables["my_variable_lower"] = releaseVariables["my_variable"].lower()
- releaseVariables["my_date_formatted"] = SimpleDateFormat("yyyy-MM-dd").format(releaseVariables["my_date"])

With the amount of data we have to transform in our releases, we have big `Jython Script`, with the sole reason of converting such variables.

This make templates harder to read, to understand, and break the declarative nature of Release. For each variable which needs to be transformed, we have then two or more other variables which are just the transformation of one variable into another, sometimes only used once in the next task.

This also requires the template creator and maintainer to understand jython, which is a mix of java and python.


We are proposing to extend the variable interpolation to support value transformation.
For examples:
- a string variable "my_variable" needs to be provided to a task in lower case: "${my_variable|lower}"
- a date variable "my_date" needs to be formatted as a string to be provided to a webservice: "${my_date|format 'yyyy-MM-dd'}"

Who would want this:
- Anyone who don't understand jython
- Anyone who have issue finding which jython script in a template has created the variable "my_date_formatted"

Why it's valuable to them:
- Transforming data would be easier to do, and only done directly at the task which requires it, not in a hard to read jython script.
- This will decrease the number of tasks in a template

How it would be used:
- On any task field, adding a `|` character would start a value transformation, executed by Release. Such transformation could even be chained with multiple `|`: "${my_string|function1|function2}"

Comments

  • Thank you for providing a clear definition and use case.

    We are planning to introduce variable validation, and potentially input validation, in the 25.x releases. This feature could help in scenarios like ensuring variables are collected in lowercase. However, we acknowledge that it wouldn’t address the date transformation use case.

    We will continue to monitor the upvotes for this request. If you believe variable validation could support some of your use cases, please track these ideas for updates:
    Validating variable values: https://ideas.digital.ai/devops/Idea/Detail/4347
    Validating input fields in forms: https://ideas.digital.ai/devops/Idea/Detail/4196