Page MenuHomePhabricator

Associating Diffusion commits to Projects
Closed, ResolvedPublic

Description

Currently, in order to get a commit from an externally hosted repository to appear in a project's activity feed, the commit message must include the project's hashtag. For object rule triggers for commits, it would be nice if Herald had an option under "Take these actions every time this rule matches" called something like "Associate to project" or "Add to project feed." The current "Add emails to CC" action is not quite right in the sense that it results in the commit showing that project's name as a Subscriber, but that is all. The project does not show up under "Projects" and if you go to the project's activity feed, then you do not see the commit there.

For extra credit, it would be good to include under "When all of these conditions are met" an option to specify the branch on which the commit appears. That would allow associating multiple projects to the same repository based on the branch. For example, a maintenance project for stable updates on a separate branch from new development which might be on the master branch.

Event Timeline

robertos raised the priority of this task from to Needs Triage.
robertos updated the task description. (Show Details)
robertos added a project: Herald.
robertos added a subscriber: robertos.

https://secure.phabricator.com/book/phabcontrib/article/feature_requests/ covers a bit more in detail about what we're looking for in feature requests. Specifically, just tell us the problem you are having with Phabricator and we can look to generalize a correct solution.

Let me take another crack at a concise problem statement:

Herald (and/or Diffusion and/or Projects) does not give me the ability to automatically associate every commit in a particular repository on a particular branch to a particular Phabricator project.

You want to specify projects based on Repository and Branch?

I suppose what he's trying to achieve is to see all commits related to a project in the projects feed. (we spoke in irc)
And in some cases this might be all commits made to a specific branch.

That is correct. Right now, only commits which Ref or Close a Maniphest task associated with the project or which include the project's hashtag appear in the project feed.

chad renamed this task from Herald rules for associating Diffusion commits to Projects to Associating Diffusion commits to Projects.Jan 15 2015, 4:37 PM
chad edited projects, added Diffusion, Projects; removed Herald.

Herald generally doesn't seem like the right solution, that is Herald is "watch for danger!!!!". I think there are tasks floating around to improve project feeds but I'll have to dig around.

Herald (and/or Diffusion and/or Projects) does not give me the ability to automatically associate every commit in a particular repository on a particular branch to a particular Phabricator project.

This isn't really describing the problem you're facing -- it's still describing your desired solution.

Can you step back like 5 levels and describe what problem you have, without using any Phabricator terminology like "Projects", "Herald", etc?

For example, "my boss instituted a policy where every commit which contains the word 'duck' must be reviewed by a special Duck team" is a problem description. The solution to that might be expanding the capabilities of Herald, but there might be other solutions to the problem. When we know what the root problem you're facing is, we can suggest these alternate solutions. When you just rephrase your desired solution, we can't.

I suppose what he's trying to achieve is to see all commits related to a project in the projects feed. (we spoke in irc)

Oh, I missed this, but I still don't really understand the problem here. For example, you can see all commits on a branch in Diffusion:

https://secure.phabricator.com/diffusion/P/history/master/

What's the root problem which makes this a poor solution? Does feed give you more information (maybe improving the history view is a solution)? Does the project span multiple branches (maybe querying commits by containing branch is a solution)? Do you to see a mixture of commits and other information (maybe using "Ref/Fixes" is a solution, if tasks with strong organization already exist in the system)?

I would assume a 'Feed' of activity for a Project should include anything associated, so in https://secure.phabricator.com/project/feed/40/ I only see Maniphest Tasks, not (also) commits to repositories associated to #phacility

(I also thought there was an existing task for this, but I haven't been able to find it).

You'd see commits associated with #phacility explicitly, and changes to repositories associated with #phacilty, but commits do not currently automatically inherit the projects of their repository.

Correct. If I specify a project hashtag, then a commit shows in the
project's feed. I'd like all commits for a given repository and branch
to be automatically associated to the project such that if I view the
commit in Diffusion that the project is listed under Projects and so
that if I view the project the commits appear in that project's feed
automatically.

You'd see commits associated with #phacility explicitly, and changes to repositories associated with #phacilty, but commits do not currently automatically inherit the projects of their repository.

Right, that's my understanding as well. For me, being able to go to the #phacility feed and understand everything that happened yesterday or anyday, is useful. My expectation as a user is a project feed is the main activity feed filtered just on that project, not just explicit things.

Right, that's my understanding as well. For me, being able to go to the #phacility feed and understand everything that happened yesterday or anyday, is useful. My expectation as a user is a project feed is the main activity feed filtered just on that project, not just explicit things.

Sure. We could change this, but currently we never auto-inherit projects. For example:

  • revisions don't auto-inherit repository projects;
  • Phriction pages don't auto-inherit parent projects;
  • blocked tasks don't auto-inherit projects of blockers;
  • revisions and mocks don't auto-inherit task projects;
  • Almanac devices don't auto-inherit service projects.

In all these cases, I think the rule is correct. I'm inclined to think it's the correct rule for Diffusion, too -- although changing the rule would be fine for #phacility on this instance, I don't think a repository project tag necessarily applies to all commits.

For example, at Facebook, you might reasonably want to tag all the repositories with any memcache code with #memcache, so a search by that project would show all of the relevant repositories (memcached, mcproxy, and so on). Since www/ has memcache client code, you'd tag it, but then the #memcache feed would immediately be destroyed by a huge volume of unrelated commits.

In this task, too, it sounds like only the commits from a specific branch are relevant to a given project.

Another use case is using "Object Rules" in herald with a tag-project like #apply-herald-security-review-rules, which triggers specific audit rules. While it's true in some sense that all commits in a repository tagged like this are affected by the ruleset, it's not useful to auto-inherit the project (broadly, the project isn't organizing related work).

I think the object herald rule would be reasonable. I can also imagine a use-case like the 'cowboy commits' rule on this install, bur where i don't wanna go as far as triggering an audit for every commit. Or grouping commits to project by the files touched for example.
Using project inheritance from the repo automatically would probably be wrong in a lot of cases.

Sure. We could change this, but currently we never auto-inherit projects. For example:

  • revisions don't auto-inherit repository projects;
  • Phriction pages don't auto-inherit parent projects;
  • blocked tasks don't auto-inherit projects of blockers;
  • revisions and mocks don't auto-inherit task projects;
  • Almanac devices don't auto-inherit service projects.

In all these cases, I think the rule is correct. I'm inclined to think it's the correct rule for Diffusion, too -- although changing the rule would be fine for #phacility on this instance, I don't think a repository project tag necessarily applies to all commits.

Currently, I have my projects/repositories associated in a one-to-one
relationship. However, I would like to be able to possibly have a
many-to-many relationship, which would make the most sense to me on a
branch level.

Another use case is using "Object Rules" in herald with a tag-project like #apply-herald-security-review-rules, which triggers specific audit rules. While it's true in some sense that all commits in a repository tagged like this are affected by the ruleset, it's not useful to auto-inherit the project (broadly, the project isn't organizing related work).

I don't understand what you are saying here. Is this currently possible?

epriestley claimed this task.

Global "Commit" rules in Herald can now add or remove projects, so you could write a rule like this:

Screen_Shot_2015-04-23_at_3.41.06_PM.png (522×893 px, 64 KB)

Thanks for implementing this! I will definitely make use of this feature.

Hello, we used this function (add project to a commit by Herald rule) as well happily for about two years (last update of phabricator was 03/16/2016). The current phabricator update (06/06/2017) now lead to messages in the activity feed in the form of "Herald added a project to rXXXXX: <message>: <project>" and the commit itself (or better the message) does not appear anymore. When we disable the Herald rule the commit-messages appear in the feed again as before and expected.

Is there a way to disable the Herald messages in the feed or a different way of adding projects to commits? (i did search the net unsuccessfully)

I am not sure, if this is a bug or a feature request so i just added the comment here. Thanks in advance!