我试图从jenkins写入融合,但我有一些问题要么得到一个特定的解决scheme工作(configuration?插件错误?),或有问题find适当的信息来实现。
样品最终结果:
潜在的解决scheme1 – Confluence Publisher插件
(下面的代码块不会显示,除非上面的列表和代码块之间的东西… serverfault格式错误?)
AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: com.atlassian.confluence.rpc.AuthenticationFailedException: Attempt to log in user '[email protected]' failed. The maximum number of failed login attempts has been reached. Please log into the web application through the web interface to reset the number of failed login attempts. faultActor: faultNode: faultDetail: {}com.atlassian.confluence.rpc.AuthenticationFailedException:null {http://xml.apache.org/axis/}hostname:redacted.atlassian.net com.atlassian.confluence.rpc.AuthenticationFailedException: Attempt to log in user '[email protected]' failed. The maximum number of failed login attempts has been reached. Please log into the web application through the web interface to reset the number of failed login attempts.
潜在的解决scheme2 – 将Jenkins发布到任意主机,并从汇合中使用iframemacros
潜在的解决scheme3 – 我发现我可以直接使用REST API。 我们面临的挑战是确保curl调用是完全格式化的(json + html内容)
潜在的解决schemeN – 我错过了什么?
我结束了去REST API路线,使用jqparsing传入的JSON
首先获取页面ID:
pageID=$(curl -u $Confluence_UserID:$Confluence_Password -X GET \ "https://redacted.atlassian.net/wiki/rest/api/content?title=$PageTitle&spaceKey=$Space" \ | jq -r .results[].id \ )
然后获取版本(版本号必须提供并增加或更新呼叫失败!)
pageVersion=$(curl -u $Confluence_UserID:$Confluence_Password \ "https://redacted.atlassian.net/wiki/rest/api/content/$pageID?expand=version" \ | jq .version.number \ ) ((pageVersion++))
在jenkins工作之前,它将汇合页面的HTML生成到工作区中的一个文件中。 加载以下使用
htmlOutput=$(<myHTMLSnippet.txt)
最后一部分,发送页面更新
curl -u $Confluence_UserID:$Confluence_Password \ -X PUT -H 'Content-Type: application/json' \ https://redacted.atlassian.net/wiki/rest/api/content/$pageID \ --data @- <<END; { "id": "$pageID", "type": "page", "title": "$PageTitle", "space": { "key": "$Space" }, "body": { "storage": { "value": "$htmlOutput", "representation": "storage" } }, "version": { "number": $pageVersion, "minorEdit": true } } END