Skip to content

Commit 259d3b2

Browse files
authored
feat(cost-management): upgrade Backstage from 1.39.0 to 1.49.4 (#2946)
* feat(cost-management): upgrade Backstage from 1.39.0 to 1.49.4 Upgrade the cost-management workspace to align with the RHDH 1.10 target Backstage version (1.49.4) and Node.js 22. Key changes: - backstage.json: 1.39.0 → 1.49.4 - Node.js engine: 18 || 20 → 22 - TypeScript: 5.3 → 5.8 - All @backstage/* deps bumped via backstage-cli versions:bump - Removed stale resolutions (catalog-backend, scaffolder pinned versions) - Added @backstage/cli-defaults devDependency - Added isolated-vm ^6.0.1 resolution for Node 22 compatibility - Fixed AuthorizeResult type narrowing in permission code - Fixed @backstage/plugin-proxy-backend/alpha → root import - Removed deprecated variant="gridItem" from catalog components - Removed import assertion syntax from test file - Updated react-router-dom, @testing-library/react, @testing-library/dom, better-sqlite3 to versions compatible with Backstage 1.49.x Made-with: Cursor * chore(cost-management): regenerate API report after Backstage upgrade * chore(cost-management): dedupe yarn.lock to fix CI lockfile verification Made-with: Cursor * fix(cost-management): remove orchestrator from dev app and pin @protobufjs/inquire Remove orchestrator plugin from dev app/backend to reduce transitive dependency footprint (isolated-vm, protobufjs, grpc, etc.) and fix CI build failure caused by @protobufjs/inquire@1.1.1 dynamic require() triggering Rspack critical dependency warning with CI=true. Pin @protobufjs/inquire to 1.1.0 to match other workspaces in the monorepo. Add README section documenting how to re-add orchestrator for local dev. Made-with: Cursor * chore(cost-management): add changeset for Backstage 1.49.4 upgrade Made-with: Cursor * chore(cost-management): remove unused audit-log-node from dev backend Remove @janus-idp/backstage-plugin-audit-log-node from dev backend as it is never imported. The plugin uses its own auditLog.ts utility. Made-with: Cursor
1 parent d621f93 commit 259d3b2

19 files changed

Lines changed: 6955 additions & 10212 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

workspaces/cost-management/README.md

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ The Cost Management plugin's Optimizations section is dependent on [Orchestrator
5151
- [Installing Red Hat Developer Hub with Orchestrator by using the Red Hat Developer Hub Operator](https://docs.redhat.com/en/documentation/red_hat_developer_hub/1.8/html/orchestrator_in_red_hat_developer_hub/assembly-install-rhdh-orchestrator-operator)
5252
- [Installing Red Hat Developer Hub with Orchestrator by using the Red Hat Developer Hub Helm chart](https://docs.redhat.com/en/documentation/red_hat_developer_hub/1.8/html/orchestrator_in_red_hat_developer_hub/assembly-install-rhdh-orchestrator-helm)
5353

54-
This method requires vanilla backstage to be used:
55-
56-
- [Install as a static plugin for local development](https://github.com/redhat-developer/rhdh-plugins/tree/main/workspaces/orchestrator#install-as-a-static-plugin)
54+
For vanilla Backstage local development, see the [Local Development with Orchestrator](#local-development-with-orchestrator) section below.
5755

5856
**Workflow details** : [Here is the link to the workflow](https://github.com/rhdhorchestrator/serverless-workflows/tree/main/workflows/patch-k8s-resource) which is being used for manually applying the recommendation from the Resource Optimization plugin.
5957

@@ -176,6 +174,40 @@ The HTTP endpoints exposed by the cost-management-backend can enforce authorizat
176174

177175
An application for applying the recommendations automatically. The application makes use of OSL (OpenShift Serverless Logic, a.k.a. SonataFlow) which is part of the Orchestrator installation. If you already have the [Orchestrator plugin and the workflow](#dependency-on-orchestrator-plugin-and-workflow-details) installed then you are ready for installing the Optimizer application. Follow the [application instructions](https://github.com/rhdhorchestrator/optimizer/tree/main) for installing and configuring it.
178176

177+
## Local Development with Orchestrator
178+
179+
The orchestrator plugin is **not** included in the dev app by default. The cost-management plugin communicates with the orchestrator backend at runtime via the Backstage discovery API, so the orchestrator packages are not a compile-time dependency.
180+
181+
If you need to test the "Apply Recommendation" workflow locally, add the orchestrator packages to the dev app:
182+
183+
```sh
184+
# From the cost-management workspace root
185+
yarn --cwd packages/app add @red-hat-developer-hub/backstage-plugin-orchestrator
186+
yarn --cwd packages/backend add @red-hat-developer-hub/backstage-plugin-orchestrator-backend
187+
```
188+
189+
Then register the plugins in the dev app:
190+
191+
1. In `packages/app/src/App.tsx`, add:
192+
193+
```tsx
194+
import { OrchestratorPage } from '@red-hat-developer-hub/backstage-plugin-orchestrator';
195+
// ... inside <FlatRoutes>:
196+
<Route path="/orchestrator" element={<OrchestratorPage />} />;
197+
```
198+
199+
2. In `packages/backend/src/index.ts`, add:
200+
201+
```ts
202+
backend.add(
203+
import('@red-hat-developer-hub/backstage-plugin-orchestrator-backend'),
204+
);
205+
backend.add(import('@backstage/plugin-notifications-backend'));
206+
backend.add(import('@backstage/plugin-signals-backend'));
207+
```
208+
209+
For the full orchestrator setup guide, see: [Install as a static plugin for local development](https://github.com/redhat-developer/rhdh-plugins/tree/main/workspaces/orchestrator#install-as-a-static-plugin)
210+
179211
## References
180212

181213
- [Installing ROS-OCP RHDH plugin on Red Hat Developer Hub on a Openshift Cluster](https://docs.google.com/document/d/1tExe7cEBYMJplkk9ppSdBINwE-14KmxURczGjloHqZ4/edit?usp=sharing)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "version": "1.39.0" }
1+
{ "version": "1.49.4" }

workspaces/cost-management/package.json

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.0.0",
44
"private": true,
55
"engines": {
6-
"node": "18 || 20"
6+
"node": "22"
77
},
88
"scripts": {
99
"start": "concurrently -c auto -n \"fe,be\" -p \"{name}:{pid}\" \"yarn start-app\" \"yarn start-backend\"",
@@ -40,9 +40,10 @@
4040
"directory": "workspaces/cost-management"
4141
},
4242
"devDependencies": {
43-
"@backstage/cli": "^0.29.4",
44-
"@backstage/e2e-test-utils": "^0.1.1",
45-
"@backstage/repo-tools": "^0.13.3",
43+
"@backstage/cli": "^0.36.0",
44+
"@backstage/cli-defaults": "^0.1.0",
45+
"@backstage/e2e-test-utils": "^0.1.2",
46+
"@backstage/repo-tools": "^0.17.0",
4647
"@changesets/cli": "^2.27.1",
4748
"@microsoft/api-extractor-model": "^7.29.2",
4849
"@microsoft/tsdoc": "^0.16.0",
@@ -52,21 +53,14 @@
5253
"knip": "^5.27.4",
5354
"node-gyp": "^9.0.0",
5455
"prettier": "^2.3.2",
55-
"typescript": "~5.3.0"
56+
"typescript": "~5.8.0"
5657
},
5758
"resolutions": {
58-
"@backstage/plugin-catalog-backend": "1.30.0",
59-
"@backstage/plugin-catalog-backend-module-logs": "0.1.6",
60-
"@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "0.2.4",
61-
"@backstage/plugin-catalog-backend-module-unprocessed": "0.5.4",
62-
"@backstage/plugin-scaffolder": "1.27.5",
63-
"@backstage/plugin-scaffolder-backend": "1.29.0",
6459
"@types/react": "^18",
6560
"@types/react-dom": "^18",
6661
"react": "^18",
6762
"react-dom": "^18",
68-
"@rjsf/core": "5.24.13",
69-
"@rjsf/utils": "5.24.13"
63+
"@protobufjs/inquire": "1.1.0"
7064
},
7165
"prettier": "@spotify/prettier-config",
7266
"lint-staged": {

workspaces/cost-management/packages/app/package.json

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -21,52 +21,51 @@
2121
"dependencies": {
2222
"@backstage-community/plugin-rbac": "1.33.2",
2323
"@backstage-community/plugin-tech-radar": "^0.7.4",
24-
"@backstage/app-defaults": "^1.5.16",
25-
"@backstage/catalog-model": "^1.7.3",
26-
"@backstage/cli": "^0.29.4",
27-
"@backstage/core-app-api": "^1.15.4",
28-
"@backstage/core-components": "^0.16.3",
29-
"@backstage/core-plugin-api": "^1.10.3",
30-
"@backstage/integration-react": "^1.2.3",
31-
"@backstage/plugin-api-docs": "^0.12.3",
32-
"@backstage/plugin-catalog": "^1.26.1",
33-
"@backstage/plugin-catalog-common": "^1.1.3",
34-
"@backstage/plugin-catalog-graph": "^0.4.15",
35-
"@backstage/plugin-catalog-import": "^0.12.9",
36-
"@backstage/plugin-catalog-react": "^1.15.1",
37-
"@backstage/plugin-org": "^0.6.35",
38-
"@backstage/plugin-permission-react": "^0.4.30",
39-
"@backstage/plugin-scaffolder": "^1.27.5",
40-
"@backstage/plugin-search": "^1.4.22",
41-
"@backstage/plugin-search-react": "^1.8.5",
42-
"@backstage/plugin-techdocs": "^1.12.2",
43-
"@backstage/plugin-techdocs-module-addons-contrib": "^1.1.20",
44-
"@backstage/plugin-techdocs-react": "^1.2.13",
45-
"@backstage/plugin-user-settings": "^0.8.18",
46-
"@backstage/theme": "^0.6.3",
24+
"@backstage/app-defaults": "^1.7.6",
25+
"@backstage/catalog-model": "^1.7.7",
26+
"@backstage/cli": "^0.36.0",
27+
"@backstage/core-app-api": "^1.19.6",
28+
"@backstage/core-components": "^0.18.8",
29+
"@backstage/core-plugin-api": "^1.12.4",
30+
"@backstage/integration-react": "^1.2.16",
31+
"@backstage/plugin-api-docs": "^0.13.5",
32+
"@backstage/plugin-catalog": "^2.0.1",
33+
"@backstage/plugin-catalog-common": "^1.1.8",
34+
"@backstage/plugin-catalog-graph": "^0.6.0",
35+
"@backstage/plugin-catalog-import": "^0.13.11",
36+
"@backstage/plugin-catalog-react": "^2.1.1",
37+
"@backstage/plugin-org": "^0.7.0",
38+
"@backstage/plugin-permission-react": "^0.4.41",
39+
"@backstage/plugin-scaffolder": "^1.36.1",
40+
"@backstage/plugin-search": "^1.7.0",
41+
"@backstage/plugin-search-react": "^1.11.0",
42+
"@backstage/plugin-techdocs": "^1.17.2",
43+
"@backstage/plugin-techdocs-module-addons-contrib": "^1.1.34",
44+
"@backstage/plugin-techdocs-react": "^1.3.9",
45+
"@backstage/plugin-user-settings": "^0.9.1",
46+
"@backstage/theme": "^0.7.2",
4747
"@material-ui/core": "^4.12.2",
4848
"@material-ui/icons": "^4.9.1",
4949
"@patternfly/patternfly": "^6.3.0",
50-
"@red-hat-developer-hub/backstage-plugin-orchestrator": "^2.5.1",
5150
"@red-hat-developer-hub/backstage-plugin-theme": "^0.12.0",
5251
"@red-hat-developer-hub/plugin-cost-management": "workspace:^",
5352
"history": "^5.0.0",
5453
"react": "^18.0.2",
5554
"react-dom": "^18.0.2",
56-
"react-router": "^6.3.0",
57-
"react-router-dom": "^6.3.0",
55+
"react-router": "^6.30.2",
56+
"react-router-dom": "^6.30.2",
5857
"react-use": "^17.2.4"
5958
},
6059
"devDependencies": {
61-
"@backstage/test-utils": "^1.7.4",
60+
"@backstage/test-utils": "^1.7.16",
6261
"@emotion/react": "^11.11.4",
6362
"@emotion/styled": "^11.11.5",
6463
"@mui/icons-material": "^5.16.1",
6564
"@mui/material": "^5.16.1",
6665
"@playwright/test": "^1.56.1",
67-
"@testing-library/dom": "^9.0.0",
66+
"@testing-library/dom": "^10.0.0",
6867
"@testing-library/jest-dom": "^6.0.0",
69-
"@testing-library/react": "^15.0.0",
68+
"@testing-library/react": "^16.0.0",
7069
"@testing-library/user-event": "^14.0.0",
7170
"@types/react": "^18",
7271
"@types/react-dom": "*",

workspaces/cost-management/packages/app/src/App.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ import {
5555
ResourceOptimizationPage,
5656
OpenShiftPage,
5757
} from '@red-hat-developer-hub/plugin-cost-management';
58-
import { OrchestratorPage } from '@red-hat-developer-hub/backstage-plugin-orchestrator';
5958
import { useRhdhTheme } from './hooks/useRhdhTheme';
6059
import { githubAuthApiRef } from '@backstage/core-plugin-api';
6160
import { RbacPage } from '@backstage-community/plugin-rbac';
@@ -144,7 +143,6 @@ const routes = (
144143
<Route path="/catalog-graph" element={<CatalogGraphPage />} />
145144
<Route path="/cost-management" element={<ResourceOptimizationPage />} />
146145
<Route path="/cost-management/openshift" element={<OpenShiftPage />} />
147-
<Route path="/orchestrator" element={<OrchestratorPage />} />
148146
<Route path="/rbac" element={<RbacPage />} />
149147
</FlatRoutes>
150148
);

workspaces/cost-management/packages/app/src/components/Root/Root.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ import SearchIcon from '@material-ui/icons/Search';
4444
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
4545
import ChevronRightIcon from '@material-ui/icons/ChevronRight';
4646
import { CostManagementIconOutlined } from '@red-hat-developer-hub/plugin-cost-management';
47-
import { OrchestratorIcon } from '@red-hat-developer-hub/backstage-plugin-orchestrator';
4847
import { useRhdhTheme } from '../../hooks/useRhdhTheme';
4948
import { Administration } from '@backstage-community/plugin-rbac';
5049

@@ -220,12 +219,6 @@ export const Root = ({ children }: PropsWithChildren<{}>) => {
220219
}`}
221220
/>
222221
</CollapsibleSubmenu>
223-
224-
<SidebarItem
225-
icon={OrchestratorIcon}
226-
to="orchestrator"
227-
text="Orchestrator"
228-
/>
229222
</SidebarGroup>
230223
<SidebarSpace />
231224
<SidebarDivider />

workspaces/cost-management/packages/app/src/components/catalog/EntityPage.tsx

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,17 @@ const overviewContent = (
133133
<Grid container spacing={3} alignItems="stretch">
134134
{entityWarningContent}
135135
<Grid item md={6}>
136-
<EntityAboutCard variant="gridItem" />
136+
<EntityAboutCard />
137137
</Grid>
138138
<Grid item md={6} xs={12}>
139-
<EntityCatalogGraphCard variant="gridItem" height={400} />
139+
<EntityCatalogGraphCard height={400} />
140140
</Grid>
141141

142142
<Grid item md={4} xs={12}>
143143
<EntityLinksCard />
144144
</Grid>
145145
<Grid item md={8} xs={12}>
146-
<EntityHasSubcomponentsCard variant="gridItem" />
146+
<EntityHasSubcomponentsCard />
147147
</Grid>
148148
</Grid>
149149
);
@@ -172,10 +172,10 @@ const serviceEntityPage = (
172172
<EntityLayout.Route path="/dependencies" title="Dependencies">
173173
<Grid container spacing={3} alignItems="stretch">
174174
<Grid item md={6}>
175-
<EntityDependsOnComponentsCard variant="gridItem" />
175+
<EntityDependsOnComponentsCard />
176176
</Grid>
177177
<Grid item md={6}>
178-
<EntityDependsOnResourcesCard variant="gridItem" />
178+
<EntityDependsOnResourcesCard />
179179
</Grid>
180180
</Grid>
181181
</EntityLayout.Route>
@@ -199,10 +199,10 @@ const websiteEntityPage = (
199199
<EntityLayout.Route path="/dependencies" title="Dependencies">
200200
<Grid container spacing={3} alignItems="stretch">
201201
<Grid item md={6}>
202-
<EntityDependsOnComponentsCard variant="gridItem" />
202+
<EntityDependsOnComponentsCard />
203203
</Grid>
204204
<Grid item md={6}>
205-
<EntityDependsOnResourcesCard variant="gridItem" />
205+
<EntityDependsOnResourcesCard />
206206
</Grid>
207207
</Grid>
208208
</EntityLayout.Route>
@@ -255,7 +255,7 @@ const apiPage = (
255255
<EntityAboutCard />
256256
</Grid>
257257
<Grid item md={6} xs={12}>
258-
<EntityCatalogGraphCard variant="gridItem" height={400} />
258+
<EntityCatalogGraphCard height={400} />
259259
</Grid>
260260
<Grid item md={4} xs={12}>
261261
<EntityLinksCard />
@@ -287,10 +287,10 @@ const userPage = (
287287
<Grid container spacing={3}>
288288
{entityWarningContent}
289289
<Grid item xs={12} md={6}>
290-
<EntityUserProfileCard variant="gridItem" />
290+
<EntityUserProfileCard />
291291
</Grid>
292292
<Grid item xs={12} md={6}>
293-
<EntityOwnershipCard variant="gridItem" />
293+
<EntityOwnershipCard />
294294
</Grid>
295295
</Grid>
296296
</EntityLayout.Route>
@@ -303,10 +303,10 @@ const groupPage = (
303303
<Grid container spacing={3}>
304304
{entityWarningContent}
305305
<Grid item xs={12} md={6}>
306-
<EntityGroupProfileCard variant="gridItem" />
306+
<EntityGroupProfileCard />
307307
</Grid>
308308
<Grid item xs={12} md={6}>
309-
<EntityOwnershipCard variant="gridItem" />
309+
<EntityOwnershipCard />
310310
</Grid>
311311
<Grid item xs={12} md={6}>
312312
<EntityMembersListCard />
@@ -325,28 +325,27 @@ const systemPage = (
325325
<Grid container spacing={3} alignItems="stretch">
326326
{entityWarningContent}
327327
<Grid item md={6}>
328-
<EntityAboutCard variant="gridItem" />
328+
<EntityAboutCard />
329329
</Grid>
330330
<Grid item md={6} xs={12}>
331-
<EntityCatalogGraphCard variant="gridItem" height={400} />
331+
<EntityCatalogGraphCard height={400} />
332332
</Grid>
333333
<Grid item md={4} xs={12}>
334334
<EntityLinksCard />
335335
</Grid>
336336
<Grid item md={8}>
337-
<EntityHasComponentsCard variant="gridItem" />
337+
<EntityHasComponentsCard />
338338
</Grid>
339339
<Grid item md={6}>
340-
<EntityHasApisCard variant="gridItem" />
340+
<EntityHasApisCard />
341341
</Grid>
342342
<Grid item md={6}>
343-
<EntityHasResourcesCard variant="gridItem" />
343+
<EntityHasResourcesCard />
344344
</Grid>
345345
</Grid>
346346
</EntityLayout.Route>
347347
<EntityLayout.Route path="/diagram" title="Diagram">
348348
<EntityCatalogGraphCard
349-
variant="gridItem"
350349
direction={Direction.TOP_BOTTOM}
351350
title="System Diagram"
352351
height={700}
@@ -372,13 +371,13 @@ const domainPage = (
372371
<Grid container spacing={3} alignItems="stretch">
373372
{entityWarningContent}
374373
<Grid item md={6}>
375-
<EntityAboutCard variant="gridItem" />
374+
<EntityAboutCard />
376375
</Grid>
377376
<Grid item md={6} xs={12}>
378-
<EntityCatalogGraphCard variant="gridItem" height={400} />
377+
<EntityCatalogGraphCard height={400} />
379378
</Grid>
380379
<Grid item md={6}>
381-
<EntityHasSystemsCard variant="gridItem" />
380+
<EntityHasSystemsCard />
382381
</Grid>
383382
</Grid>
384383
</EntityLayout.Route>

0 commit comments

Comments
 (0)