Integrating PhpStorm With Rally

If you are required to tolerate use Rally for tracking stories in your iterations, you’ve been missing out on IDE integration - until now.

PhpStorm (and other IntelliJ-family IDEs, hereinafter referred to as “PhpStorm”) support the idea of a “Task server”. The IDE - when requested - will reach out to the task server and get a list of work items that you, as a developer, care about. When you use this functionality, the IDE will keep track of your workplace setup for you. For instance, if you have file 1, file 2, and file 3 open in the “PRJ123” task, and file 4, 5, and 6 open in the “PRJ456” task, the IDE will switch which files are open when you switch tasks, and ensure that the other parts of the IDE UI are exactly as you last used them while working on that task (down to things like Run configurations, scroll positions within a file, opened branches on the file browser, and what Git branch you have checked out).

You can find more information about how this functionality works and how to use it, see the Jetbrains KB article: Managing Tasks and Context

Why not use the Rally tasks plugin?

Rally has published an “official” IntelliJ plugin that’s included in the plugin list in the IDE (source is here). However, this plugin was created as part of an internal hackathon two years ago, and is not officially maintained for some reason (per their Q&A site).

This plugin was subsequently forked and maintained for some time by Sergiy Beley, but as of November 2015, his version of the plugin seems to be as maintained as the one that Rally released, and unfortunately, the IntelliJ plugin API has changed substantially since the plugin was released, and it simply no longer works. However, since PhpStorm 6, there’s an alternative way to handle this!

Generic task server

Jetbrains knows they can’t integrate with all of the issue tracker APIs that exist, so they’ve added a “Generic” task server type, which gives you the ability to configure a very basic integration with whatever task server you want. I previously wrote about configuring an integration with Drupal.org and haven’t used it since then until I found that I could use it for Rally integration.

Rally’s API is also relatively easy to work with in this context, especially because it allows you to use HTTP authentication for API requests (which is one of the authentication mechanisms supported by PhpStorm). This allows us to use the official Rally API and just pull out the data points that we care about.

Configuring

Note: This section is accurate as of PhpStorm 10. YMMV for older or newer versions.

The textual version of the instructions can be found below, or if you prefer, I’ve recorded a short screencast, which can be found here.

Open the PhpStorm preferences, and navigate to Tools -> Tasks -> Servers, and add a “Generic” task server.

General tab

SettingValue
Server URLhttps://rally1.rallydev.com
UsernameRally email address
PasswordRally password
Use HTTP authenticationChecked

Commit Message tab

No config needed.

Server Configuration tab

SettingValue
Tasks List URL{serverUrl}/slm/webservice/v2.0/hierarchicalrequirement?query=%28%28Owner.Name%20=%20{username}%29%20and%20%28AcceptedDate%20=%20null%29%29&order=Rank&fetch=true
Single Task URLEmpty
Response TypeJSON
Each task in separate requestNot checked

In the table of task variables, use these values:

SettingValue
tasksQueryResult.Results
idFormattedID
summaryName
descriptionDescription
updatedLastUpdateDate
createdCreationDate

Using

Once the “Test” button tells you that “Connection is successful”, you can follow the documentation provided in the Jetbrains KB article (Managing Tasks and Context ).

Caveats

Not knowing how the official Rally plugin once worked in PhpStorm, I can’t say for sure what functionality you miss out on, but here are the things that this integration definitely doesn’t do:

  • Opening an issue in a browser: This might be possible someday, but right now, the Rally API doesn’t output a link to the web UI for a given story. It does output a numeric ID that can be used to construct a URL, but the PhpStorm configuration screen doesn’t allow you to construct the issueUrl value based on data you’re pulling from the UI, so either Rally should start outputting a web link for stories, or Jetbrains should allow for string concatenation in the Server Configuration tab.
  • Filtering out closed/accepted stories: The task switcher in PhpStorm has a checkbox titled “Include closed tasks”. Unfortuantely, the Rally API doesn’t output a boolean for whether or not a given story is open/closed, so this feature doesn’t work. Alternatively, Jetbrains could allow for a null/not-null check to determine if a task is closed or not, which would allow you to use the story’s “AcceptedDate” attribute for checking the task status.
  • Modifying any Rally data: This is a 100% read-only integration. If you’re used to Mylyn in Eclipse, this will be pretty strange for you.

Future work

Personally, I’d really like to see Jetbrains throw out their custom task server implementation and adopt Mylyn. I’m not a huge fan of Eclipse, but I don’t think anyone can argue that Mylyn isn’t really really solid. By leveraging the efforts of the open source community, Jetbrains could easily add support for a ton of existing task providers without doing all the work themselves. This has the added bonus of making it easy for developers writing Mylyn connectors to immediately make their connectors available to a wide audience across multiple IDEs.

Alternatively, it is likely possible for someone to write a Mylyn/IntelliJ shim of some kind, that does basically the same thing.

Comments

comments powered by Disqus