How to automatically add HTML content to Confluence

In our CD pipeline which we have implemented using JIRA and Bamboo, we have an "automatic release notes generator" that generates the release notes for us in the working directory of the build on the bamboo server. We are looking to integrate this with Confluence.

Our requirement is to update these auto generated release notes in our Confluence instance automatically. The key here is that the content that is auto generated is in HTML format.

We are not sure what is the best solution to get this HTML content into Confluence. Please help!

3 answers

1 accepted

You can use CLI task from Run CLI Actions in Bamboo to run the storePage action from Confluence CLI to create the page. If the data is HTML, I would recommend you wrap the HTML content in the html macro on your Confluence installation. Here is an example of the action you would use. The page content is constructed from the content parameter followed by the file contents followed by the value of the content2 parameter:

--action storePage --space XXX --title "My page title" --file page.html --content "{html}" --content2 "{html}"

Bob: Thanks for responding.

Your CLI certainly looks very promising and we definitely want to consider it for purchase. 

In the above example I notice that you are passing "page.html" as one argument. But what if my HTML content is not merely one page. And there are other artifacts involved such as PNGs, javascript, etc. See below for example. Any help on how that can be handled ?

Sample documentation HTML.jpg

You might want to just "serve" those pages directly using Confluence's Tomcat and simply put a single page in Confluence (perhaps the index???) in order to make it appear to be in Confluence and once they click on link it will just serve the regular HTML page. This would more easily retain the formatting of the generated stuff especially if it is more complex. I have done that with java doc like material in the (distant) past.

Thats an interesting idea. Let me try it out.

 

Hi Bob. Which of these should I use?

 

image2016-1-21 13:45:31.png

Confluence Command Line Interface is what you need for your use case. It installs on your Confluence server and then you install a client - either the Confluence specific client or the more general Atlassian CLI client that includes all the other clients. There is no charge for clients, just the server piece is licensed.

Just to clarify - the HTML content is not merely an HTML page, but includes stylesheets, PNGs, and angular JS

0 vote
Steven Behnke Community Champion Jan 20, 2016

If you're attempting to display full HTML documents in Confluence, you may want to display pages in confluence that are rendering your documents – https://confluence.atlassian.com/doc/html-include-macro-169120653.html

You could use Bob Swifts CLI to programmatically create the pages as well.

Steven

Thanks for responding.

I tried to use the HTML include macro. And the HTML page was not rendered fully. Only some text from the top showed up. So not sure how to proceed. 

Also - the HTML page that can be included - does it always have to sit behind a web server.

For example - if I have an HTML page that goes like this – http://1.2.3.4:8999/ops-util/devop2.html

and I use that in the HTML include macro

this is what I get "Error rendering macro 'html-include' : null"

 

Steven Behnke Community Champion Jan 21, 2016

Interesting. I've used it to display hosted pages, so I've never run into this issue like this.

If you'd still like to display content in a page, I'd probably instead create an iframe user macro and then load the content in to the iframe. That's really the effect you're trying to achieve anyway.

Seems like Bob's got a good handle on the basics of your question, the question of how to display other web content in Confluence is interesting. Again, an iframe is the effect you're looking for seemingly, is this something you could persue? Are you on Cloud or hosted? Are you an administrator?

Yes. One of my responsibilities is to take care of all our DevOps tools and processes and related requirements. So in a way, I am an admin. Let me do some research on iframes as well. (We are on our own cloud by the way)

Steven Behnke Community Champion Jan 21, 2016

Well sure, you could use the HTML Include macro so you have access to Usermacros, duh.

You could enter the iframe into the HTML macro, like so – 

<iframe src="http://www.atlassian.com/" noborder="0" width="830" height="800" scrolling="yes" seamless></iframe>

 

A usermacro would further simplify this.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Confluence

Three common content challenges + how to manage them

An efficient enterprise content management system, or ECM, is a must-have for companies that create work online (cough   cough, all companies). If content calendars, marketing plans, and bu...

98 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you