JFrog Jenkins Artifactory插件。使用git子模块构建问题gradle

时间:2019-05-28 07:11:10

标签: artifactory

JFrog Jenkins Artifactory插件。使用git子模块构建问题。

你好!

使用插件与gradle配合使用时出现问题。 https://www.jfrog.com/confluence/display/RTF/Working+With+Pipeline+Jobs+in+Jenkins#WorkingWithPipelineJobsinJenkins-GradleBuildswithArtifactory.1

如果我使用简单的git存储库,那么就没有问题。

node(nodeName) {

  def rtGradle = Artifactory.newGradleBuild()
  def buildInfo

  stage('checkout') {
    checkout([$class                           : 'GitSCM',
              branches                         : [[name: gitBranch]],
              doGenerateSubmoduleConfigurations: false,
              extensions                       : [],
              submoduleCfg                     : [],
              userRemoteConfigs                : [[credentialsId: gitCredentials, url: gitBORepo]]])
  }

  stage('wiki_gradle') {
    rtGradle.tool = "gradle2.5"
    def gradleTask = 'cleanComplete'

    buildInfo = rtGradle.run rootDir: 'delivery', buildFile: 'build.gradle', tasks: gradleTask
  }
}

但是,如果使用相同的代码进行较小的更改,则在使用存储库子模块时,会发生错误。

node(nodeName) {

  def rtGradle = Artifactory.newGradleBuild()
  def buildInfo

  stage('checkout') {
    checkout([$class                           : 'GitSCM',
              branches                         : [[name: gitBranch]],
              doGenerateSubmoduleConfigurations: false,
              extensions                       : [],
              submoduleCfg                     : [],
              userRemoteConfigs                : [[credentialsId: gitCredentials, url: gitBORepo]]])
    sh 'git submodule init && git submodule update --remote'

  }

  stage('wiki_gradle') {
    rtGradle.tool = "gradle2.5"
    def gradleTask = 'cleanComplete'

    buildInfo = rtGradle.run rootDir: 'bo/delivery', buildFile: 'build.gradle', tasks: gradleTask
  }
}

错误:

java.lang.NullPointerException
    at org.jfrog.hudson.pipeline.Utils$1.invoke(Utils.java:140)
    at org.jfrog.hudson.pipeline.Utils$1.invoke(Utils.java:136)
    at hudson.FilePath.act(FilePath.java:1077)
    at hudson.FilePath.act(FilePath.java:1060)
    at org.jfrog.hudson.pipeline.Utils.extractVcsRevision(Utils.java:136)
    at org.jfrog.hudson.pipeline.Utils.extractVcsRevision(Utils.java:144)
    at org.jfrog.hudson.pipeline.steps.ArtifactoryGradleBuild$Execution.run(ArtifactoryGradleBuild.java:111)
    at org.jfrog.hudson.pipeline.steps.ArtifactoryGradleBuild$Execution.run(ArtifactoryGradleBuild.java:80)
    at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
    at hudson.security.ACL.impersonate(ACL.java:290)
    at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

我尝试使用dir(bo),env.WORKSPACE = env.WORKSPACE +'/ bo'修复它,但没有用。

0 个答案:

没有答案