This plugin makes it possible to view Confluence assets alongside related entities in the service catalog, such as in this screenshot:
This is a Cortex plugin. To see how to run the plugin inside of Cortex, see our docs.
Your Confluence instance URL should look like https://something.atlassian.net. We will use this URL in the plugin's proxy and in the plugin's configuration entity.
- If you are using username and password authentication, type them in to a text editor with a colon (
:) between them. If you are using SSO, use an API token in place of the password. To create an API token in Confluence, follow the instructions provided by Atlassian. - Once you have your text in your text editor like
myusername@example.com:MySecretPassWordOrToken, you need to base64 encode it. You can do this using an online tool like this. - You will add the base64 encoded value to Cortex as a secret. Copy the base64 encoded value. In Cortex, click on Settings > Secrets > Add secret. In Secret name, type
confluence_secret, paste the base64 encoded secret into Secret value, and click on Create secret.
After you've saved the secret, we will set up a proxy to use that secret to communicate with Confluence.
- In Cortex, click on Plugins > Proxies > Create Proxy.
- In Name, type
Confluence Proxy. - Click on Add URL, and put in your Confluence Instance URL, like
https://something.atlassian.net. Click Save. - Next, click on "Add header to https://something.atlassian.net". In the dialog box that appears, type
Authorizationin the Name field, and in the Value field, typeBasic {{{secrets.confluence_secret}}}. Make sure you include the three curly braces, and make sure the secret name matches the secret you created above, withsecrets.in front of it. Click Save, then click on the Create Proxy button.
- Create or edit your Confluence Plugin.
- In the Plugin Context section, find the dropdown under the Associated Proxy heading, choose the Confluence proxy you created above.
- At the bottom of Plugin Context section, click on "Add another context" and add the
entity typesyou want to display your plugin. (eg.service) - Next, click Save plugin at the bottom of the page.
- Consider creating a new entity type, so that any existing scorecards are not affected by ths configuration entity. In this example, we have created a new entity type called
plugin-configuration - Create a new entity with the tag
confluence-plugin-config - Set
x-cortex-definition.confluence-urlto the value of your Confluence Instance URL. For example, if my Confluence Instance URL washttps://martindstone.service-now.com, myconfluence-plugin-configentity would look like this:
openapi: 3.0.1
info:
title: Confluence Plugin Config
description: ""
x-cortex-tag: confluence-plugin-config
x-cortex-type: plugin-configuration
x-cortex-definition:
confluence-url: https://martindstone.service-now.com
To associate confluence pages with entities you will require id for each page in which you can find by following the instructions on here.
Entities can be associated with Confluence Page IDs in two ways:
- If there is only one confluence page, adding a PageID tag to the
x-cortex-confluenceobject will be ok. In the Entity yaml for the entity to the Page ID that you'd like to view inside of Cortex, such as:
x-cortex-confluence:
pageID: "123456"
- If there are multiple confluence pages, adding pages under
x-cortex-confluenceand then underpagesyou can enter multipleids andtitles as well to describe the corresponding confluence page. Entity yaml should look like this:
x-cortex-confluence:
pages:
- id: "327681"
title: Page Title 1
- id: "65718"
title: Page Title 2
- id: "1179675"
title: ""
- id: "1277954"
The id field is mandatory but title filed is optional for each page.
You can do this for Custom Entities, as well as any Service entity.
Now when you load the Confluence plugin on an entity, you should see the contents of associated pages in Cortex!
- Run
yarnto download all dependencies - Run
yarn buildto compile the plugin code into./dist/ui.html - Upload
ui.htmlinto Cortex on a create or edit plugin page
