Saturday 26 November 2011

From a pull request to a jira issue

After the generate a patch and attach it to a jira issue, it's now the time to have a tool to create an issue from a patch request (the current implementation works only for github pull request).

So the Patch Tracker plugin has now a new goal called to-issue. This goal will read a github pull request and create an issue in your issue tracker (currently only supported for jira).

It's simple :-).
As sample see pull request : https://github.com/jenkinsci/jenkins/pull/320 and the created issue in jira: https://issues.jenkins-ci.org/browse/JENKINS-11883
I have just used the cli:

mvn patch-tracker:to-issue -Dpatch.request.id=320 -B

For easy configuration see the properties in the jenkins pom.

<project.patchManagement.system>github</project.patchManagement.system>
<patch.request.organisation>jenkinsci</patch.request.organisation>
<patch.request.repository>jenkins</patch.request.repository>
<project.patchManagement.url>https://api.github.com</project.patchManagement.url>

<patch.tracker.serverId>jenkins-jira</patch.tracker.serverId>


entry in settings:

<server>
<id>jenkins-jira</id>
<username>uid</username>
<password>password</password>
</server>


And that's it :-).

BTW if you need more features, patch (or pull requests) are welcome.

This maven plugin is in the maven sandbox @asf and not released, so if you want to try it you must have asf maven snapshot repo in your settings or buid it manually.
Sources are here:

  • https://github.com/apache/maven-sandbox (path plugins/maven-patch-tracker-plugin) yup no sparse checkout with git :P

  • http://svn.apache.org/repos/asf/maven/sandbox/trunk/plugins/maven-patch-tracker-plugin/



Some docs has been started here http://maven.apache.org/plugins/maven-patch-tracker-plugin (maybe not yet in sync so wait a bit)

Have fun !

Monday 21 November 2011

Life is too short to waste time uploading a patch or Maven Patch Tracker plugin

Life is too short and you don't want to waste time contributing to a project (creating a patch, a entry in the jira issue tracker then upload the patch).
So the Maven Patch Tracker plugin is for you !



You will be able with a maven plugin to do all of this in one command line !
Without any configuration you have to write :

mvn patch-tracker:create
-Dpatch.summary="foo summary"
-Dpatch.serverUrl=http://localhost:8080/browse/MNG -B
-Dpatch.user=uid -Dpatch.password=pwd


If you find that boring or too long no problem, there is a solution for that (yes good developer are lasy developers they use tool to automate tasks :-) ).
So configure you pom, with the issue tracker id

<issueManagement>
<system>jira</system>
<url>http://host:ip/browse/projectKey</url>
</issueManagement>


Add a server entry in you settings.xml


<server>
<id>jira-maven</id>
<username>olamy</username>
<password>very complicated password for paranoiac security folks</password>
</server>


Reference this jira server in your pom:


<properties>
....
<patch.tracker.serverId>jira-maven</patch.tracker.serverId>
....
</properties>


Et voilĂ , just run and save fingers:

mvn patch-tracker:create -Dpatch.summary="foo summary" -B


NOTE: without -B the plugin will use a prompt mode to ask you confirmation on the values

An other mojo called update can add/update an issue with an other patch:

mvn patch-tracker:update -Dpatch.description="update of the issue with an other patch" -Dpatch.patchId=MNG-5203 -B

This command will update the issue MNG-5203 with an other patch.

NOTE: currently only jira is supported

The plugin will use the configured scm client configured tru your scm url to generate the patch/diff file.
So your project is configured with svn but for some reasons you use git svn.
No problem add the parameter: -Dscm.providerType=git

Other improvement I think: load the patch to review board.

Something else ?
Ideas and patches are welcome :-)

You can test it using the snapshot repo: https://repository.apache.org/content/groups/snapshots-group/ or build it yourself: http://svn.apache.org/repos/asf/maven/sandbox/trunk/plugins/maven-patch-tracker-plugin/

Have Fun and good hacking!