Add changesets
Co-authored-by: Fredrik Adelöw <freben@gmail.com> Co-authored-by: blam<ben@blam.sh> Co-authored-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
---
|
||||
'@backstage/plugin-scaffolder': patch
|
||||
'@backstage/plugin-scaffolder-backend': minor
|
||||
---
|
||||
|
||||
# Stateless scaffolding
|
||||
|
||||
The scaffolder has been redesigned to be horizontally scalable and to persistently store task state and execution logs in the database.
|
||||
|
||||
Each scaffolder task is given a unique task ID which is persisted in the database.
|
||||
Tasks are then picked up by a `TaskWorker` which performs the scaffolding steps.
|
||||
Execution logs are also peristed in the database meaning you can now refresh the scaffolder task status page without losing information.
|
||||
|
||||
The task status page is now dynamically created based on the step information stored in the database.
|
||||
This allows for custom steps to be displayed once the next version of the scaffolder template schema is available.
|
||||
|
||||
The task page is updated to display links to both the git repository and to the newly created catalog entity.
|
||||
|
||||
Component registration has moved from the frontend into a separate registration step executed by the `TaskWorker`. This requires that a `CatalogClient` is passed to the scaffoler backend instead of the old `CatalogEntityClient`.
|
||||
|
||||
Make sure to update `plugins/scaffolder.ts`
|
||||
|
||||
```diff
|
||||
import {
|
||||
CookieCutter,
|
||||
createRouter,
|
||||
Preparers,
|
||||
Publishers,
|
||||
CreateReactAppTemplater,
|
||||
Templaters,
|
||||
- CatalogEntityClient,
|
||||
} from '@backstage/plugin-scaffolder-backend';
|
||||
|
||||
+import { CatalogClient } from '@backstage/catalog-client';
|
||||
|
||||
const discovery = SingleHostDiscovery.fromConfig(config);
|
||||
-const entityClient = new CatalogEntityClient({ discovery });
|
||||
+const catalogClient = new CatalogClient({ discoveryApi: discovery })
|
||||
|
||||
return await createRouter({
|
||||
preparers,
|
||||
templaters,
|
||||
publishers,
|
||||
logger,
|
||||
config,
|
||||
dockerClient,
|
||||
- entityClient,
|
||||
database,
|
||||
+ catalogClient,
|
||||
});
|
||||
```
|
||||
|
||||
As well as adding the `@backstage/catalog-client` packages as a dependency of your backend package.
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
'@backstage/plugin-catalog': minor
|
||||
'@backstage/plugin-scaffolder': minor
|
||||
---
|
||||
|
||||
The Scaffolder and Catalog plugins have been migrated to partially require use of the [new composability API](https://backstage.io/docs/plugins/composability). The Scaffolder used to register its pages using the deprecated route registration plugin API, but those registrations have been removed. This means you now need to add the Scaffolder plugin page to the app directly.
|
||||
|
||||
The page is imported from the Scaffolder plugin and added to the `<FlatRoutes>` component:
|
||||
|
||||
```tsx
|
||||
<Route path="/create" element={<ScaffolderPage />} />
|
||||
```
|
||||
|
||||
You can choose your own paths if you wish, as long as the `templateName` and `taskId` parameters are present.
|
||||
|
||||
The Catalog plugin has also been migrated to use an [external route reference](https://backstage.io/docs/plugins/composability#binding-external-routes-in-the-app) to dynamically link to the create component page. This means you need to migrate the catalog plugin to use the new extension components, as well as bind the external route.
|
||||
|
||||
To use the new extension components, replace existing usage of the `CatalogRouter` with the following:
|
||||
|
||||
```tsx
|
||||
<Route path="/catalog" element={<CatalogIndexPage />} />
|
||||
<Route path="/catalog/:namespace/:kind/:name" element={<CatalogEntityPage />}>
|
||||
<EntityPage />
|
||||
</Route>
|
||||
```
|
||||
|
||||
And to bind the external route from the catalog plugin to the scaffolder template index page, make sure you have the appropriate imports and add the following to the `createApp` call:
|
||||
|
||||
```ts
|
||||
import { catalogPlugin } from '@backstage/plugin-catalog';
|
||||
import { scaffolderPlugin } from '@backstage/plugin-scaffolder';
|
||||
|
||||
const app = createApp({
|
||||
// ...
|
||||
bindRoutes({ bind }) {
|
||||
bind(catalogPlugin.externalRoutes, {
|
||||
createComponent: scaffolderPlugin.routes.root,
|
||||
});
|
||||
},
|
||||
});
|
||||
```
|
||||
Reference in New Issue
Block a user