-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Allow using the --serverless CLI flag in serverless-capable distros
#155009
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
Conversation
|
Pinging @elastic/kibana-core (Team:Core) |
|
Pinging @elastic/kibana-operations (Team:Operations) |
jloleysens
left a comment
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.
Did not test locally, but these changes LGTM! Great work @afharo
src/cli/serve/serve.js
Outdated
| const path = resolve(getConfigDirectory(), name); | ||
| if (configFileExists(name)) { | ||
| configs[method](path); | ||
| } |
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.
nit:
| const path = resolve(getConfigDirectory(), name); | |
| if (configFileExists(name)) { | |
| configs[method](path); | |
| } | |
| if (configFileExists(name)) { | |
| const path = resolve(getConfigDirectory(), name); | |
| configs[method](path); | |
| } |
or remove path variable entirely.
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.
Good one! I applied your suggestion!
| * @param {string[]} configs | ||
| * @param {'push' | 'unshift'} method | ||
| */ | ||
| function maybeAddConfig(name, configs, method) { |
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.
nitnit: I know this is a pre-existing function, but I don't find the API very readable
// we "unshift" .serverless. config so that it only overrides defaults
if (serverlessMode) {
maybeAddConfig(`serverless.yml`, configs, 'push');
maybeAddConfig(`serverless.${serverlessMode}.yml`, configs, 'unshift');
}IMO something like this would be clearer:
if (serverlessMode) {
configs.push(resolveConfig(`serverless.yml`));
// we "unshift" .serverless. config so that it only overrides defaults
configs.unshift(resolveConfig(`serverless.${serverlessMode}.yml`));
}
...
configs = configs.filter(Boolean);where resolveConfig: (config: string) => undefined | string
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.
++ It looks much cleaner your way!
I've created #155137 to tackle it as an entity change on its own. I'll address it as soon as this one is merged
💚 Build Succeeded
Metrics [docs]Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @afharo |
Summary
At the moment, we only allow using the
--serverlessCLI flag in dev mode. However, we want to use it in our serverless deployments. According to #149878, it is a valid option (apparently, there are no big reasons for it to be dev-only).For maintainers