You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when running garden run workflow we get an invalid template string error when using variables with helper functions.
Expected behavior
Reproducible example
command: [deploy, "${var.services ? replace(var.services, ' ', ',') : null}"]
results in the following error:
`Error: Invalid template string (${var.services ? replace(var.servi…): Error validating argument 'string' for replace helper function: value must be a string
at resolveTemplateString (/snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/build/src/template-string/template-string.js:0)
at $resolveTemplateStrings (/snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/build/src/template-string/template-string.js:0)
at Object.resolveTemplateStrings (/snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/build/src/util/profiling.js:0)
at /snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/build/src/template-string/template-string.js:0
at Array.map ()
at $resolveTemplateStrings (/snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/build/src/template-string/template-string.js:0)
at Object.resolveTemplateStrings (/snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/build/src/util/profiling.js:0)
at RunWorkflowCommand. (/snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/build/src/commands/run/workflow.js:0)
at Generator.next ()
at fulfilled (/snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/build/src/commands/run/workflow.js:0)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Error Details:
err:
detail:
value:
message: "\e[31mCould not find key \e[37mservices\e[39m\e[31m\e[39m\e[31m under \e[39m\e[37mvar\e[39m\e[31m.\e[39m"
context: argument 'string' for replace helper function
errorDescription: value must be a string
errorDetails:
- message: value must be a string
path: []
type: string.base
context:
label: value
value: errdetail~value
type: template-string
Workflow deploy-services failed. Total time elapsed: 7.74 Sec.
Done flushing all events and log entries.
Invalid template string (${var.services ? replace(var.servi…): Error validating argument 'string' for replace helper function: value must be a string`
Hmm yes, I can see the issue, I'll look into it. The workaround for this for the moment would be something like ${var.services ? replace(var.services || ' ', ' ', ',') : null}. Notice the added || ' '. It's ugly but works until the fix is done 😬 .
Bug
Current Behavior
when running garden run workflow we get an invalid template string error when using variables with helper functions.
Expected behavior
Reproducible example
command: [deploy, "${var.services ? replace(var.services, ' ', ',') : null}"]
results in the following error:
`Error: Invalid template string (${var.services ? replace(var.servi…): Error validating argument 'string' for replace helper function: value must be a string
at resolveTemplateString (/snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/build/src/template-string/template-string.js:0)
at $resolveTemplateStrings (/snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/build/src/template-string/template-string.js:0)
at Object.resolveTemplateStrings (/snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/build/src/util/profiling.js:0)
at /snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/build/src/template-string/template-string.js:0
at Array.map ()
at $resolveTemplateStrings (/snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/build/src/template-string/template-string.js:0)
at Object.resolveTemplateStrings (/snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/build/src/util/profiling.js:0)
at RunWorkflowCommand. (/snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/build/src/commands/run/workflow.js:0)
at Generator.next ()
at fulfilled (/snapshot/project/tmp/pkg/cli/node_modules/@garden-io/core/build/src/commands/run/workflow.js:0)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Error Details:
err:
detail:
value:
message: "\e[31mCould not find key \e[37mservices\e[39m\e[31m\e[39m\e[31m under \e[39m\e[37mvar\e[39m\e[31m.\e[39m"
context: argument 'string' for replace helper function
errorDescription: value must be a string
errorDetails:
- message: value must be a string
path: []
type: string.base
context:
label: value
value:
errdetail~valuetype: template-string
Workflow deploy-services failed. Total time elapsed: 7.74 Sec.
Done flushing all events and log entries.
Invalid template string (${var.services ? replace(var.servi…): Error validating argument 'string' for replace helper function: value must be a string`
Workaround
Suggested solution(s)
Additional context
https://telushealth.slack.com/archives/C02344N4H39/p1634097347022400?thread_ts=1634097208.022200&cid=C02344N4H39
Your environment
WSL2: Ubuntu 20.04
0.12.30-edge-b705c6f7
The text was updated successfully, but these errors were encountered: