-
Notifications
You must be signed in to change notification settings - Fork 667
Add a Plugins readme stub #2391
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
|
@rhrazdil @mareklibra @vojtechszocs @suomiy @rawagner please review. |
|
/test e2e-aws-console-olm |
5ad400d to
92d955c
Compare
|
/test e2e-aws-console-olm |
2 similar comments
|
/test e2e-aws-console-olm |
|
/test e2e-aws-console-olm |
pcbailey
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.
This is great, Kobi! Thanks for getting this started! =)
I just have some suggestions regarding word choice and a few grammatical and typographical fixes.
PLUGINS.md
Outdated
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.
'Plugins packages' -> 'Plugin packages'
PLUGINS.md
Outdated
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 think this would work nicely as a bulleted list. You could put the naming convention note in parentheses next to the plugin entry file item.
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.
Please call them "plugin entry modules" since they are effectively ECMAscript modules.
Having package.json and OWNERS files is mandatory.
Every plugin should follow the recommended file structure:
srcdirectoryintegration-testsdirectory (if needed)- plugin entry module at
src/plugin.ts src/componentsfor React components,src/modelsfor k8s model definitions- unit tests co-located at
/path/to/unit/__tests__/unit.spec.ts
In addition, every plugin should typically provide (at least) these two extensions:
ModelDefinition- add new k8s model definitionsFeatureFlag/Model(in future alsoFeatureFlag/Action) - add new feature flag
and use the newly added feature flags (possibly together with core Console flags) to gate its extensions.
PLUGINS.md
Outdated
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'm assuming we're saying that unit tests are optional. I would word that like "Unit tests are encouraged, but optional. Unit tests should be placed in __tests__ directories as close as possible to the source code that they test. Integration tests should be placed in an integration-tests directory at the root level of the plugin directory."
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.
Unit tests are highly encouraged. Testing is an important part of developing software.
Tests should be simple to read and consequently easy to maintain. If they're not, simplify them. Prefer smaller, focused test cases.
PLUGINS.md
Outdated
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.
"Plugin directory name" -> "The plugin directory name"
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.
Packages whose name starts with console- are expected to be maintained by core Console team, so they shouldn't have an OWNERS file.
Every (non-core) plugin package must have an OWNERS file. Its directory name should end with -plugin to denote its purpose.
Note: dev-console is the only exception to this rule, cc @christianvogt 😉
In addition, Console app itself is a plugin, see packages/console-app/src/plugin.tsx.
PLUGINS.md
Outdated
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 applies to directories as well, right?
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.
Yes, but I wouldn't mention it here, I think this is common knowledge (?)
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 disagree with this style and it goes against other best practices. That being said this is not the right location to outline stylistic concerns. It's better managed through eslint enforcement or a separate styleguide.
PLUGINS.md
Outdated
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.
"consolePlugin map, in the plugins package.json." -> "consolePlugin map in the plugin's package.json."
PLUGINS.md
Outdated
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.
"Test path is relative the plugin root" -> "The test path is relative to the plugin root"
You can delete the comma after "@console/internal-integration-tests".
PLUGINS.md
Outdated
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.
"OWNERS file define a list of maintainers, community plugins" -> "OWNERS file defines a list of maintainers. Community plugins".
PLUGINS.md
Outdated
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.
"responsible of reviewing" -> "responsible for reviewing"
"For more in depth information see [prow]" -> "For more in-depth information, see the [prow]"
PLUGINS.md
Outdated
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.
"console or community teams, plugins" -> "console or community teams. Plugins"
You can delete the comma after "OWNERS file".
vojtechszocs
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.
PLUGINS.md
Outdated
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.
@yaacov Can you please move this file to packages/console-plugin-sdk/README.md ?
PLUGINS.md
Outdated
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.
Many important things could be covered here:
- plugins are static meaning their code gets bundled ("baked") into Console build output
- plugins are not loaded dynamically at runtime, which in turn simplifies the architecture (no need to sandbox plugin execution or its interaction with Console app or Bridge server)
console-appdependencies control the set of plugins to include in Console build, this can be overridden viaCONSOLE_PLUGINSenv. variable
- plugins have their code represented as Console monorepo packages
- this increases the level of trust between Console app and its plugins
- plugin code close to Console code avoids cross-repo PR maintenance issues
- each plugin has an
OWNERSfile denoting its ownership (see here for details on reviewers and approvers)
- plugins are declarative meaning they provide a list of extensions to be interpreted
- each extension has a unique
typeandpropertiesrepresenting its parameters (data and/or callbacks) - (upcoming change) each extension has
flagsobject to support gating by Console feature flags
- each extension has a unique
- Console demo plugin is used to demonstrate specific extensions
- it should contain at least one instance of every extension type (sadly, this isn't the case yet)
- it should be a "synthetic" (foo-bar, not-a-real-world) example acting as a starting point for further exploration
PLUGINS.md
Outdated
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.
👍
PLUGINS.md
Outdated
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.
Please call them "plugin entry modules" since they are effectively ECMAscript modules.
Having package.json and OWNERS files is mandatory.
Every plugin should follow the recommended file structure:
srcdirectoryintegration-testsdirectory (if needed)- plugin entry module at
src/plugin.ts src/componentsfor React components,src/modelsfor k8s model definitions- unit tests co-located at
/path/to/unit/__tests__/unit.spec.ts
In addition, every plugin should typically provide (at least) these two extensions:
ModelDefinition- add new k8s model definitionsFeatureFlag/Model(in future alsoFeatureFlag/Action) - add new feature flag
and use the newly added feature flags (possibly together with core Console flags) to gate its extensions.
PLUGINS.md
Outdated
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.
Unit tests are highly encouraged. Testing is an important part of developing software.
Tests should be simple to read and consequently easy to maintain. If they're not, simplify them. Prefer smaller, focused test cases.
PLUGINS.md
Outdated
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.
Plugin Entry Module 😄
PLUGINS.md
Outdated
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'd use a dotted path notation, i.e. consolePlugin.entry value.
(These aren't variables from JSON file processing point of view.)
PLUGINS.md
Outdated
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.
For better type checking and code completion, use a type parameter that represents the union of all the extension types consumed by the plugin.
// don't do this
const plugin: Plugin<any> = [ /* stuff */ ];
// do this
const plugin: Plugin<FooExtension | BarExtension> = [ /* stuff */ ];
// or better yet, this
type ConsumedExtensions = FooExtension | BarExtension;
const plugin: Plugin<ConsumedExtensions> = [ /* stuff */ ];
PLUGINS.md
Outdated
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.
Yup, we should.
We can refer to console-demo-plugin but it isn't complete at the moment in terms of having at least one instance of each extension type. I'm planning to write a test for that.
PLUGINS.md
Outdated
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.
Can't we simply state that Console plugins are 1st class citizens of Console monorepo and therefore reuse the same testing (Jest, Protractor, etc.) infrastructure and conventions?
PLUGINS.md
Outdated
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 OWNERS file should also include labels:
labels:
- component/<plugin-name>
To add a new component labels, raise a PR here: https://github.com/openshift/release/blob/master/cluster/ci/config/prow/labels.yaml
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.
Seems like the Prow label config moved to https://github.com/openshift/release/blob/master/core-services/prow/02_config/_labels.yaml
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.
Thanks ! updated link
92d955c to
4df31b4
Compare
4df31b4 to
4710e0d
Compare
|
@christianvogt @vojtechszocs @pcbailey Thanks for the reviews and helpful suggestions ❗ I removed the WIP, please re-review. |
|
/test e2e-aws-console |
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.
"Plugins are static, their code gets bundled ("baked") into Console build output:"
"Plugins are static. Their code gets bundled ("baked") into the Console build output:"
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.
"with Console app or Bridge"
"with the Console app or Bridge"
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.
"Console-app dependencies control the set of plugins to include in Console build, this can be overridden via CONSOLE_PLUGINS env. variable."
"Console-app dependencies control the set of plugins to include in the Console build. This can be overridden using the CONSOLE_PLUGINS environment variable."
Should we provide an example of this?
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.
Yes, we should.
PR #1926 documents this and provides examples for different scenarios, most notably:
- development with specific plugins
- development without any plugins
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.
"between Console app"
"between the Console app"
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.
"see here for details"
Is "here" supposed to be a link? If not, I'd say "see the OWNERS file section below for details" instead. Whenever I see something like "see here", I automatically assume the "here" is a link.
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.
Is "here" supposed to be a link?
It was, in my original comment 😃
Whenever I see something like "see here", I automatically assume the "here" is a link.
👍
A good documentation favors specific terms, like "OWNERS file section of the Prow approve plugin", instead of loose terms, like "here" or "this link".
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 OWNERS file define a list of maintainers, community"
"The OWNERS file defines a list of maintainers. Community"
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.
"responsible of reviewing and approving pull requests for this plugin. For more in depth information see [prow]"
"responsible for reviewing and approving pull requests for this plugin. For more in-depth information, see the [prow]"
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.
What do the labels do/represent?
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.
@pcbailey These are GitHub PR labels representing components which are touched by the given change (PR).
For example, PR that touches shared code pkg and KubeVirt plugin pkg has labels component/shared and component/kubevirt.
In general, this is a Prow CI feature that allows PRs affected by OWNERS file(s) to be labeled.
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.
"To add a new component labels, raise a PR here: https://github.com/openshift/release/blob/master/cluster/ci/config/prow/labels.yaml"
"To add a new component label, open a PR with the new label added to https://github.com/openshift/release/blob/master/cluster/ci/config/prow/labels.yaml"
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.
"Plugins can be owned by console or community teams, plugins maintained by the console team will not have an OWNERS file, and by convention use a directory named console-<some-name>."
"Plugins can be owned either by the Console team or community teams. Plugins maintained by the Console team will not have an OWNERS file and will use a directory named console-<some-name> by convention."
7caab34 to
bd5a472
Compare
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/hold |
|
changing back to master :-) |
3c65011 to
d44fcb5
Compare
d44fcb5 to
2999f52
Compare
|
/test e2e-aws-console-olm |
|
/test e2e-aws |
4 similar comments
|
/test e2e-aws |
|
/test e2e-aws |
|
/test e2e-aws |
|
/test e2e-aws |
|
@spadgett is this still |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pcbailey, vojtechszocs, yaacov The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
FYI the |
|
@vojtechszocs a question about
The use case I have in mind is adding a testing plugin by only using |
The plugins specified via the See
Yes.
Yes, this is a valid and supported use case 👍 |
Add a plugins readme.