Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 2055814

Summary: Custom dynamic exntension point causes runtime and compile time error
Product: OpenShift Container Platform Reporter: Bipul Adhikari <badhikar>
Component: Management ConsoleAssignee: Vojtech Szocs <vszocs>
Status: CLOSED ERRATA QA Contact: Xiyun Zhao <xiyuzhao>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.10CC: aos-bugs, jhadvig, yapei
Target Milestone: ---   
Target Release: 4.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-08-10 10:50:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2059674    
Bug Blocks:    

Description Bipul Adhikari 2022-02-17 16:53:03 UTC
Description of problem:
When adding a custom extension point in `console-extensions.json`, the validator reports error. The validation is based on the schema generated from the extensions defined in the SDK. The validation needs to be more permissive.


Version-Release number of selected component (if applicable): 4.10


How reproducible: 1/1


Steps to Reproduce:
1. Add a custom extension point 
2. Try to build the dynamic plugin. 
3. Try to run it on console.

Actual results: Compilation errors out( can be supressed using env variables)
Even if we get it to compile the plugin will fail to load due to errors on the runtime.


Expected results: Custom extension points should be loaded and be registered.


Additional info:
Example of an custom extension point. 
```
  {
    "type": "odf.dashboard/widget",
    "properties": {
      "component": {"$codeRef": "dashboard.RerouteResource"}
    }
  }
```

Comment 3 Xiyun Zhao 2022-03-09 17:52:52 UTC
This bug has been verified on payload 4.11.0-0.nightly-2022-03-04-063157

Verification Steps:
1. Clone the newest console code, configuration a custom plugin. Like dynamic-demo-plugin 
2. Add below part (an example) into console-extensions.json file which under the path ./console/dynamic-demo-plugin
  {
    "type": "testing",
    "properties": {
      "abc": true
    }
  },
  {
    "type": "testing.test",
    "properties": {
      "foo": { "$codeRef": "barUtils.testHandler" }
    }
  },
3. Login OCP by using CLI command 
4. Following below command to build a dynamic plugin(Note: Following the Steps to run the command on different terminal)

        Terminal 1: under path ./console/
step 1: $ source ./contrib/oc-environment.sh
step 8: $./bin/bridge -plugins console-demo-plugin=http://localhost:9001

        Terminal 2: under path ./console/frontend/
step 2: $ yarn install
step 3: $ yarn build
step 7: $ yarn dev

        Terminal 3: under path .console/dynamic-demo-plugin
step 4: $ yarn install
step 5: $ yarn run build
step 6: $ yarn http-server

5. Verify if there is no error found after finish 4.step5, the dynamic plugin can be built successfully with custom extension
6. Go to path ./console/dynamic-demo-plugin/dist Verify if the custom defined extension has been added into plugin-maifest.json file 
7. Verify if the OKD page is load successfully without error

Result:
5. The dynamic plugin is build successfully without error
   built modules 39.9 KiB (javascript) 252 bytes (consume-shared) [built]
  javascript modules 39.9 KiB
    modules by path ./components/ 30.9 KiB 7 modules
    modules by path ./utils/ 8.98 KiB
      ./utils/example-navs.tsx + 1 modules 2.1 KiB [built] [code generated]
      + 4 modules
    container entry 42 bytes [built] [code generated]
  consume-shared-module modules 252 bytes
    modules by path *.0 (singleton) 84 bytes
      consume shared module (default) react-router-dom@=5.2.0 (singleton) 42 bytes [built] [code generated]
      consume shared module (default) react@^16.8.0 || ^17.0.0 (singleton) 42 bytes [built] [code generated]
    + 4 modules
    webpack 5.68.0 compiled successfully in 7919 ms
    Done in 9.77s.
6. The custom defined extension has been added into plugin-maifest.json file 
7. OKD page is loaded normally

Comment 5 errata-xmlrpc 2022-08-10 10:50:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: OpenShift Container Platform 4.11.0 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:5069