我已经写了一个Jenkins Pipeline,但它在以下步骤中失败了:
script {
attachments="<a href='https://xxxxx.xxxxx.net/wiki/pages/viewpageattachments.action?pageId=${idValue}'>ATTACHMENTS</a>"
echo '=========================URL===================' + attachments
echo '{"id":"'${idValue}'","type":"page","title":"'${releaseVersion}'","space":{"key":"~xxxxxx"},"body":{"storage":{"value":"'${attachments}'","representation":"storage"}},"version":{"number":"2"}}' > update1.json
//content = sh(script: "curl -u 'xxxxxxx@xxxxxx.xxx:xxxxxxxx' -X PUT -H 'Content-Type: application/json' -d '@update1.json' https://xxxxxx.xxxxxx.xxxxx/wiki/rest/api/content/${idValue}", returnStdout: true)
//rm update1.json
}
它会给出以下错误
WorkflowScript: 37: expecting '}', found '","representation":"storage"}},"version":{"number":"2"}}' @ line 37, column 164.
2021-11-02 18:40:23.964 age":{"value":"'${attachments}'","repres
发布于 2021-11-03 02:49:54
尝试这样做:
def my_json = """
{
"id":"${idValue}",
"type":"page",
"title":"${releaseVersion}",
"space": {
"key":"~xxxxxx"
},
"body":{
"storage":{
"value":"${attachments}",
"representation":"storage"
}
},
"version":{
"number":"2"
}
}
"""
echo "${my_json}" > update1.json
https://stackoverflow.com/questions/69817774
复制相似问题