Comment attachments

Swarm supports attaching arbitrary files to comments in code reviews and jobs.

Tip

If you make a configuration change, Swarm will not use it until the configuration cache has been reloaded, this forces Swarm to use the new configuration. You must be an admin or super user to reload the Swarm config cache. Navigate to the User id dropdown menu, select System Information, click the Cache Info tab, and click the Reload Configuration button.

Comment attachment storage

To store files attached to comments, Swarm looks for a depot named //.swarm. As Swarm does not create this depot, you need to create it, or specify another depot that the Swarm admin user can write to.

The depot used to store Swarm attachments must be:

  • a classic depot (stream, unload, archive, and spec depots are not supported)
  • a local depot (remote depots are not supported)
  • a depot that the Swarm admin user can write to but other users cannot access. For more information about permissions, see Authorizing access in the Helix Core Server Administrator Guide.
  • Tip

    It is best practice to use a depot directory that is not used to store any other files, this stops other users having access to the attachments stored in the depot. We recommend that you use //.swarm

Create a directory for the comment attachments

We recommend that you use //.swarm because it is best practice to use a depot directory that is not used to store any other files This prevents other users from having direct access to the comment attachments.

  1. To create a //.swarm depot, run the following as a user with admin-level privileges:
  2. $ p4 depot .swarm

  3. Ensure that the Swarm admin user can write to the //.swarm depot and make sure that other users cannot access it.
  4. For information on creating depots, see Working with depots in Helix Core Server Administrator Guide.

Specify the location for the comment attachments

By default Swarm looks for a depot named //.swarm, to specify a different depot path for comment attachments, use the depot_storage configuration block in the SWARM_ROOT/data/config.php file.

Replace depot_name with the depot where comment attachments are stored. The Swarm admin needs to be able to write to this depot but make sure that other users cannot access it:

<?php
    // this block should be a peer of 'p4'
    'depot_storage' => array(
        'base_path'  => '//depot_name',
    ),
Tip

The base_path can be more than just the depot name, for example //depot/perforce/.swarm would work.

Maximum comment attachment size

By default, the maximum file size of a single comment attachment is limited to:

  • Ubuntu: 8Mb

  • RHEL 8 and later: 2Mb

Increasing the maximum attachment file size

Your can increase the maximum attachment size if required.

Ubuntu

Edit the php_value upload_max_filesize and php_value post_max_size configurables in the .htaccess file.

RHEL 8 and later

Edit the upload_max_filesize and post_max_size configurables in the /etc/php.ini file.