Skip to content

Draft: Add support for variable substitution

Gordon Bleux requested to merge (removed):jobvariables-envsubst into main

What does this MR do?

This extends the jobvariables expansion logic to add support for substitution operations, similar to what the POSIX shell specification provides.

note: the implementation is similar to what the POSIX and BASH spec defines. not all operations have been implemented and some of those who have, differ in syntax and/or behaviour.

What's the best way to test this MR?

the unit tests should cover the majority of test cases, a practical example could look like this:

---
example:
  variables:
    EMPTY:
    VALUE: value
    RESULT: "${EMPTY:-$VALUE}"
  script:
    - echo "RESULT: $RESULT"
    - 'test "$RESULT" = "value" && echo "success"'

What are the relevant issue numbers?

Closes #27177

Merge request reports