November 16, 2021 - Patrick Kerwood

Confluence Updater

If you like to keep your documentation in Git, love writing in markdown but are somehow required to deliver documentation in Confluence, look no further. With Confluence Updater you can build a CI/CD pipeline to render a markdown page to html on change and upload it to Confluence Cloud.

Confluence Updater is a tool I created in Rust because I had a requirement to deliver documentation in Confluence Cloud. I love writing in markdown, even this blog I do in markdown, and I'm a big fan of GitOps and the idea of using Git as a single source of truth.

In this blog post I will show the few easy steps to do exacly that. I will be using Azure DevOps (God forbid), but any CI/CD pipeline will do.

The first step is to create the actual pages in Confluence, in the location you want. Confluence Updater can only update an existing page. Write down the page ID, you will find it in the URL of the page.

In your repository, create a file named confluence-config.yaml with below content. Confluence Updater will read this file and .... well it's pretty self explanatory, have a look at it.

You will need to add an entry for each file you want to update.

  - filePath: './'
    title: My fancy documentation
    pageId: '<page-id>'
    contentType: page
      - ci/cd
  - filePath: './docs/'
    title: My fancy documentation
    pageId: '<page-id>'
    contentType: page
      - ci/cd

Next create a file named azure-pipelines.yml and add below yaml code to it. The logic is very simple, when ever a change is commited to or any file in the docs folder, the pipeline will run.

Change the version number in the curl command to fit the newest version.



name: Confluence Updater

      - master
      - docs/*

  vmImage: ubuntu-latest

  - bash: |
      curl -L -o confluence-updater
      chmod +x confluence-updater
      ./confluence-updater update -u $(CU_USER) -s $(CU_SECRET) --fqdn $(CU_FQDN)
    displayName: 'Update Confluence Page'

Commit the changes and push it to the repository. In Azure DevOps, press the Set up build button to create the new pipeline.

Confluence Updater needs some parameters to run. Add below variables to the pipeline by pressing the Variables button, remember to set CU_SECRET as a secret variable.

  • CU_USER - Your confluence user.
  • CU_SECRET - Your API token which you can generate here. (opens new window)
  • CU_FQDN - The FQDN to your Confluence Cloud instance eg.

Save your pipeline and run it.

# References

Found a bug? Help me improve this page!
Last Commit: