5

Confluence supports displaying PlantUML diagrams using for example PlantUML for Confluence macro. Basically, one copy-pastes a source code of the UML diagram and it's correctly rendered in a page.

Macro usage and render:

Question:

My goal is to keep the diagrams up to date with the current version of code. Is there a way to import the source code of the diagram from a repository into Confluence and display the diagram (let's say from the master branch)?


Since BitBucket and Confluence are products of Atlassian and probably work well together, I am looking for such integration. If there is a way to get a source code from GitHub/GitLab displayed, I'd appreciate the answer even more. However, a solution working with BitBucket - Confluence - PlantUML would be more than sufficient.

Nikolas Charalambidis
  • 40,893
  • 16
  • 117
  • 183
  • Look into Atlassian's API : you must be able to edit pages in a wiki through API calls. This means you can write a script, which can be invoked through webhooks when someone pushes to your repo (from bitbucket/github/gitlab/...), and which updates the wiki page in confluence. – LeGEC Nov 30 '20 at 16:11
  • @LeGEC: I am not sure whether us, developers, have rights to perform such actions on Confluence. Moreover, I feel it's an overkill. Isn't there an easier way to go? However, you might want to formulate an answer. – Nikolas Charalambidis Dec 04 '20 at 09:26
  • 1
    You could try to combine two macros: The PlantUML macro that you mentioned, and - instead of writing PlantUML code by yourself - nesting a bitbucket macro inside of it. See https://mibexsoftware.atlassian.net/wiki/spaces/INCLUDE/pages/1703945/Usage#Usage-stashincludebyfilepath This is untested – I cannot test it by myself right now – but probably worth a try. :-) – observer Dec 14 '20 at 14:35
  • @observer: It look interesting and might work. I try to get the company Confluence owners to install the plugin and give it a try. – Nikolas Charalambidis Dec 17 '20 at 11:49

1 Answers1

1

I am not an Atlassian user, so I have litlle actual experience with their tools.

There probably is a way to reference some document in a bitbucket repo from a wiki page, scan the documentation (or ask support) to confirm that.

Other possibilities :

  • The wiki behind your Confluence subscription is probably a git repo itself.
    For example, this Atlassian support page explains how to clone a wiki hosted on bitbucket cloud (my guess is your wiki can probably be accessed that way).

    You would have to check how to set up access rights to push to that repo, but updating the repo would then be a matter of using known commands : git fetch & update, edit files, git add & commit & push

  • You can also look into API calls : if you can update wiki pages through an API, you can similarly set up a job that updates specific wiki pages after polling any source you can think of.

Additionally: instead of having the script poll the sources, you may find a way to register hooks on the sources trigger the script's execution when needed (through webhooks for example)

LeGEC
  • 46,477
  • 5
  • 57
  • 104