devspace icon indicating copy to clipboard operation
devspace copied to clipboard

Support custom functions in dependencies section

Open jackwilsdon opened this issue 2 years ago • 1 comments

Is your feature request related to a problem?
No

Which solution do you suggest?
Allow calling custom functions in the dependencies section of devspace.yaml.

Which alternative solutions exist? None

Additional context
Expressions in the configuration appear to be resolved using ExecuteSimpleShellCommand here, which doesn't look to support custom functions (they appear to be passed in via the handler, but ‎ExecuteSimpleShellCommand uses the basic handler).

I'd like to use a function in the dependencies section to provide the ability to override a dependency with a local copy:

version: v2beta1
functions:
  get_dependency: |
    VAR_NAME=DEVSPACE_DEPENDENCY_${1^^}
    if [ -z "${!VAR_NAME}" ]; then
      echo "git: $2"
      if [ $# -gt 2 ]; then
        echo "subPath: $3"
      fi
    else
      if [ $# -gt 2 ]; then
        echo "path: ${!VAR_NAME}/$3"
      else
        echo "path: ${!VAR_NAME}"
      fi
    fi
dependencies:
  example: $(get_dependency example https://github.com/example)

jackwilsdon avatar Nov 21 '23 12:11 jackwilsdon

Hey, @jackwilsdon

Thanks for opening this issue! We'll discuss this internally and decide how to prioritise it!

alexandradragodan avatar Nov 28 '23 12:11 alexandradragodan