首页 > 解决方案 > 如何使用 httprequest 插件 jenkins 发送文件(zip)

问题描述

我需要将 zip 文件上传到 appDynamics,我需要使用我的 jenkins 管道中的 httpsrequest 插件

上传 appdynamics 请求

curl -v -H Content-Type:application/octet-stream --upload-file UISampleApp.app.dSYM.zip --user Example account:Example-License-Key-4e8ec2ae6cfe https://api.eum-appdynamics.com/v2/account/Example+account/ios-dsym 

我们现在正在使用 shell 执行上述请求,但我正在尝试找出如何使用httpsRequest 插件发送多个 zip 文件

标签: jenkinshttprequestjenkins-pipelineappdynamicsdsym

解决方案


以下代码对我有用:

def response =  httpRequest(acceptType: 'APPLICATION_JSON', contentType: 'APPLICATION_ZIP',
                   customHeaders  : [[name: "authorization" , value : "${authToken}"],[name: 'x-username' , value: 'admin']],
                   httpMode: 'POST', ignoreSslErrors: true, 
                   multipartName: '<fileName>', timeout: 900,
                   responseHandle: 'NONE', uploadFile: "<filePath>", 
                   url: "${url}")

推荐阅读