-
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
Remove core->cli dependency #95145
Remove core->cli dependency #95145
Conversation
⏳ Build in-progress, with failures
Failed CI StepsHistory
To update your PR or re-run it, just comment with: |
⏳ Build in-progress, with failures
Failed CI StepsHistory
To update your PR or re-run it, just comment with: |
describe('Timeouts', () => { | ||
let httpServer: HttpServer; | ||
let router: Router; | ||
|
||
beforeEach(() => { | ||
httpServer = new HttpServer(logger, 'foo'); | ||
const enhanceWithContext = (fn: (...args: any[]) => any) => fn.bind(null, {}); | ||
router = new Router('', logger.get(), enhanceWithContext); |
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.
Shouldn't it be placed in src/core/server/http/http_server.test.ts
? We can move the whole file into integration_tests
later
public basePathProxyTargetPort: number; | ||
|
||
constructor(rawConfig: DevConfigType) { | ||
this.basePathProxyTargetPort = rawConfig.basePathProxyTarget; |
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.
Do we really need a wrapper for a boolean flag?
pluginPaths: config.plugins.additionalPluginPaths, | ||
pluginScanDirs: config.plugins.pluginSearchPaths, |
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.
we can remove getPluginSearchPaths
usage in @kbn/optimizer
then?
}; | ||
const bootstrapScript = getBootstrapScript(cliArgs.dev); | ||
|
||
await bootstrapScript({ |
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.
@spalger What is the main reason we want dev_cli
controlling the Kibana server creation? It always confuses me when debugging the Kibana server with Chrome
...(ACTIVE_INSPECT_FLAG ? [`${ACTIVE_INSPECT_FLAG}=${process.debugPort + 1}`] : []), |
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.
The main reason is because the dev cli implements auto restart on changes and ensuring that we don't see failed requests while it's restarting, and so that there's a single command to run that sets that and the optimizer up.
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.
If you instead run node scripts/kibana
without --dev
, or instead of using yarn start
, you can run the server without the dev cli wrapper that makes dev a lot easier in most cases.
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
This reverts commit e46a74f
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: |
* extract http_tools to package * fix readme * start moving stuff * cleaning up `isDevCliParent` * choose bootstrap script * fix bootstrap script logic * fix watch paths logic * import REPO_ROOT from correct package * create the @kbn/crypto package * update core's `dev` config * only export bootstrap function * extract sslConfig to http-tools package * fix core types * fix optimizer tests * fix cli_dev_mode tests * fix basePath proxy tests * update generated doc * fix unit tests * create @kbn/dev-cli-mode package * remove useless comment * self-review NITS * update CODEOWNERS file * add devOnly flag * use variable for DEV_MODE_PATH * review comments * fix logger/log adapter * fix log calls in base path proxy server * address some review comments * rename @kbn/http-tools to @kbn/server-http-tools * more review comments * move test to correct file * add comment on getBootstrapScript * fix lint * lint * add cli-dev-mode to eslint dev packages * review comments * update yarn.lock * Revert "[ci] skip building ts refs when not necessary (elastic#95739)" This reverts commit e46a74f # Conflicts: # .github/CODEOWNERS
* extract http_tools to package * fix readme * start moving stuff * cleaning up `isDevCliParent` * choose bootstrap script * fix bootstrap script logic * fix watch paths logic * import REPO_ROOT from correct package * create the @kbn/crypto package * update core's `dev` config * only export bootstrap function * extract sslConfig to http-tools package * fix core types * fix optimizer tests * fix cli_dev_mode tests * fix basePath proxy tests * update generated doc * fix unit tests * create @kbn/dev-cli-mode package * remove useless comment * self-review NITS * update CODEOWNERS file * add devOnly flag * use variable for DEV_MODE_PATH * review comments * fix logger/log adapter * fix log calls in base path proxy server * address some review comments * rename @kbn/http-tools to @kbn/server-http-tools * more review comments * move test to correct file * add comment on getBootstrapScript * fix lint * lint * add cli-dev-mode to eslint dev packages * review comments * update yarn.lock * Revert "[ci] skip building ts refs when not necessary (#95739)" This reverts commit e46a74f # Conflicts: # .github/CODEOWNERS
Summary
Fix #76935
Remove the
core
->cli
circular dependency by having thesrc/cli/serve
script starting theCliDevMode
instead of delegating that job to a 'stub' core'sServer
instance. See #76935 (comment) for more details on the issue and the chosen approach.Unwiring and moving all the required parts to achieve that was a little tricky, but to summarize, I had to:
@kbn/http-tools
packageThe
BasePathProxyServer
was using some utility functions fromcore
(createServer
,getServerOptions
,getListenerOptions
and so on), that are also used by core'sHttpServer
. As we do want to keep that code factorized, in case we change our underlying http lib at some point, I created this package instead of just duplicating the code we wanted (which is just the correct practice, overall)@kbn/crypto
packageThis package contains what was previously in
src/core/server/utils/crypto
, as it was used by the code we extracted to@kbn/http-tools
. I could have just put the crypto utils inhttp-tools
, but as these utils were not exclusively used by http-related stuff, I thought it made more sense to have our own package. Note that I initially wanted to put that in@kbn/utils
, but some tests of thecrypto
extracted code relies on@kbn/dev-utils
, so that would have created a circulardev-utils
->utils
->dev-utils
dependency. I still think having our owncrypto
dedicated package make sense anyway.@kbn/dev-cli-mode
packageThis package contains what was previously under
src/dev/cli_dev_mode
. All this code is now self-contained into a package, making sure we'll not be adding unwanted dependencies tocore
later.Checklist