Skip to content

Conversation

@vojtechszocs
Copy link
Contributor

@vojtechszocs vojtechszocs commented Nov 5, 2025

Summary

This PR allows your application to manually load new plugins without involving the usual load-over-network process.

const fooExtensions: Extension[] = [
  {
    type: 'core.telemetry/listener',
    properties: {
      // code references are already represented as functions () => Promise<TValue>
      // we are using applyCodeRefSymbol helper to add CodeRef symbol to the function
      listener: applyCodeRefSymbol(() => import('./foo').then((m) => m.fooListener)),
    },
  },
];

const fooManifest: LocalPluginManifest = {
  name: 'foo-plugin',
  version: '1.0.0',
  // optional: dependencies, optionalDependencies, customProperties
  extensions: fooExtensions,
  $local: true, // indicates that this is a local plugin manifest
};

pluginStore.loadPlugin(fooManifest);

This change does not break the current PluginStore.loadPlugin function signature or semantics.

Details

PluginStore.loadPlugin function can be used to load plugins from PluginManifest or LocalPluginManifest

loadPlugin: (manifest: AnyPluginManifest | string, forceReload?: boolean) => Promise<void>;

PluginManifest

This is the standard (webpack) representation of a plugin manifest, where we need to load the specified scripts in order to initialize the plugin and access its exposed modules via the plugin's entry module.

LocalPluginManifest

This is the local (manual) representation of a plugin manifest; any code references in the extensions list should be represented as CodeRef functions. Plugins defined this way will have no entry module.

How is loading via local manifest different from loading via standard manifest?

As per default PluginLoader.loadPlugin implementation:

  • there are no plugin scripts ▶️ no scripts are loaded over the network
  • there is no entry module ▶️ entryModule.init function is not called
  • there are no exposed modules ▶️ code references in manifest.extensions are not decoded

What is the purpose of applyCodeRefSymbol helper function?

To mark the given () => Promise<TValue> function with CodeRef symbol so that useResolvedExtensions hook treats it as a code reference to be resolved into TValue.

@openshift-ci openshift-ci bot requested review from florkbr and karelhala November 5, 2025 22:06
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 5, 2025
@codecov-commenter
Copy link

codecov-commenter commented Nov 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 25.20%. Comparing base (9d1d508) to head (c193e2d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #281   +/-   ##
=======================================
  Coverage   25.20%   25.20%           
=======================================
  Files          40       40           
  Lines        1210     1210           
  Branches      244      244           
=======================================
  Hits          305      305           
  Misses        889      889           
  Partials       16       16           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vojtechszocs
Copy link
Contributor Author

/retest

3 similar comments
@jhadvig
Copy link
Member

jhadvig commented Nov 7, 2025

/retest

@vojtechszocs
Copy link
Contributor Author

/retest

@vojtechszocs
Copy link
Contributor Author

/retest

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 7, 2025
@logonoff
Copy link
Member

logonoff commented Nov 7, 2025

/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 7, 2025
@vojtechszocs vojtechszocs force-pushed the support-static-plugins branch from aca0ed9 to c193e2d Compare November 10, 2025 18:41
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Nov 10, 2025
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 10, 2025

New changes are detected. LGTM label has been removed.

"eslint-print-config": "yarn eslint --print-config",
"jest": "TZ=UTC jest --passWithNoTests",
"jest-print-config": "jest --showConfig",
"sample-app-install-cypress": "yarn workspace @monorepo/sample-app run cypress install",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a helper script to make test env. preparation easier when running in a container.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 10, 2025

@vojtechszocs: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@vojtechszocs
Copy link
Contributor Author

/hold

Will do some minor changes based on discussion with @christianvogt

Copy link
Contributor

@Hyperkid123 Hyperkid123 left a comment

Choose a reason for hiding this comment

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

👍

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 12, 2025

@Hyperkid123: changing LGTM is restricted to collaborators

In response to this:

👍

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 12, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Hyperkid123, logonoff, vojtechszocs

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [logonoff,vojtechszocs]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@logonoff
Copy link
Member

logonoff commented Nov 21, 2025

/retitle CONSOLE-4910: Add support for loading plugins from local manifests

@openshift-ci openshift-ci bot changed the title Add support for loading plugins from local manifests CONSOLE-4910: Add support for loading plugins from local manifests Nov 21, 2025
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Nov 21, 2025
@openshift-ci-robot
Copy link

openshift-ci-robot commented Nov 21, 2025

@vojtechszocs: This pull request references CONSOLE-4910 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.21.0" version, but no target version was set.

In response to this:

Summary

This PR allows your application to manually load new plugins without involving the usual load-over-network process.

const fooExtensions: Extension[] = [
 {
   type: 'core.telemetry/listener',
   properties: {
     // code references are already represented as functions () => Promise<TValue>
     // we are using applyCodeRefSymbol helper to add CodeRef symbol to the function
     listener: applyCodeRefSymbol(() => import('./foo').then((m) => m.fooListener)),
   },
 },
];

const fooManifest: LocalPluginManifest = {
 name: 'foo-plugin',
 version: '1.0.0',
 // optional: dependencies, optionalDependencies, customProperties
 extensions: fooExtensions,
 $local: true, // indicates that this is a local plugin manifest
};

pluginStore.loadPlugin(fooManifest);

This change does not break the current PluginStore.loadPlugin function signature or semantics.

Details

PluginStore.loadPlugin function can be used to load plugins from PluginManifest or LocalPluginManifest

loadPlugin: (manifest: AnyPluginManifest | string, forceReload?: boolean) => Promise<void>;

PluginManifest

This is the standard (webpack) representation of a plugin manifest, where we need to load the specified scripts in order to initialize the plugin and access its exposed modules via the plugin's entry module.

LocalPluginManifest

This is the local (manual) representation of a plugin manifest; any code references in the extensions list should be represented as CodeRef functions. Plugins defined this way will have no entry module.

How is loading via local manifest different from loading via standard manifest?

As per default PluginLoader.loadPlugin implementation:

  • there are no plugin scripts ▶️ no scripts are loaded over the network
  • there is no entry module ▶️ entryModule.init function is not called
  • there are no exposed modules ▶️ code references in manifest.extensions are not decoded

What is the purpose of applyCodeRefSymbol helper function?

To mark the given () => Promise<TValue> function with CodeRef symbol so that useResolvedExtensions hook treats it as a code reference to be resolved into TValue.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants