jgitflow-maven-plugin 和 GitHub 问题

jgitflow-maven-plugin and GitHub Issue

我的 Jenkins 发布作业使用 jgitflow-maven-plugin 在 GitHub 上发布了一个开源项目,虽然它曾经可以工作,但抛出了一个异常。

Maven 目标:

jgitflow:release-start -e -X -Dhttps.protocols=TLSv1.2

jgitflow:release-finish -e -X -Dgpg.useagent=false -Dhttps.protocols=TLSv1.2

异常:

[DEBUG] (develop) committing all poms on branch 'develop'
[DEBUG] (develop) adding file pattern for poms commit: pom.xml

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.763 s
[INFO] Finished at: 2018-02-11T12:31:56+01:00
[INFO] Final Memory: 28M/492M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal external.atlassian.jgitflow:jgitflow-maven-plugin:1.0-m5.1:release-finish (default-cli) on project my-project: Execution default-cli of goal external.atlassian.jgitflow:jgitflow-maven-plugin:1.0-m5.1:release-finish failed. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal external.atlassian.jgitflow:jgitflow-maven-plugin:1.0-m5.1:release-finish (default-cli) on project my-project: Execution default-cli of goal external.atlassian.jgitflow:jgitflow-maven-plugin:1.0-m5.1:release-finish failed.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal external.atlassian.jgitflow:jgitflow-maven-plugin:1.0-m5.1:release-finish failed.
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    ... 20 more
Caused by: java.lang.NullPointerException
    at com.atlassian.jgitflow.core.command.AbstractGitFlowCommand.failedResult(AbstractGitFlowCommand.java:133)
    at com.atlassian.jgitflow.core.command.AbstractGitFlowCommand.doPushIfNeeded(AbstractGitFlowCommand.java:104)
    at com.atlassian.jgitflow.core.command.ReleaseFinishCommand.call(ReleaseFinishCommand.java:148)
    at com.atlassian.maven.plugins.jgitflow.manager.DefaultFlowReleaseManager.finish(DefaultFlowReleaseManager.java:99)
    at com.atlassian.maven.plugins.jgitflow.mojo.ReleaseFinishMojo.execute(ReleaseFinishMojo.java:174)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    ... 21 more

有效的方法:

但是没有提交被推送到 GitHub。远程发布分支也没有任何新的提交。

Caused by: java.lang.NullPointerException
at com.atlassian.jgitflow.core.command.AbstractGitFlowCommand.failedResult(AbstractGitFlowCommand.java:133)
at com.atlassian.jgitflow.core.command.AbstractGitFlowCommand.doPushIfNeeded(AbstractGitFlowCommand.java:104)

在我看来,当插件想要推送提交时出了点问题,但是错误消息由于 failedResult 中的 NullPointerException 而丢失了!?

有谁知道 GitHub 基础架构的哪些更改可能会导致此问题?

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: /opt/maven
Java version: 1.8.0_161, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-112-generic", arch: "amd64", family: "unix"

插件的快照版本1.0.0-SNAPSHOT提供了更好的错误信息:

Caused by: com.atlassian.jgitflow.core.exception.JGitFlowGitAPIException: error pushing to develop - status: REJECTED_OTHER_REASON - error: GH006: Protected branch update failed for refs/heads/develop.
error: At least one approved review is required by reviewers with write access.

        at com.atlassian.jgitflow.core.command.AbstractGitFlowCommand.doPushIfNeeded(AbstractGitFlowCommand.java:107)

我必须删除 GitHub 中分支保护配置上的 "Include administrators" 标志。

我提交了一个问题来使这个版本可用:https://ecosystem.atlassian.net/browse/MJF-298