用gitlab连接confluence并更新confluence页面

时间:2018-08-22 13:28:17

标签: gitlab pipeline confluence

我想知道是否有一种方法可以将gitlab与合流连接起来,并在每次将某些内容推送到Gitlab项目中时,通过管道合流进行更新。

1 个答案:

答案 0 :(得分:1)

您需要使用Atlassian Marketplace中的加载项,也可以使用Confluence REST API来开发自己的脚本。

Marketplace中可用的附加组件可以直接使用,但是您当然没有灵活性来更改它们。您自己的脚本具有灵活性的优势。

取决于要实现的目标,可以采用不同的方法,但是根据您提到的内容,如果要更新现有页面,则可以调用Confluence REST API来更新现有页面并进行所需的更改。例如,以下更新Confluence中的现有页面:

curl -u admin:admin -X PUT -H 'Content-Type: application/json' -d'{"id":"3604482","type":"page",
"title":"new page","space":{"key":"TST"},"body":{"storage":{"value":
"<p>This is the updated text for the new page</p>","representation":"storage"}},
"version":{"number":2}}' http://localhost:8080/confluence/rest/api/content/3604482 | python -mjso

请查看Atlassian Marketplace的附加组件,以及Confluence REST API Examples的更多详细信息。