Skip to content
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

[Env] Add buildFlavor to package info #161930

Merged
merged 8 commits into from
Jul 20, 2023

Conversation

pgayvallet
Copy link
Contributor

@pgayvallet pgayvallet commented Jul 14, 2023

Summary

Add a buildFavor property to Env (accessible from the plugin's initializer context), Mimicking the idea of ES's version.buildFlavor field.

Note: this is not supposed to be a replacement for feature flags, but can be useful when wanting to toggle features based on actual capabilities of our serverless product. Also, we already expose this value through the configuration via the serverless context value, so it now adds another way to access the information.

@pgayvallet pgayvallet added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc release_note:skip Skip the PR/issue when compiling release notes v8.10.0 labels Jul 14, 2023
@pgayvallet pgayvallet marked this pull request as ready for review July 14, 2023 13:26
@pgayvallet pgayvallet requested review from a team as code owners July 14, 2023 13:26
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

Copy link
Contributor Author

@pgayvallet pgayvallet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self-review

@@ -15,6 +15,7 @@ export interface PackageInfo {
buildNum: number;
buildSha: string;
buildDate: Date;
buildFlavor: BuildFlavor;
Copy link
Contributor Author

@pgayvallet pgayvallet Jul 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The actual change. Everything else is just adapting the test usages.

@@ -26,3 +27,5 @@ export interface EnvironmentMode {
dev: boolean;
prod: boolean;
}

export type BuildFlavor = 'serverless' | 'traditional';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with traditional for the "unflavored" version, but I can go with something else if we have a better idea.

Copy link
Contributor

@dokmic dokmic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@pgayvallet
Copy link
Contributor Author

@elasticmachine merge upstream

@pgayvallet pgayvallet enabled auto-merge (squash) July 20, 2023 09:26
@pgayvallet pgayvallet merged commit ab486af into elastic:main Jul 20, 2023
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/config 45 46 +1

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
@kbn/config 9 10 +1
Unknown metric groups

API count

id before after diff
@kbn/config 74 75 +1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jul 20, 2023
ThomThomson pushed a commit to ThomThomson/kibana that referenced this pull request Aug 1, 2023
## Summary

Add a `buildFavor` property to `Env` (accessible from the plugin's
initializer context), Mimicking the idea of ES's `version.buildFlavor`
field.

Note: this is not supposed to be a replacement for feature flags, but
can be useful when wanting to toggle features based on actual
capabilities of our serverless product. Also, we already expose this
value through the configuration via the `serverless` context value, so
it now adds another way to access the information.

---------

Co-authored-by: Kibana Machine <[email protected]>
azasypkin added a commit that referenced this pull request Aug 23, 2023
Closes #161337

## Summary

Uses build flavor(see #161930) to disable specific Kibana security,
spaces, and encrypted saved objects HTTP API routes in serverless (see
details in #161337). HTTP APIs that will be public in serverless have
been handled in #162523.

**IMPORTANT: This PR leaves login, user, and role routes enabled. The
primary reason for this is due to several testing mechanisms that rely
on basic authentication and custom roles (UI, Cypress). These tests will
be modified to use SAML authentication and serverless roles in the
immediate future. Once this occurs, we will disable these routes.**

### Testing
This PR also implements testing API access in serverless.
- The testing strategy for disabled routes in serverless is to verify a
`404 not found `response.
- The testing strategy for internal access routes in serverless is to
verify that without the internal request header
(`x-elastic-internal-origin`), a `400 bad request response` is received,
then verify that with the internal request header, a `200 ok response`
is received.
- The strategy for public routes in serverless is to verify a `200 ok`
or `203 redirect` is received.

~~blocked by #161930~~
~~blocked by #162149 for test implementation~~

---------

Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Aleh Zasypkin <[email protected]>
Co-authored-by: Aleh Zasypkin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v8.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants