【问题标题】:How to upload a nexus artifact with the httpRequest Jenkins plugin如何使用 httpRequest Jenkins 插件上传 nexus 工件
【发布时间】:2017-05-11 10:59:55
【问题描述】:

有没有办法使用httpRequest Jenkins 插件上传一个关联工件。我确实尝试过上传:

String basicAuthString = "Basic " + "${user}:${password}".bytes.encodeBase64().toString()

String formBody = 'r=temp&g=org.codehaus.groovy&a=groovy-binary&v=2.3.7&p=zip&file=@groovy-binary.zip&hasPom=false'

def response = httpRequest contentType: 'APPLICATION_FORM', requestBody: formBody, consoleLogResponseBody: true, customHeaders: [[maskValue: false, name: 'Authorization', value: basicAuthString]], httpMode: 'POST', url: this.env.NEXUS_UPLOAD_URL

很遗憾,我收到以下错误

Response Code: HTTP/1.1 400 Bad Request
Response: 
<html><body><error>Deployment tried with both 'packaging' and/or 'extension' being empty! One of these values is mandatory!</error></body></html>`

我做错了什么?这个插件能用吗?

【问题讨论】:

  • 您可以使用 Nexus Artifact Uploader 插件将 maven 工件上传到 Nexus。
  • 你找到使用http的方法了吗?
  • 唯一可行的方法似乎是 shcurl

标签: post jenkins groovy httprequest jenkins-pipeline


【解决方案1】:

目前没有办法用这个插件上传它,因为 nexus 正在等待表单上传。当您上传带有其他输入的文件时,您需要使用

Content-Type: multipart/form-data.

在当前版本的 httpRequest 插件中没有这样的contentType

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-01-04
    • 2019-07-06
    • 1970-01-01
    • 1970-01-01
    • 2017-12-07
    • 2018-02-10
    • 2014-12-25
    • 2019-03-30
    相关资源
    最近更新 更多