Плагин JFrog Jenkins Artifactory. Задача сборки gradle с подмодулями 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', но это не сработало.