Display PlantUML in Confluence from BitBucket

3k Views Asked by At

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.

2

There are 2 best solutions below

0
On BEST ANSWER

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)

0
On

I can recommend a plugin called Markdown, HTML, PlantUML, LaTeX, Diagrams, Open API, Mermaid by Modus Create to embed PlantUML diagrams in Confluence.

The plugin is about $0.50 per user per month on a cloud installation.

It is spawned by typing /Diagram on a confluence page. You can select "Remote URL" and enter the direct link to the source code of a PlantUML diagram hosted on Bitbucket or GitHub, and it is embedded in your confluence page.

It works as you would expect. The diagram is updated as the source changes.

The drawback: Every user that navigates to your confluence page must have a Bitbucket account, or have access to the source code of your diagram.

Insert new Diagram Macro

Diagram preview