-
Notifications
You must be signed in to change notification settings - Fork 869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bad substitution error on yaml template expansion #1647
Comments
@ericsciple looks like template parameters is not get expanded? |
try this: parameters:
param: default
steps:
- task: Bash@3
displayName: bash expansion
inputs:
targetType: 'inline'
script: |
${{ format('echo {0}', parameters.param) }} or this: parameters:
param: default
steps:
- task: Bash@3
displayName: bash expansion
inputs:
targetType: 'inline'
script: |
echo $param
environment:
param: ${{ parameters.param }} the first example may not work yet, depending on which scale unit your account is located in. currently the template expressions must be the whole value. |
no 2 did the trick, it just needs to say |
@ericsciple ok, am i being thick again or this doesnt work? how is this supposed to work?
i tried with or without quotes (single\double) |
|
what is that supposed to mean? @TingluoHuang |
the right side of |
ok, this makes no sense, how am I supposed to reuse parameters when i cant combine them? @TingluoHuang |
|
am i supposed to do this in every case when i need to build a string? how do I combine this with native variables? |
@ericsciple for idea. |
@4c74356b41 currently you will need to use the format function everywhere you need to string concat. We want to enable using template expressions within strings, without requiring the format function, but it's feature work and it just hasn't been the next priority yet. I do think it would be a nice improvement. The format function is new. I think it has rolled out to every scale unit now. The docs are behind. I have been working through restructuring the docs based on common friction customers are having. Template docs are next on my list. |
ok, it appears the format function did the trick + it didnt mangle the @ericsciple I understand this is a preview feature, but man, when you try something thats supposed to work and it doesn't. Thats reaaaally frustrating (especially when you put 20 hours into that). Maybe I'm not good enough with VSTS. I really suggest you mention this use exactly one parameter of |
Did not intend to link to a commit, but to follow up for anyone else who are working with YAML and VSTS, here is the proper way of combining parameters in YAML with variables in VSTS:
So basically just leave the VSTS variables as a result of the string, and run the format method and supply the parameters with YAML variables/parameters that you have available. |
Have you tried trouble shooting?
yes
Agent Version and Platform
2.134.2, CentOS 7
VSTS Type and Version
VisualStudio.com
What's not working?
I have a yaml definition
referencing this template
erroring with bad substitution of the variable
Did I miss anything?
The text was updated successfully, but these errors were encountered: