Swarm can be configured to provide generic notifications of committed changes in Helix Server, taking the role of a review daemonA review daemon is a program that periodically checks the Helix Server machine to determine if any changelists have been submitted. If so, the daemon sends an email message to users who have subscribed to any of the files included in those changelists, informing them of changes in files they are interested in..
Notifications configuration is expressed with a notifications
block in the SWARM_ROOT/data/config.php
file, similar to the following example:
<?php
// this block should be a peer of 'p4'
'notifications' => array(
'honor_p4_reviews' => false, // defaults to false
'opt_in_review_path' => '//depot/swarmReviews', // required if honor_p4_reviews is true; defaults to ''
'disable_change_emails' => false, // optional; defaults to false
),
If honor_p4_reviews
is set to true
, then opt_in_review_path
must be set to a path somewhere in the depot. This path does not need to point to an actual file that exists, but it must be accessible by all users who want to make use of this functionality. For example:
'notifications' => array(
'honor_p4_reviews' => true,
'opt_in_review_path' => '//depot/swarmReviews',
),
If these two values are set, then users can make use of the Perforce review functionality by subscribing to the opt_in_review_path
in their user spec. Any user subscribed to that file, will receive notifications for all the other paths they are subscribed to.
We recommend that opt_in_review_path
point to a file that does not exist. Ideally, it points to a file that no user is likely to want to create. It must however be in a valid depot.
For example, if a user has the following review paths set in their user spec:
$ p4 user -o asmith
User: asmith
Email: [email protected]
FullName: Alice Smith
Reviews:
//depot/swarmReviews
//depot/main/acme/...
//depot/main/orion/...
//depot/dev/asmith/...
The //depot/swarmReviews
means that this user is subscribed to the path set in opt_in_review_path
, and therefore will receive notifications. The rest of the subscription lines define which paths in the depot this user is interested in. Therefore this user will receive a notification for a change made to //depot/main/acme/foo.txt
, but not a change made to //depot/dev/acme/foo.txt
.
For example, to see which users are subscribed to receive notifications you can run p4 reviews <path>
against the opt_in_review_path
value:
$ p4 reviews //depot/swarmReviews
asmith <[email protected]> (Alice Smith)
bbrown <[email protected]> (Bob Brown)
erogers <[email protected]> (Eve Rogers)
To see which users are subscribed to files in a particular changelist, you can run p4 reviews -c <changelist>
. Swarm will notify the users who subscribe to both the review of this changelist and the review path, opt_in_review_path
.
true
, Swarm sends notification emails for every committed change to all users where the change matches one of their Reviews:
paths.opt_in_review_path: Optional item, required only if honor_p4_reviews
is set. This item specifies a special depot path, which typically would not exist in the Helix Server machine. When a path is specified, users must include this path (or a path that contains it) in the Reviews:
field of their user spec to cause Swarm to send the user a notification for every committed change that matches one of their Reviews:
paths.
For example, if the opt_in_review_path
is set to //depot/swarmReviews
, users can opt-in to Swarm review notifications by adding that path, or a path such as //depot/...
, to the Reviews:
field in their user spec.
true
, notifications for committed changes, based on the Reviews:
field and the users and projects you follow, are disabled. Notifications for reviews and comments will still be sent.If your Helix Server machine already has a review daemon in operation, users receive two notifications for Reviews:
paths. You may want to deprecate the review daemon in favor of Swarm's change notifications.
Groups have per-group notification settings. See Add a group for details.
There are many situations that can result in email notifications being sent out to users and groups. Whilst it is possible for a user and group owner to configure their own settings, it is also possible for the system owner to configure the defaults for all users and groups by modifying the settings in the config.php
.
Each notification consists of an Event
and a Role
. The Event
is what happened (for example, a new review was created, a file was submitted) and the Role
is the role of the user or group who could receive a notification. A user or group can belong to multiple roles, in which case if any of them are set to send a notification, then the user or group will receive a notification.
For example, when a review is voted on (review_vote
) , there are a number of roles of users, and groups that could be notified:
is_self
), the author of the review (is_author
), a user who is a moderator of the project branch the review is in (is_moderator
), and a user who is a reviewer of the review (is_reviewer
). is_moderator
), and members of a reviewer group for the review (is_reviewer
).By default, all notifications are enabled for all roles. The system-wide defaults can be changed by adding the following options into the notifications block of the SWARM_ROOT/data/config.php
. These options are in addition to those described above.
<?php
// this block should be a peer of 'p4'
'notifications' => array(
'review_new' => array(
'is_author' => 'Enabled',
'is_member' => 'Enabled',
),
'review_files' => array(
'is_self' => 'Enabled',
'is_author' => 'Enabled',
'is_reviewer' => 'Enabled',
'is_moderator' => 'Enabled',
),
'review_vote' => array(
'is_self' => 'Enabled',
'is_author' => 'Enabled',
'is_reviewer' => 'Enabled',
'is_moderator' => 'Enabled',
),
'review_required_vote' => array(
'is_self' => 'Enabled',
'is_author' => 'Enabled',
'is_reviewer' => 'Enabled',
'is_moderator' => 'Enabled',
),
'review_optional_vote' => array(
'is_self' => 'Enabled',
'is_author' => 'Enabled',
'is_reviewer' => 'Enabled',
'is_moderator' => 'Enabled',
),
'review_state' => array(
'is_self' => 'Disabled',
'is_author' => 'Enabled',
'is_reviewer' => 'Enabled',
'is_moderator' => 'Enabled',
),
'review_tests' => array(
'is_author' => 'Enabled',
'is_reviewer' => 'Enabled',
'is_moderator' => 'Enabled',
),
'review_changelist_commit' => array(
'is_author' => 'Enabled',
'is_reviewer' => 'Enabled',
'is_member' => 'Enabled',
'is_moderator' => 'Enabled',
),
'review_comment_new' => array(
'is_author' => 'Enabled',
'is_reviewer' => 'Enabled',
),
'review_comment_update' => array(
'is_author' => 'Enabled',
'is_reviewer' => 'Enabled',
),
'review_comment_liked' => array(
'is_commenter' => 'Enabled',
),
'review_opened_issue' => array(
'is_self' => 'Enabled',
'is_author' => 'Enabled',
'is_reviewer' => 'Enabled',
'is_moderator' => 'Enabled',
),
'review_join_leave' => array (
'is_self' => 'Enabled',
'is_author' => 'Enabled',
'is_reviewer' => 'Enabled',
'is_moderator' => 'Enabled',
),
)
Each setting can have one of four possible values to either enable or disable notifications of that type. If multiple settings apply to a given event, then a user will receive a notification if any of them are enabled.
Unless one of the forced options is used, system wide options can be overridden by individual users and group owners, who can configure which notifications they receive.
The various roles are as follows:
An event is the action that causes the notification: