azure-cli-extensions
azure-cli-extensions copied to clipboard
--query not working with azure devops work item fields
Describe the bug
I am attempting to use a JMESPATH filter to bring back just the work item ids and work item titles related to a given Azure DevOps PR. I am able to get the work item ids, but not the title.
The query I am trying to run is [*].[id, fields."System.Title"]
which, with the appropiate powershell escapes is:
[*].[id, fields.`"System.Title`"]
Note- if I do not provide a query parameter and save the results to a file ( az repos pr work-item list > myFile.json
) and then run a JMESPATH expression over that in visual studio, I get the expected results.
Command Name
az repos pr work-item list Extension Name: azure-devops. Version: 0.12.0.
Errors: Does not return expected data
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
- Put any pre-requisite steps here... Using powershell
$qry = "[*].[id, fields.`"System.Title`"]"
az repos pr work-item list --id 1 --query $qry
Expected Behavior
Returns both the id and title of work items from the pr identified.
[
[
3000,
"My title 1"
],
[
4000,
"My title 2"
]
Actual Behavior
Returns the id, but the title is null
[
[
3000,
null
],
[
4000,
null
]
Environment Summary
Windows-10-10.0.18362-SP0
Python 3.6.6
Shell: powershell.exe
azure-cli 2.0.67 *
Extensions:
azure-devops 0.12.0
Additional Context
Hi @gauravsaralMs , could you please help with this devops issue ?
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @narula0781, @ashishonce, @romil07.
I found this bug item as I still faced the same issue. As a workaround (or maybe as expected behaviour) the back-ticks need to be escaped with a \
too.
So the following should work as expected:
$qry = "[*].[id, fields.\`"System.Title\`"]"
az repos pr work-item list --id 1 --query $qry