-
Notifications
You must be signed in to change notification settings - Fork 52
feat: publish the portal shell and add the create-portal scaffolding CLI #753
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
Open
kaviththiranga
wants to merge
6
commits into
openchoreo:main
Choose a base branch
from
kaviththiranga:feat/portal-app-publishable
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5331438
feat: make portal-app publishable with an assistant integration seam
kaviththiranga d05b6a9
feat: add create-portal CLI and per-release portal template
kaviththiranga b8b4000
fix(create-portal): address review feedback
kaviththiranga bbf5053
fix: restore build-failure and deploy investigate prompts after NFS m…
kaviththiranga 783aa4d
fix: address review feedback on template source files
kaviththiranga 3176253
fix: align create-portal with npm trusted publishing
kaviththiranga File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
| '@openchoreo/create-portal': minor | ||
| --- | ||
|
|
||
| New `npx @openchoreo/create-portal` CLI that scaffolds a custom OpenChoreo | ||
| Portal: a thin Backstage app on the published portal packages, pinned to one | ||
| release. The template is rendered from the live monorepo at pack time | ||
| (private assistant wiring stripped, `workspace:^` ranges pinned to the | ||
| lockstep release version), ships inside the CLI tarball, and is pushed to the | ||
| `openchoreo/portal-template` repo per release as the `git merge` upgrade | ||
| base. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| --- | ||
| '@openchoreo/backstage-portal-app': minor | ||
| '@openchoreo/backstage-plugin-react': minor | ||
| '@openchoreo/backstage-plugin': patch | ||
| '@openchoreo/backstage-plugin-openchoreo-ci': patch | ||
| --- | ||
|
|
||
| Make `@openchoreo/backstage-portal-app` publishable. The portal shell no | ||
| longer depends on the private Portal Assistant plugin: the assistant | ||
| integration contract (`portalAssistantIntegrationApiRef` / | ||
| `usePortalAssistant`, re-exported by the shell) now lives in | ||
| `@openchoreo/backstage-plugin-react`, and the stock portal app injects the | ||
| assistant through it via `createPortalApp({ features })`, mirroring how the | ||
| backend adds the assistant outside `portalBackendFeatures`. Without a | ||
| registered integration every slot renders nothing. | ||
|
|
||
| This also restores the two assistant surfaces dropped by the NFS entity-page | ||
| migration: the component Overview and Build tabs mount the | ||
| `BuildFailureNotifier` slot again, and the deploy panel's investigate action | ||
| falls back to the integration's `renderInvestigateAction` when no prop is | ||
| passed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| import { createPortalApp } from '@openchoreo/backstage-portal-app'; | ||
| import { assistantFeature } from './assistant'; | ||
|
|
||
| export default createPortalApp().createRoot(); | ||
| export default createPortalApp({ features: [assistantFeature] }).createRoot(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import { | ||
| AssistantDrawerProvider, | ||
| FailedBuildSnackbar, | ||
| PerchAgentClient, | ||
| } from '@openchoreo/backstage-plugin-openchoreo-portal-assistant'; | ||
| import { assistantFeature, assistantIntegration } from './assistant'; | ||
|
|
||
| describe('assistant wiring', () => { | ||
| it('fills every shell integration slot', () => { | ||
| expect(assistantIntegration.AppWrapper).toBe(AssistantDrawerProvider); | ||
| expect(assistantIntegration.BuildFailureNotifier).toBe(FailedBuildSnackbar); | ||
| expect(assistantIntegration.renderInvestigateAction).toEqual( | ||
| expect.any(Function), | ||
| ); | ||
| }); | ||
|
|
||
| it('constructs the perch client the api factory registers', () => { | ||
| // Replaces the factory coverage that lived in portal-app's apis.test.ts | ||
| // before the assistant moved out of the published shell. | ||
| const client = new PerchAgentClient({ | ||
| discoveryApi: { getBaseUrl: async () => 'http://localhost' } as any, | ||
| fetchApi: { fetch: (() => undefined) as any } as any, | ||
| }); | ||
| expect(client).toBeInstanceOf(PerchAgentClient); | ||
| }); | ||
|
|
||
| it('exposes the assistant as an installable frontend feature', () => { | ||
| expect(assistantFeature).toBeDefined(); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| import { | ||
| ApiBlueprint, | ||
| createFrontendModule, | ||
| } from '@backstage/frontend-plugin-api'; | ||
| import { discoveryApiRef, fetchApiRef } from '@backstage/core-plugin-api'; | ||
| import { | ||
| portalAssistantIntegrationApiRef, | ||
| PortalAssistantIntegration, | ||
| } from '@openchoreo/backstage-portal-app'; | ||
| import { LogRowActionBlueprint } from '@openchoreo/backstage-plugin-openchoreo-observability/alpha'; | ||
| import { | ||
| AssistantDrawerProvider, | ||
| FailedBuildSnackbar, | ||
| InvestigateDependencyButton, | ||
| InvestigateLogButton, | ||
| PerchAgentClient, | ||
| perchAgentApiRef, | ||
| } from '@openchoreo/backstage-plugin-openchoreo-portal-assistant'; | ||
|
|
||
| // What the assistant contributes to the shell's optional integration slots: | ||
| // the global drawer provider, the failed-build prompt on entity Overview and | ||
| // Build tabs, and the deploy panel's investigate action. | ||
| export const assistantIntegration: PortalAssistantIntegration = { | ||
| AppWrapper: AssistantDrawerProvider, | ||
| BuildFailureNotifier: FailedBuildSnackbar, | ||
| renderInvestigateAction: scope => <InvestigateDependencyButton {...scope} />, | ||
| }; | ||
|
|
||
| /** | ||
| * Wires the Portal Assistant (Perch) into the portal shell. The assistant is | ||
| * a PRIVATE plugin — deliberately not part of the published | ||
| * `@openchoreo/backstage-portal-app` bundle — so the stock portal injects it | ||
| * here, mirroring how packages/backend adds the assistant backend outside | ||
| * `portalBackendFeatures`. A custom portal scaffold simply omits this module. | ||
| */ | ||
| export const assistantFeature = createFrontendModule({ | ||
| pluginId: 'app', | ||
| extensions: [ | ||
| // Perch agent client. NOTE: ``perchAgentApiRef`` is also declared on | ||
| // ``openchoreoPerchPlugin.apis``, but that declaration is never picked | ||
| // up at runtime — the plugin exports plain React components and never | ||
| // registers a routable or component extension, so the plugin loader | ||
| // never visits its ``apis`` array. This factory is the one actually | ||
| // wired in; removing it causes ``NotImplementedError: No implementation | ||
| // available for apiRef{plugin.openchoreo-portal-assistant.service}`` in | ||
| // AssistantDrawerProvider. | ||
| ApiBlueprint.make({ | ||
| name: 'perch-agent', | ||
| params: defineParams => | ||
| defineParams({ | ||
| api: perchAgentApiRef, | ||
| deps: { discoveryApi: discoveryApiRef, fetchApi: fetchApiRef }, | ||
| factory: ({ discoveryApi, fetchApi }) => | ||
| new PerchAgentClient({ discoveryApi, fetchApi }), | ||
| }), | ||
| }), | ||
| ApiBlueprint.make({ | ||
| name: 'assistant-integration', | ||
| params: defineParams => | ||
| defineParams({ | ||
| api: portalAssistantIntegrationApiRef, | ||
| deps: {}, | ||
| factory: () => assistantIntegration, | ||
| }), | ||
| }), | ||
| // Per-row "investigate" action for the observability runtime-logs tables. | ||
| // Registered here (not inside the observability plugin) so observability | ||
| // owns no dependency on perch — the host composes the two. | ||
| LogRowActionBlueprint.make({ | ||
| name: 'investigate-log', | ||
| params: { | ||
| renderer: (log, getLogsSnapshot) => ( | ||
| <InvestigateLogButton log={log} getLogsSnapshot={getLogsSnapshot} /> | ||
| ), | ||
| }, | ||
| }), | ||
| ], | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| module.exports = require('@backstage/cli/config/eslint-factory')(__dirname, { | ||
| ignorePatterns: ['templates/**', 'templates-src/**', 'scripts/**'], | ||
| rules: { | ||
| 'no-console': 0, | ||
| }, | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.