简体   繁体   English

从Jenkins Pipeline发布到Artifactory

[英]publishing to Artifactory from Jenkins Pipeline

I'm trying to publish to an Artifactory (v4.5.1) instance using a Jenkins(v2.7) pipeline. 我正在尝试使用Jenkins(v2.7)管道发布到Artifactory(v4.5.1)实例。 An excerpt from my script is below. 我脚本的摘录如下。 Problem seems to be that the "Artifactory" object is not recognized and is treated as a string. 问题似乎是“Artifactory”对象无法识别并被视为字符串。 Can someone suggest what the problem might be? 有人可以建议问题可能是什么?

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
}

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. 但是,正如上面的评论中所提到的,这可能是您的版本的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM