Azure DevOps Services & Server Alerts DSL - an alternative to TFS Aggregator?
Whilst listening to a recent Radio TFS it was mentioned that TFS Aggregator uses the C# SOAP based Azure DevOps APIs; hence needed a major re-write as these APIs are being deprecated.
Did you know that there was a REST API alternative to TFS Aggregator?
My Azure DevOps Services & Server Alerts DSL is out there, and has been for a while, but I don’t think used by many people. It aims to do the same as TFS Aggregator, but is based around Python scripting.
However, I do have to say it is more limited in flexibility as it has only been developed for my (and a few of my clients needs), but its an alternative that is based on the REST APIs.
Scripts are of the following form, this one changes the state of a work item if all it children are done
1import sys
2# Expect 2 args the event type and a value unique ID for the wi
3if sys.argv\[0\] == "workitem.updated" :
4 wi = GetWorkItem(int(sys.argv\[1\]))
5 parentwi = GetParentWorkItem(wi)
6 if parentwi == None:
7 LogInfoMessage("Work item '" + str(wi.id) + "' has no parent")
8 else:
9 LogInfoMessage("Work item '" + str(wi.id) + "' has parent '" + str(parentwi.id) + "'")
10
11 results = \[c for c in GetChildWorkItems(parentwi) if c\["fields"\]\["System.State"\] != "Done"\]
12 if len(results) == 0 :
13 LogInfoMessage("All child work items are 'Done'")
14 parentwi\["fields"\]\["System.State"\] = "Done"
15 UpdateWorkItem(parentwi)
16 msg = "Work item '" + str(parentwi.id) + "' has been set as 'Done' as all its child work items are done"
17 SendEmail("richard@blackmarble.co.uk","Work item '" + str(parentwi.id) + "' has been updated", msg)
18 LogInfoMessage(msg)
19 else:
20 LogInfoMessage("Not all child work items are 'Done'")
21else:
22 LogErrorMessage("Was not expecting to get here")
23 LogErrorMessage(sys.argv)
I have recently done a fairly major update to the project. The key changes are:
Rename of project, repo, and namespaces to reflect Azure DevOps (the namespace change is a breaking change for existing users)
The scripts that are run can now be
A fixed file name for the web instance running the service
Based on the event type sent to the service
Use the subscription ID, thus allowing many scripts (new)
A single instance of the web site running the events processor can now handle calls from many Azure DevOps instances.
Improved installation process on Azure (well at least tried to make the documentation clearer and sort out a couple of MSDeploy issues)
Full details are on the project can be seen on the solutions WIKI, maybe you will find it of use. Let me know if the documentation is good enough