[Resolved] Trying to randomly assign audits to users in projects

Hey,

I hope I am in the correct place. I have a svn repository. It is sending audits to a whole group at the moment. I am trying to make it apply to a single person in a group. I want it so it apples to someone randomly in a group. Is there a was of doing that. I have looked at the web-hooks and creating an extension but that seems a bit much for what I want to do. Have you any suggestions on how I should achieve this?

Thanks
Benjamin Godfrey

There’s no support for doing that built in - the intention is that the amount of stuff assigned to a team (“project”) is not overwhelming, so the team can work through this organically.

Nuance will one day be a way to work through huge piles of things, but I don’t think it’s ready yet.

You can try using a separate tag (“Project”) for this workload (need-review-by-team, and generate a view (query) that shows items assigned this tag but not any person. Then manually assign stuff from this list to team members - either in a big session (shift click and bulk edit might work), or have each member assign an item to themselves when they start working on it.

Hey,

Well at the moment I do have it so it go into a project automatically( We have tags in are svn commits ) but we need it so it automatically distributes work load to different people. I mean is there just a way to distribute code reviews to a one person at random. That would help allot.

Thanks
Benjamin Godfrey

I’ve done something like this in the past using the conduit api, You write a herald rule that triggers off of review creation, have that make a request to a CI system like Jenkins passing on the reviewid, then have that a script in jenkins that picks a random reviewer and assigns it to the review via conduit

Its not as complicated as it sounds, especially if you already have some of the moving parts like Jenkins

Hey,

Do you still have the script. Just so I can have a look?

Thanks
Benjamin Godfrey

Sorry I’m unable to share, but this is the gist of what you need to call

use conduit api calls starting with

api/user.query

to go from username of the reviewer to phid of the that user (officially you probably are supposed to use user.search)

You can do this one time, so you have a mapping from username to phid, user phids don’t change over time.

to look up a revision to check for current reviewers, I use api/differential.revision.search (e.g. for a review D12345) - note you need the reviewers attachment or you just get basic info on the review

This will return JSON that shows you the reviews and reviewers
you’ll need to get the revision PHID that comes back in the json

..
"phid": "PHID-DREV-bvd4zii7i3r3fhhelm4f",
...

Then use api/differential.revision.edit to set the reviewers, by passing the reviewers.add transaction type and a value of a list of users (using their PHIDs)

passing the revision PHID from above as the objectIdentifier

All the API calls, give you a nice example of how to do with this curl

image

You just need to get an API-TOKEN from your settings

Its that simple.

Hey,

Thank you so much for this info. It is a massive help. I have been bashing my head agents this for a while.

Thanks
Benjamin Godfrey