Search code examples
gitbitbucketconfluenceplantumlconfluence-macros

Display PlantUML in Confluence from BitBucket


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.


Solution

  • 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)