-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[alerting] add mustache variable for Kibana's publicly exposed base URL #90525
[alerting] add mustache variable for Kibana's publicly exposed base URL #90525
Conversation
POC at the moment, just wanted to make sure we could do this. Here's the contents of the message param for Slack - the last three lines are added from the default, and make use of the new variable. The wrapping in
Here's how it renders in Slack - and it works! |
Additional note that being able to display "nice" links in Slack and email can't be done with a single message that would work in both. For email, you'd need to use So there's no way I know of to create a nice link like this with the Until that issue is resolved, alert implementors should probably just reference the url by itself if used in a
Both email and slack will render these as links, but the text will be the complete URL. |
2fd6f27
to
40d5cdf
Compare
resolves elastic#49392 Adds the top-level mustache variable `kibanaBaseUrl` for action parameter mustache templates. The value comes from Kibana config, which, if not set will result in this variable having the value `undefined`.
40d5cdf
to
f21c638
Compare
jenkins retest this please |
💚 Build SucceededMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
Pinging @elastic/kibana-alerting-services (Team:Alerting Services) |
@@ -161,6 +161,7 @@ export class AlertingPlugin { | |||
private eventLogService?: IEventLogService; | |||
private eventLogger?: IEventLogger; | |||
private readonly kibanaIndexConfig: Observable<{ kibana: { index: string } }>; | |||
private kibanaBaseUrl: string | undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new instance variable so we can capture the path in setup
and use it in start
@@ -39,6 +39,7 @@ export interface CreateExecutionHandlerOptions< | |||
actions: AlertAction[]; | |||
spaceId: string; | |||
apiKey: RawAlert['apiKey']; | |||
kibanaBaseUrl: string | undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there were a couple of paths of threading this new variable into the right place, this required the fewest number of changes
@@ -44,10 +44,18 @@ describe('transformActionVariables', () => { | |||
"description": "The alert action group that was used to scheduled actions for the alert.", | |||
"name": "alertActionGroup", | |||
}, | |||
Object { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I double-checked the variables we're making available, alertActionSubgroup
should have been here, but was not, so added it.
@@ -97,7 +98,7 @@ export function createTestConfig(name: string, options: CreateTestConfigOptions) | |||
...xPackApiIntegrationTestsConfig.get('kbnTestServer'), | |||
serverArgs: [ | |||
...xPackApiIntegrationTestsConfig.get('kbnTestServer.serverArgs'), | |||
'--server.publicBaseUrl=https://localhost:5601', | |||
...(options.publicBaseUrl ? ['--server.publicBaseUrl=https://localhost:5601'] : []), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed so security_and_spaces
runs WITH the configured url, but spaces_only
does not
@@ -0,0 +1,125 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a copy of the spaces_only
tests, but only included a test for the new action variable, since it's now different between the two
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…exposed base URL (elastic#90525) resolves elastic#49392 Adds the top-level mustache variable `kibanaBaseUrl` for action parameter mustache templates. The value comes from Kibana config, which, if not set will result in this variable having the value `undefined` which will be rendered as an empty string.
…exposed base URL (#90525) (#91563) resolves #49392 Adds the top-level mustache variable `kibanaBaseUrl` for action parameter mustache templates. The value comes from Kibana config, which, if not set will result in this variable having the value `undefined` which will be rendered as an empty string.
resolves #49392
Adds the top-level mustache variable
kibanaBaseUrl
for action parametermustache templates. The value comes from Kibana config, which, if not set
will result in this variable having the value
undefined
.Checklist
Delete any items that are not applicable to this PR.
Documentation was added for features that require explanation or tutorialsAny UI touched in this PR is usable by keyboard only (learn more about keyboard accessibility)Any UI touched in this PR does not create any new axe failures (run axe in browser: FF, Chrome)If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker listThis renders correctly on smaller devices using a responsive layout. (You can test this in your browser)This was checked for cross-browser compatibilityFor maintainers