詹金斯管道在 GenericDownloadExecutor.java 处给出莫名其妙的 NullPointerException:52
jenkins pipeline giving inexplicable NullPointerException at GenericDownloadExecutor.java: 52
我按照本页给出的示例从 JFrog artifactory 下载工件:
https://www.jfrog.com/confluence/display/JFROG/Scripted+Pipeline+Syntax#ScriptedPipelineSyntax-UploadingandDownloadingFiles
但我一直收到 NullPointerException。以下是脚本输出和错误:
[Pipeline] echo
download spec {
"files": [
{
"pattern": "aod-libs-release/path-to-artifact/deployment/DM-DP-V3A.24-RELEASE/deployment-DM-DP-V3A.24-RELEASE.zip",
"target": "./artifacts"
}, {
"pattern": "aod-libs-release/path-to-artifact/dm-auth-web-services/DM-AU-V3A.88-RELEASE/dm-auth-web-services-DM-AU-V3A.88-RELEASE.war",
"target": "./artifacts"
}
]
}
[Pipeline] echo
artifactory server org.jfrog.hudson.pipeline.common.types.ArtifactoryServer@66026154
[Pipeline] newBuildInfo
[Pipeline] artifactoryDownload
[Pipeline] End of Pipeline
java.lang.NullPointerException
at org.jfrog.hudson.pipeline.common.executors.GenericDownloadExecutor.execute(GenericDownloadExecutor.java:52)
at org.jfrog.hudson.pipeline.scripted.steps.DownloadStep$Execution.runStep(DownloadStep.java:67)
at org.jfrog.hudson.pipeline.scripted.steps.DownloadStep$Execution.runStep(DownloadStep.java:53)
at org.jfrog.hudson.pipeline.ArtifactorySynchronousNonBlockingStepExecution.run(ArtifactorySynchronousNonBlockingStepExecution.java:54)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start[=11=](SynchronousNonBlockingStepExecution.java:47)
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)
Finished: FAILURE
下面是我的詹金斯管道脚本
def artifactoryServer = Artifactory.server("Artifactory-instance-id")
artifactoryServer.connection.timeout = 300
def artifactDownloadSpec = """{
"files": [
{
"pattern": "aod-libs-release/path-to-artifact/deployment/${env.DP_VERSION}/deployment-${env.DP_VERSION}.zip",
"target": "./artifacts"
}, {
"pattern": "aod-libs-release/path-to-artifact/dm-auth-web-services/${env.VERSION}/dm-auth-web-services-${env.VERSION}.war",
"target": "./artifacts"
}
]
}"""
echo "download spec " + artifactDownloadSpec
echo "artifactory server " + artifactoryServer
artifactoryServer.download spec: artifactDownloadSpec
我在谷歌上搜索了 GenericDownloadExecutor.java 并找到了以下代码,但无法弄清楚我缺少第 52 行所需的内容。好像有一个字段没有设置。
请帮忙。提前谢谢你,祝你有美好的一天。
运行 artifactoryServer.download
步骤需要使用代理。
例如:
Jenkins 脚本管道
node {
...
artifactoryServer.download spec: artifactDownloadSpec
...
}
Jenkins 声明式管道
推荐的方法是使用rtDownload步骤,但是,如果您仍然想使用artifactoryServer.download
:
pipeline {
agent any // <- Make sure there is an active agent
stages {
stage('Example') {
steps {
script {
...
artifactoryServer.download spec: artifactDownloadSpec
...
}
}
}
}
}
阅读更多:
我按照本页给出的示例从 JFrog artifactory 下载工件: https://www.jfrog.com/confluence/display/JFROG/Scripted+Pipeline+Syntax#ScriptedPipelineSyntax-UploadingandDownloadingFiles
但我一直收到 NullPointerException。以下是脚本输出和错误:
[Pipeline] echo
download spec {
"files": [
{
"pattern": "aod-libs-release/path-to-artifact/deployment/DM-DP-V3A.24-RELEASE/deployment-DM-DP-V3A.24-RELEASE.zip",
"target": "./artifacts"
}, {
"pattern": "aod-libs-release/path-to-artifact/dm-auth-web-services/DM-AU-V3A.88-RELEASE/dm-auth-web-services-DM-AU-V3A.88-RELEASE.war",
"target": "./artifacts"
}
]
}
[Pipeline] echo
artifactory server org.jfrog.hudson.pipeline.common.types.ArtifactoryServer@66026154
[Pipeline] newBuildInfo
[Pipeline] artifactoryDownload
[Pipeline] End of Pipeline
java.lang.NullPointerException
at org.jfrog.hudson.pipeline.common.executors.GenericDownloadExecutor.execute(GenericDownloadExecutor.java:52)
at org.jfrog.hudson.pipeline.scripted.steps.DownloadStep$Execution.runStep(DownloadStep.java:67)
at org.jfrog.hudson.pipeline.scripted.steps.DownloadStep$Execution.runStep(DownloadStep.java:53)
at org.jfrog.hudson.pipeline.ArtifactorySynchronousNonBlockingStepExecution.run(ArtifactorySynchronousNonBlockingStepExecution.java:54)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start[=11=](SynchronousNonBlockingStepExecution.java:47)
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)
Finished: FAILURE
下面是我的詹金斯管道脚本
def artifactoryServer = Artifactory.server("Artifactory-instance-id")
artifactoryServer.connection.timeout = 300
def artifactDownloadSpec = """{
"files": [
{
"pattern": "aod-libs-release/path-to-artifact/deployment/${env.DP_VERSION}/deployment-${env.DP_VERSION}.zip",
"target": "./artifacts"
}, {
"pattern": "aod-libs-release/path-to-artifact/dm-auth-web-services/${env.VERSION}/dm-auth-web-services-${env.VERSION}.war",
"target": "./artifacts"
}
]
}"""
echo "download spec " + artifactDownloadSpec
echo "artifactory server " + artifactoryServer
artifactoryServer.download spec: artifactDownloadSpec
我在谷歌上搜索了 GenericDownloadExecutor.java 并找到了以下代码,但无法弄清楚我缺少第 52 行所需的内容。好像有一个字段没有设置。
请帮忙。提前谢谢你,祝你有美好的一天。
运行 artifactoryServer.download
步骤需要使用代理。
例如:
Jenkins 脚本管道
node {
...
artifactoryServer.download spec: artifactDownloadSpec
...
}
Jenkins 声明式管道
推荐的方法是使用rtDownload步骤,但是,如果您仍然想使用artifactoryServer.download
:
pipeline {
agent any // <- Make sure there is an active agent
stages {
stage('Example') {
steps {
script {
...
artifactoryServer.download spec: artifactDownloadSpec
...
}
}
}
}
}
阅读更多: