[ 
https://issues.apache.org/jira/browse/SCM-854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16731106#comment-16731106
 ] 

Michael Osipov commented on SCM-854:
------------------------------------

PRs welcome!

> jgit tag failure is not failing the build
> -----------------------------------------
>
>                 Key: SCM-854
>                 URL: https://issues.apache.org/jira/browse/SCM-854
>             Project: Maven SCM
>          Issue Type: Bug
>          Components: maven-scm-provider-jgit
>    Affects Versions: 1.9.5
>            Reporter: Paul Vonnahme
>            Priority: Major
>             Fix For: waiting-for-feedback
>
>
> If the 'scm:tag' command fails, I would also expect the build to fail.  This 
> usually happens, however, we've come across a scenario where the tag fails 
> but the build still shows as "BUILD SUCCESS".  This happens when the tag is 
> rejected by a pre-receive hook.  Here is an example of the output:
> {noformat}
> [INFO] Change the default 'git' provider implementation to 'jgit'.
> [INFO] Final Tag Name: 'deleteme7'
> [INFO] push tag [deleteme7] to remote...
> [INFO] fetch url: https://XXXXXXXX:******@XXXXXXXXXX.git/
> [INFO] push url: https://XXXXXXXX:******@XXXXXXXXXX.git/
> [INFO] REJECTED_OTHER_REASON - 
> RemoteRefUpdate[remoteName=refs/tags/deleteme7, REJECTED_OTHER_REASON, 
> (null)...472c8c7f05c45d55ea8e945dd66efd71f381f703, fastForward, 
> srcRef=refs/tags/deleteme7, message="pre-receive hook declined"]
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Reactor Summary:
> [INFO]
> [INFO] XXXXXXXXXXXParent .......................... SUCCESS [ 24.294 s]
> [INFO] XXXXXXXXXXXWeb ............................. SKIPPED
> [INFO] XXXXXXXXXXXEAR ............................. SKIPPED
> [INFO] XXXXXXXXXXXTest ............................ SKIPPED
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time: 28.922 s
> [INFO] Finished at: 2017-11-28T12:57:24-06:00
> [INFO] Final Memory: 26M/380M
> [INFO] 
> ------------------------------------------------------------------------
> {noformat}
> I haven't cloned any code, but using the online viewer, it looks like what 
> needs to happen is in the JGitUtility, the push needs to check the status, 
> rather than just logging it:
> https://github.com/apache/maven-scm/blob/4c13db8164691aca57ab6279c550e339e7639ae4/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/JGitUtils.java#L195
> A status of 'OK' is good, but if one or more of the others is found, I 
> believe an exception should be thrown? 
> http://download.eclipse.org/jgit/docs/jgit-2.3.1.201302201838-r/apidocs/org/eclipse/jgit/transport/RemoteRefUpdate.Status.html
> If we want to limit the change, and not throw a new exception from JGitUtils, 
> further checking of the push result could happen here: 
> https://github.com/apache/maven-scm/blob/4c13db8164691aca57ab6279c550e339e7639ae4/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/tag/JGitTagCommand.java#L93



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to