我在jenkins上遇到问题。我做一个HTTP请求,这回我一个JSON文件是这样的:Jenkins:从json文件中检索变量并在
httpRequest authentication: 'b689fe3c-117e-4076-b10d-fe16ab14742f', httpMode: 'POST', outputFile: 'merge.json', responseHandle: 'NONE', url:'http://address:port/prweb/api/v1/branches/TestB/merge'
{ "ID": "SYSTEM-QUEUE-MERGE 50304628545400035CA951969013040610A435733ECEAE8",
"pxObjClass": "Pega-API-CI-Branch",
"statusValue": "OK"
}
我想要的ID,以在其他HTTP请求中使用:
http://address:port/prweb/api/v1/merges/{$ID}
我试图抓住的Id是这样的: ID = $(cat merge.json | grep -o SY。* [az](所有json文件都是一样的)
我尝试在sh管道中捕获ID,但他不工作,所以我尝试如果有人有解决方案,这将是我的伟大! 我继续搜索,我会编辑,如果我suceed
编辑:我管代码:
pipeline{
agent any
stages{
stage ('Merge Branch') {
steps{
httpRequest authentication: 'b689fe3c-117e-4076-b10d-fe16ab14742f', httpMode: 'POST', outputFile: 'merge.json', responseHandle: 'NONE', url: 'http://address:port/prweb/api/v1/branches/TestB/merge'
httpRequest authentication: 'b689fe3c-117e-4076-b10d-fe16ab14742f', httpMode: 'GET', outputFile: 'merge3.json', responseHandle: 'NONE', url: 'http://address:port/prweb/api/v1/merges/'
}
}
}
}
_like THIS_?像什么?同时显示代码 –
“对话很便宜,给我看代码” –