我在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_?像什麼?同時顯示代碼 –
「對話很便宜,給我看代碼」 –