How can I populate a pickLists in Azure Devops Tasks with a json file?
I have this json file:
[
{"Item1":"Item1"},
{"Item2":"Item2"},
{"Item3":"Item3"},
{"Itemn":"Itemn"}
]
I need that the pickList recibe this file as a parameter and show this options, somethink like this...
{
"name": "businessprocess",
"type": "pickList",
"label": "Business",
"defaultValue": "",
"required": true,
"helpMarkDown": "Select One"
"options": path to jsonFile....
}
I'm afraid we don't have such out-of-box way to populate the pickLists with another json file.
You can check tasks.json schema, the options
element is designed to be an object
type. And as I know json objects should be written in key/value
pairs with format { "key1":"xx", "key2":xx, "key3":xx}
. So you can't pass the path of jsonFile as property of options
element, that's not expected key-value pairs of options
.
Instead I think you should write the key-value pairs directly in tasks.json file, just like what our official tasks do:
"options": {
"build": "build",
"push": "nuget push",
"pack": "pack",
"publish": "publish",
"restore": "restore",
"run": "run",
"test": "test",
"custom": "custom"
}