【发布时间】: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的方法了吗?
-
唯一可行的方法似乎是
sh和curl
标签: post jenkins groovy httprequest jenkins-pipeline