Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply some generic rules at organization level to all projects #73

Open
KamranAslamBhatti opened this issue Aug 27, 2019 · 8 comments
Open
Labels
enhancement New feature or request
Milestone

Comments

@KamranAslamBhatti
Copy link

Hi,
Is there any way we can apply a common rule at organization level to all projects under that organization and also when any new project created under that organization then that rule by default applies to the new project too. Following is example:

  • Whenever a work item created, it's CreateDate field should be auto filled to currentdate. This rule should be default to each project under an organization and also when a new project created this rule should be auto apply so that I do not have to run:
    aggregator-cli map.rule
    command against each project in the organization.
    The above example is simple, it is just to make my question simple. I want some rules to apply at organization level and whenever user creates project they should auto apply to those projects. Is it possible?
@giuliov
Copy link
Member

giuliov commented Aug 27, 2019

You pose two questions:

  1. apply a rule to a whole organisation
  2. automatically add rules when a project is created

The first answer is yes: you can deploy a single rule and add a mapping to each and every project in the org so they all invoke the same rule. Clearly the rule has to take in consideration the event context (say project A and B do not have the same set of work item types, like an Agile vs Scrum project) to work correctly.
Aggregator has no facility for organisation, you need to invoke it multiple times. I take note and see to add some helpers post 1.0 release.

I am lean to answer no to the second part: TFS/AzDOS have no public event for a new project.
You have two ways to work around this limit:

  • or you use a tool that invokes TFS/AzDOS create project API first and then invoke Aggregator to map the rules
  • you periodically run a script that looks for new projects and maps Aggregator rules on them

I can help you with directions and I will research if this is the definitive answer.

@giuliov giuliov added enhancement New feature or request help wanted Extra attention is needed pinned Stops stale[bot] from closing this issue question Further information is requested and removed help wanted Extra attention is needed question Further information is requested labels Aug 27, 2019
@giuliov
Copy link
Member

giuliov commented Aug 29, 2019

After more digging I found a positive answer to the second question: there is a way to be notified when a project is created (or removed). Implementation is non trivial so we will implement it after release 1.0.

Please @KamranAslamBhatti share your thinking; do not close the issue as it will help us track the feature in the backlog.

@KamranAslamBhatti
Copy link
Author

Giuliov, Could you please share how can we do the following:

  • there is a way to be notified when a project is created (or removed).

Thanks,
Kamran

@giuliov
Copy link
Member

giuliov commented Nov 6, 2019

As I said, implementation is non-trivial: one should add many things to Aggregator CLI and its runtime. Things that come to mind:

  • add support for Project events in CLI map command
  • add listener for Project events in Runtime
  • expose Project object(s) to Rules (I guess a read-only object suffices, this would avoid managing object caching and updating)

You can submit a PR that implements the above items, I would be delighted to review and merge it.

@giuliov giuliov closed this as completed Nov 6, 2019
@giuliov giuliov reopened this Nov 6, 2019
@giuliov giuliov added this to the v1.1 milestone Dec 26, 2019
@giuliov giuliov removed the pinned Stops stale[bot] from closing this issue label Dec 26, 2019
@RSMJreck
Copy link

@giuliov - Could you point me to where the Project events are? I've been looking everywhere that I can think of to find where you could get notified a project is created and haven't been able to find it. I might be able to start some work around this to get it started.

@giuliov
Copy link
Member

giuliov commented Apr 23, 2020

I cannot find any notes on the "non trivial" solution and, as I wrote in the initial response, there are no events in public docs.

An idea is to use a Timer binding instead of the normal HTTP binding.
The difference should be confined to the aggregator-function project. I guess it would be better to specialise run.csx per "logical" event type: from FunctionTemplate/run.csx to FunctionTemplates/workitem/run.csx, FunctionTemplates/project/run.csx ecc.
This has a cascade effect: AzureFunctionHandler.RunAsync method cannot retrieve the workitem, the self object in rules is now a project object; probably need some declaration in the rule to prevent mapping errors (a rule designed for project event mapped to a workitem event).
Finally the timer function need some permanent store to note when a project is added/deleted (diff'ing state) and invoke the rule.

We can use Slack for discussing details, if you like the idea.

Also @jessehouwing may have some smart idea on this topic.

@jessehouwing
Copy link

jessehouwing commented Apr 23, 2020 via email

@RSMJreck
Copy link

The audit looks promising. I'll try to play around with it a little.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants