Freitag, 25. Oktober 2013

Maven Release Plugin

For some days i have done some updates of my CI environment and i was surprised that my maven release plugin was not working correctly anymore.

After long search in different mailing list and forums i find something that was close to my problem. My problem was that the maven-release-plugin was not committing the correct tag it was still committing *-SNAPSHOT in the "prepare" goal. Because of this in the "performe" goals it was checking the wright tag but this was having *-SNAPSHOT in the pom.xml and that's the "performe" goals was allways trying to deploy a SNAPSHOT to my nexus release repository.

 During my search i also came across this bug MRELEASE-812 "prepare" does not commit before tagging and therefore deploys snapshot instead of release which is from my understanding exactly my problem.

The solution i found it  in some mailing list of the mave-relese-plugin and unfortunatly I haven't bookmark the link so I can remember  now. Lesson learned for next time ;)

Fortunately i was able to reproduce the error because i have commit the change directly in my git repo. The solution was to add the dependencies for the maven-release-pluing

              <dependencies>
        <dependency>
           <groupId>org.apache.maven.scm</groupId>
           <artifactId>maven-scm-api</artifactId>
           <version>1.8.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.scm</groupId>
            <artifactId>maven-scm-provider-gitexe</artifactId>
            <version>1.8.1</version>
        </dependency>
     </dependencies>


On my system I have git in the version 1.8.2.1 In order to know which version of the maven-scm-api are aviable have a look on maven-repos or directly on scms-overview

You can test it on your own with the test configuration which i have upload on github Before testing on your site you will need to change the property of mypath to a value which exist on your system. It should be an absolute path to where you have cloned the project.
Then commit the pom and just run 

mvn release:prepare -B  release:perform

Depending on what is the configuration of your   maven-release-plugin with the dependencies specified or not it should work or not.

Sonntag, 22. September 2013

Jenkins Gerrit Trigger and Gerrit 2.7

Yesterday I just update my Gerrit server from version 2.6* to 2.7.
One of the risen why i update was a bug when i was trying to view commits of other users in the side by side diff. The bug is also known and you can watch it evolve  under the issue 1893 Multiple errors, when trying to review differences. In the new version 2.7 the issue is fixed, at list in my environment it was not reproducible. More about the  release notes you can find in the ReleaseNotes/ReleaseNotes-2.7.html.
Everything was good until i have pushed my first commit under the new version. Since on my Jenkis instance i use Gerrit Trigger plugin, i was expecting that gerrit will trigger  Jenkis to check the new patch that was just submitted. This is how it worked with the old version of Jenkins. About how you set up the  Gerrit Trigger plugin see the set up information on the plugin site.
On my configuration i have a jenkins_ci user registered on gerrit. jekins_ci is a member of the Non-Interactive Users group and was created using create-account.

When i sow that gerrit is not trigger jenkins anymore first thing was to make a short debug and inspect the log files. For my surprise i sow that bouth services, gerrit and jenkins, are polluting their log files with something like

[2013-09-20 13:57:16,146] WARN  org.apache.sshd.server.session.ServerSession : Exception caught
java.io.IOException: Connection reset by peer....



in the  geerrit error_log file and

22.09.2013 11:48:00 com.sonyericsson.hudson.plugins.gerrit.gerritevents.GerritHandler run
INFO: Ready to receive data from Gerrit
22.09.2013 11:48:01 com.sonyericsson.hudson.plugins.gerrit.gerritevents.GerritHandler run
INFO: Ready to receive data from Gerrit
22.09.2013 11:48:01 com.sonyericsson.hudson.plugins.gerrit.gerritevents.GerritHandler run
INFO: Ready to receive data from Gerrit
22.09.2013 11:48:01 com.sonyericsson.hudson.plugins.gerrit.gerritevents.GerritHandler run
INFO: Ready to receive data from Gerrit

in jenkins log file. Jenkis was also showing an err on the manage site:

After spending some time searching for the problem i found the solution somewhere on the project mailing list. Unfortunately  i forgot to bookmark the site and that motivate my to start my blog and share with you this solution. The answer is that the non-interactive users group should have access to Stream Events. You can do this  over
Projects -> List -> All Projects -> Access

Now you can edit the Global Capabilities  and add permission Stream Events:



That's all folks! :)