1

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

马文目标:

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 项目中创建发布分支
  • 已发布版本号的神器已推送到https://oss.sonatype.org/
  • 本地开发分支已更新为下一个开发版本

但是没有任何提交被推送到 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"
4

1 回答 1

0

插件的快照版本 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 的分支保护配置上删除“包括管理员”标志。

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

于 2018-02-11T15:48:16.557 回答