[RHCLOUD-22813] Handle provided context.host_url in integration templates #3221
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Jira issue
https://issues.redhat.com/browse/RHCLOUD-22813
Description
Currently, URLs in PagerDuty and Camel notifications are constructed by the PagerDutyTransformer, or one of three Qute templates, respectively. Each one has a slightly different way of handling URLs, and the Camel templates are not the ones currently shown in this repo.
This PR creates a new class,
InsightsUrlsBuilder
, which provides consistent construction of the two URLs for all integrations:data.inventory_url
represents a link to the specific host, cluster, or inventory item in the Console that generated the message. Ifdata.context.host_url
is provided, it will be used here.data.application_url
links back to the application that generated the event.The PR will also make it easy to modify the URL format in a followup issue.
Database migration
A new migration file (
V1.109.0
) has been added. It takes the current templates used in the Notifications database, and updates them to use the new URLs.Note
One change has been made to the existing format: Camel messages no longer contain a leading
\n
. This caused unexpected failures while testing the Slack processor, and weirdly did not fail with the Teams processor when it should have.Testing
CamelProcessorTest
implementers to use the new URLs in their Qute templatesdata.context.host_url
will always be used if presentExample
Using the following trimmed output from
BaseTransformer
:And the new Microsoft Teams template:
We generate this message: