[8.x] fix: kibana dev server not restarting for external plugin #171260 (#198246) (#201040)

# Backport

This will backport the following commits from `main` to `8.x`:
- [fix: kibana dev server not restarting for external plugin #171260
(#198246)](https://github.com/elastic/kibana/pull/198246)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Jordan
McAlpine","email":"128929391+mickalpine@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-11-20T20:24:58Z","message":"fix:
kibana dev server not restarting for external plugin #171260
(#198246)\n\n## Summary\r\n\r\nFixes #171260 the Kibana dev server not
restarting during external\r\nplugin development for server side
code.\r\n\r\n### Checklist\r\n\r\n\r\n### For maintainers\r\n\r\n- [ ]
This was checked for breaking API changes and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)\r\n-
[ ] This will appear in the **Release Notes** and follow
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n##
Release note\r\nFixes #171260 the Kibana dev server not restarting
during external\r\nplugin development for server side
code.\r\n\r\n---------\r\n\r\nCo-authored-by: Brad White
<Ikuni17@users.noreply.github.com>","sha":"83b282a63a3748a07a0d9e69f2cafa44b9439af7","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Operations","release_note:skip","💝community","v9.0.0","backport:prev-minor"],"title":"fix:
kibana dev server not restarting for external plugin
#171260","number":198246,"url":"https://github.com/elastic/kibana/pull/198246","mergeCommit":{"message":"fix:
kibana dev server not restarting for external plugin #171260
(#198246)\n\n## Summary\r\n\r\nFixes #171260 the Kibana dev server not
restarting during external\r\nplugin development for server side
code.\r\n\r\n### Checklist\r\n\r\n\r\n### For maintainers\r\n\r\n- [ ]
This was checked for breaking API changes and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)\r\n-
[ ] This will appear in the **Release Notes** and follow
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n##
Release note\r\nFixes #171260 the Kibana dev server not restarting
during external\r\nplugin development for server side
code.\r\n\r\n---------\r\n\r\nCo-authored-by: Brad White
<Ikuni17@users.noreply.github.com>","sha":"83b282a63a3748a07a0d9e69f2cafa44b9439af7"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198246","number":198246,"mergeCommit":{"message":"fix:
kibana dev server not restarting for external plugin #171260
(#198246)\n\n## Summary\r\n\r\nFixes #171260 the Kibana dev server not
restarting during external\r\nplugin development for server side
code.\r\n\r\n### Checklist\r\n\r\n\r\n### For maintainers\r\n\r\n- [ ]
This was checked for breaking API changes and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)\r\n-
[ ] This will appear in the **Release Notes** and follow
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n##
Release note\r\nFixes #171260 the Kibana dev server not restarting
during external\r\nplugin development for server side
code.\r\n\r\n---------\r\n\r\nCo-authored-by: Brad White
<Ikuni17@users.noreply.github.com>","sha":"83b282a63a3748a07a0d9e69f2cafa44b9439af7"}}]}]
BACKPORT-->

Co-authored-by: Jordan McAlpine <128929391+mickalpine@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2024-11-21 09:10:12 +11:00 committed by GitHub
parent fd6dc18b3a
commit 121d94ff08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -26,7 +26,8 @@ const packageMatcher = makeMatcher([
/**
* Any code that is outside of a package must match this in order to trigger a restart
*/
const nonPackageMatcher = makeMatcher(['config/**/*.yml']);
const nonPackageMatcher = makeMatcher(['config/**/*.yml', 'plugins/**/server/**/*']);
const staticFileMatcher = makeMatcher(['plugins/**/kibana.json']);
export interface Options {
enabled: boolean;
@ -87,6 +88,10 @@ export class Watcher {
if (result.type === 'non-package') {
return nonPackageMatcher(result.repoRel) && fire(result.repoRel);
}
if (result.type === 'static') {
return staticFileMatcher(result.repoRel) && fire(result.repoRel);
}
}
},
{