Automatic creation of ADO Work Items from OneFuzz allows for the user to customize any field using scriban templates.
There are multiple objects provided via the template engine that can be used such that any arbitrary component can be used to flesh out the configuration:
Using these objects allows dynamic configuration. As an example, the project
could be specified directly, or dynamically pulled from a template:
{
"project": ""
}
There are additional values that can be used in any template:
Note, most, but not all fields in ADO take HTML. If you want the URL to be clickable, make it a link.
{
"config": {
"base_url": "https://dev.azure.com/org_name",
"auth_token": "ADO_AUTH_TOKEN",
"type": "Bug",
"project": "Project Name",
"ado_fields": {
"System.AreaPath": "Area Path Here",
"Microsoft.VSTS.Scheduling.StoryPoints": "1",
"System.IterationPath": "Iteration\\Path\\Here",
"System.Title": " - ",
"Microsoft.VSTS.TCM.ReproSteps": "This is my call stack: <ul> <li> </li> </ul>"
},
"ado_duplicate_fields": {
"System.Reason": "My custom value that means a work item is a duplicate",
"Custom.Work.Item.Field": "My custom value that means a work item is a duplicate"
// note: the fields and values below are checked by default and don't need to be specified
// "System.Reason": "Duplicate"
// "Microsoft.VSTS.Common.ResolvedReason": "Duplicate"
},
"comment": "This is my comment. <br> <pre></pre>",
"unique_fields": ["System.Title", "System.AreaPath"],
"on_duplicate": {
"comment": "Another <a href=''>POC</a> was found in <a href=''>target</a>. <br> <pre></pre>",
"set_state": { "Resolved": "Active" },
"ado_fields": {
// set any fields that should be created or updated when a duplicate is detected,
// in the same format as the top-level ado_fields above
},
"increment": ["Microsoft.VSTS.Scheduling.StoryPoints"]
}
}
}
The unique_fields is used as a tuple to uniquely identify an ADO work item.
For the above configuration, this evaluates to the following
Wiql
query.
Given the report crash site of “example” and executable of “fuzz.exe”
select [System.Id] from WorkItems where
[System.Title] = "example - fuzz.exe" AND
[System.AreaPath] = "Area Path Here"
This allows for customized ADO work item de-duplication.
NOTE: In some instances, while work items are created serially, ADO work item creation has latency such that created work items do not always immediately show up in the queries. In some cases, this may cause spurious duplicate work items in the case that duplicate crash reports occur in rapid succession.
If no existing work items match the aforementioned tuple, a new work item is created.
comment field.There are multiple configurable actions that can performed upon finding a duplicate work item.
comment field within on_duplicate.System.IterationPath replaced with Iteration\\Path\\Here2 whenever a
duplicate bug is found.Microsoft.VSTS.Scheduling.StoryPoints is initially set to 1 and incremented
each time a duplicate crash report is found. To not increment any field, set
it to an empty array.To do nothing on duplicate reports, use the following on_duplicate entries:
"on_duplicate": {
"comment": null,
"set_state": {},
"fields": {},
"increment": []
}
In the CLI, don’t provide any of the –ondup* arguments
This will not update/reopen work items that:
OR
All fields MUST match in order to skip
"on_duplicate": {
"unless": [
{
"System.State": "Closed",
"System.Reason": "Wont Fix"
},
{
"System.State": "Closed",
"System.Reason": "No Repro"
}
]
}
To create a similar configuration monitoring the container oft-my-demo-job-reports, use the following command:
onefuzz notifications create_ado oft-my-demo-job-reports \
"Project Name" https://dev.azure.com/org_name \
ADO_AUTH_TOKEN Bug System.Title System.AreaPath \
--fields \
System.AreaPath=OneFuzz-Ado-Integration \
Microsoft.VSTS.Scheduling.StoryPoints=1 \
"System.IterationPath=Iteration\\Path\\Here" \
"System.Title= - " \
"Microsoft.VSTS.TCM.ReproSteps=This is my call stack: <ul> <li> </li> </ul>" \
--comment "This is my comment. " \
--on_dup_comment "Another <a href=''>POC</a> was found in <a href=''>target</a>" \
--on_dup_set_state Resolved=Active \
--on_dup_fields "System.IterationPath=Iteration\\Path\\Here2" \
--on_dup_increment Microsoft.VSTS.Scheduling.StoryPoints