问题
When using Pipeline resource an error occurs when I am trying to use the value of the Version field as a variable value.
resources:
pipelines:
- pipeline: BuildApp
source: BuildApp
# version: $(appversion) <- this doesn't work
version: 20191204.17 <- this works
Static version looks not so useful. Is it possible to specify such version for each run dynamically? For example, using variables.
回答1:
I tested and reproduced the problem you met and use parameters, template variable, template parameter or template will make no change, it keeps throwing error messages.
I think you can only use predefined variables here according to this thread: Is it possible to use a variable in the ref property of resources:repository for Azure DevOps YAML?.
You could add your request for this feature on our UserVoice site (https://developercommunity.visualstudio.com/content/idea/post.html?space=21 ), which is our main forum for product suggestions. Thank you for helping us build a better Azure DevOps.
回答2:
The suggestion is resolved:
https://developercommunity.visualstudio.com/content/idea/845445/pipeline-resource-version-property-as-a-variable-1.html
Microsoft's answer: While we can’t allow variables in that field, this is an excellent use case for runtime parameters.
来源:https://stackoverflow.com/questions/59184728/specifying-pipeline-resource-version-using-variable