Nord, James | 3 Nov 21:35 2011

RE: maven-release plugin issues with gerrit

That too - but the issue
"Caused by: org.apache.maven.scm.ScmException: Detecting the current branch failed: fatal: ref HEAD
is not a symbolic ref"
Seems like the detached head scenario.

The workaround in https://issues.jenkins-ci.org/browse/JENKINS-5856
   This is working if I use the m2 extra steps plugin and the following config

  Git
  "Merge before build" origin, master

  And m2 extra steps (pre-build)
  git checkout master || git checkout -b master
  git reset --hard origin/master

is working for me with gerrit.

/James

-----Original Message-----
From: jenkinsci-users <at> googlegroups.com [mailto:jenkinsci-users <at> googlegroups.com] On Behalf Of
Jay Keshur
Sent: 03 November 2011 16:46
To: jenkinsci-users <at> googlegroups.com
Subject: RE: maven-release plugin issues with gerrit

Hi,

You could allow the Jenkins commit/push user "Push branch +3: Force Push Branch; Delete Branch"  access
rights in Gerrit.

Regards,

Jay Keshur

-----Original Message-----
From: jenkinsci-users <at> googlegroups.com [mailto:jenkinsci-users <at> googlegroups.com] On Behalf Of andy_w
Sent: 03 November 2011 16:30
To: Jenkins Users
Subject: maven-release plugin issues with gerrit

Hi,

I'm trying to setup and understand an end-to-end git-gerrit-jenkins maven scenario.

What I've created so far is:

- developers checkout sources from git
- developers commit and push to gerrit
- jenkins triggers ci builds and deploy snapshots to nexus
- developers make additional reviews in gerrit and submit changes

Now I'm stuck at the release process:

- I wanted to take advantage of the maven release plugin and more specific the jenkins maven release plugin,
so that a developer can trigger the release with a jenkins job which also deployes the release to the nexus repository.
- Now I assume: because any change goes through gerrit code review and the release plugin has to push its pom
changes also through gerrit

So in my pom I define the corresponding developerConnection for
gerrit:
        <scm>
                <url>http://git.foobar.corp/SANDBOX/andreas/foobar.git</url>
                <connection>scm:git:git://git.foobar.corp/SANDBOX/andreas/
foobar.git</connection>
                <developerConnection>scm:git:ssh://git.foobar.corp:29418/SANDBOX/
andreas/foobar.git</developerConnection>
        </scm>

Now when triggering a release job in jenkins, maven is unable to checkin the updated poms.

<snip>
Caused by: org.apache.maven.shared.release.ReleaseExecutionException:
An error is occurred in the checkin process: Exception while executing SCM command.
        at
org.apache.maven.shared.release.phase.ScmCommitPhase.checkin(ScmCommitPhase.java:
128)
        at
org.apache.maven.shared.release.phase.ScmCommitPhase.execute(ScmCommitPhase.java:
109)
        at
org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:
203)
        at
org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:
140)
        at
org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:
103)
        at
org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:
211)
        ... 30 more
Caused by: org.apache.maven.scm.ScmException: Exception while executing SCM command.
        at
org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:
63)
        at
org.apache.maven.scm.provider.git.AbstractGitScmProvider.executeCommand(AbstractGitScmProvider.java:
289)
        at
org.apache.maven.scm.provider.git.AbstractGitScmProvider.checkin(AbstractGitScmProvider.java:
215)
        at
org.apache.maven.scm.provider.AbstractScmProvider.checkIn(AbstractScmProvider.java:
354)
        at
org.apache.maven.shared.release.phase.ScmCommitPhase.checkin(ScmCommitPhase.java:
124)
        ... 35 more
Caused by: org.apache.maven.scm.ScmException: Detecting the current branch failed: fatal: ref HEAD is
not a symbolic ref

        at
org.apache.maven.scm.provider.git.gitexe.command.branch.GitBranchCommand.getCurrentBranch(GitBranchCommand.java:
144)
        at
org.apache.maven.scm.provider.git.gitexe.command.checkin.GitCheckInCommand.createPushCommandLine(GitCheckInCommand.java:
185)
        at
org.apache.maven.scm.provider.git.gitexe.command.checkin.GitCheckInCommand.executeCheckInCommand(GitCheckInCommand.java:
125)
        at
org.apache.maven.scm.command.checkin.AbstractCheckInCommand.executeCommand(AbstractCheckInCommand.java:
53)
        at
org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:
59)
        ... 39 more
channel stopped
<snap>

Is there maybe another (better) release strategy than pushing the release change through gerrit.

I think from the gerrit point of view, its not a good practice to make changes directly in gerrits upstream.
What do you think?

Thanks in advance.
Andy

This message contains confidential and proprietary information of the sender, and is intended only for
the person(s) to whom it is addressed. Any use, distribution, copying, disclosure or taking of any action
in reliance upon it by any other person is strictly prohibited. If you have received this message in error,
please notify the e-mail sender immediately, and delete the original message without making a copy.

The Monitise group comprises: Monitise plc (Reg. No. 6011822), Monitise Group Limited (Reg. No.
5590897), Monitise International Limited (Reg. No. 5556711) and Monitise Europe Limited (Reg. No.
4831976). These companies are registered in England and Wales and their registered office address is:
Warnford Court, 29 Throgmorton Street, London, EC2N 2AT United Kingdom.

**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in
error, please immediately notify the postmaster <at> nds.com and delete it from your system as well as any
copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security
purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company
registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************


Gmane