June 13, 2013

Hack the Hive with Perforce Swarm

Healthcare
Helix Swarm
Traceability

If you haven't seen already on TechCrunch and Develop, yesterday we released our new code collaboration platform Perforce Swarm. After working on Swarm for many months it's exciting to see the press covering it, but it's even more exciting to see you folks getting your hands on it to see what it can do. While our development team pauses to plan its future development work on Swarm and bask in the glow of the media coverage, I'd like to talk about your future development work on Swarm.

The Swarm backend is built on top of the Zend Framework 2, with a modern web front end powered by standards like Bootstrap and jQuery. Swarm ships with all the source included which means you can customize and extend it to fit your needs. It also has hooks for loading custom CSS and Javascript. As Boromir reminds us:

continuous delivery meme

While Swarm includes hooks for deploying code under review and for running automated tests on reviews, there is a good chance you are going to need more flexibility than that to fully integrate your continuous delivery pipeline into Swarm. Over the coming weeks the Swarm development team and I will post to this blog about the ways you can bend Swarm to your will.

To start off, let's look at how your other tools can create events in the Swarm activity feed. This could be useful for publishing data related to a project from multiple systems into a central activity feed.

Sometimes continuous delivery requires continuous takeout, so as a trivial example let's look at how to post the arrival of takeout to the activity feed.

curl --cookie-jar cjar --data 'user=ADMINUSER' --data 'password=ADMINPASS' http:// myswarm/login
curl -b cjar --data "type=food&user=Thai_food&action=has&target=arrived" http:// myswarm/activity/add

The first line logs into Swarm as a Perforce admin user to prevent unauthtorized users from posting to the activity feed. The second line takes the cookie generated from the first and posts the new activity to the "activity/add" endpoint. Shortly after executing curl the event will show up in the activity stream.

swarm activity

Activity can also be targeted to specific projects or users by specifying a "stream" parameter. For instance I could add the activity to just the Swarm project:

curl -b cjar --data "type=food&user=Thai_food&action=has&target=arrived&stream=project-swarm" http:// myswarm/activity/add

While this was a trivial example I'm sure you can imagine having your nightly regression tests reported to a project stream, or individual notifications published to user streams.

Swarm is available from our downloads page today! In the product help, you will find more information on how to mold and modify Swarm to your needs, and we have a very active Swarm forum where you can come to ask questions. We're looking forward to hearing about your experiences hacking Swarm.