I'm trying to publish to an Artifactory (v4.5.1) instance using a Jenkins(v2.7) pipeline. An excerpt from my script is below. Problem seems to be that the "Artifactory" object is not recognized and is treated as a string. Can someone suggest what the problem might be?
我正在尝试使用Jenkins(v2.7)管道发布到Artifactory(v4.5.1)实例。我的剧本摘录如下。问题似乎是“Artifactory”对象无法识别并被视为字符串。有人可以建议问题是什么吗?
node {
//error - "Artifactory" treated as String
def server = Artifactory.server SERVER_ID
def uploadSpec = """{
"files": [
{
"pattern": "hello-pipeline/build/libs/*.jar",
"target": "jenkins-local"
}
]
}"""
def buildInfo1 = server.upload spec: uploadSpec
}
1 个解决方案
#1
0
I've had success with the syntax:
我在语法上取得了成功:
node {
def server = Artifactory.server SERVER_ID
def uploadSpec = """{
"files": [{
"pattern": "hello-pipeline/build/libs/*.jar",
"target": "jenkins-local"
}
]
}"""
server.upload(uploadSpec)
}
as was suggested on another question. However, this could be an issue with your version, as mention in the the comment above.
正如另一个问题所建议的那样。但是,正如上面的评论中所提到的,这可能是您的版本的问题。
#1
0
I've had success with the syntax:
我在语法上取得了成功:
node {
def server = Artifactory.server SERVER_ID
def uploadSpec = """{
"files": [{
"pattern": "hello-pipeline/build/libs/*.jar",
"target": "jenkins-local"
}
]
}"""
server.upload(uploadSpec)
}
as was suggested on another question. However, this could be an issue with your version, as mention in the the comment above.
正如另一个问题所建议的那样。但是,正如上面的评论中所提到的,这可能是您的版本的问题。