@backstage/plugin-catalog-backend-module-incremental-ingestion 0.5.2 → 0.5.3-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -8
- package/README.md +79 -83
- package/alpha/package.json +1 -1
- package/dist/alpha.d.ts +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,22 +1,36 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-backend-module-incremental-ingestion
|
|
2
2
|
|
|
3
|
-
## 0.5.
|
|
3
|
+
## 0.5.3-next.1
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
7
|
- Updated dependencies
|
|
8
|
-
- @backstage/backend-common@0.
|
|
9
|
-
- @backstage/plugin-catalog-backend@1.25.
|
|
10
|
-
- @backstage/plugin-
|
|
11
|
-
- @backstage/
|
|
12
|
-
- @backstage/
|
|
8
|
+
- @backstage/backend-common@0.25.0-next.1
|
|
9
|
+
- @backstage/plugin-catalog-backend@1.25.3-next.1
|
|
10
|
+
- @backstage/backend-plugin-api@0.9.0-next.1
|
|
11
|
+
- @backstage/catalog-model@1.6.0
|
|
12
|
+
- @backstage/config@1.2.0
|
|
13
|
+
- @backstage/errors@1.2.4
|
|
14
|
+
- @backstage/plugin-catalog-node@1.12.7-next.1
|
|
15
|
+
- @backstage/plugin-events-node@0.4.0-next.1
|
|
16
|
+
- @backstage/plugin-permission-common@0.8.1
|
|
13
17
|
|
|
14
|
-
## 0.5.
|
|
18
|
+
## 0.5.3-next.0
|
|
15
19
|
|
|
16
20
|
### Patch Changes
|
|
17
21
|
|
|
22
|
+
- d425fc4: Modules, plugins, and services are now `BackendFeature`, not a function that returns a feature.
|
|
23
|
+
- 4b28e39: Updated the README to include documentation for the new backend support
|
|
18
24
|
- Updated dependencies
|
|
19
|
-
- @backstage/plugin-
|
|
25
|
+
- @backstage/backend-plugin-api@0.9.0-next.0
|
|
26
|
+
- @backstage/backend-common@0.25.0-next.0
|
|
27
|
+
- @backstage/plugin-catalog-backend@1.25.3-next.0
|
|
28
|
+
- @backstage/plugin-events-node@0.4.0-next.0
|
|
29
|
+
- @backstage/plugin-catalog-node@1.12.7-next.0
|
|
30
|
+
- @backstage/catalog-model@1.6.0
|
|
31
|
+
- @backstage/config@1.2.0
|
|
32
|
+
- @backstage/errors@1.2.4
|
|
33
|
+
- @backstage/plugin-permission-common@0.8.1
|
|
20
34
|
|
|
21
35
|
## 0.5.0
|
|
22
36
|
|
package/README.md
CHANGED
|
@@ -42,57 +42,25 @@ The Incremental Entity Provider backend is designed for data sources that provid
|
|
|
42
42
|
## Installation
|
|
43
43
|
|
|
44
44
|
1. Install `@backstage/plugin-catalog-backend-module-incremental-ingestion` with `yarn --cwd packages/backend add @backstage/plugin-catalog-backend-module-incremental-ingestion` from the Backstage root directory.
|
|
45
|
-
2. In your catalog.ts, import `IncrementalCatalogBuilder` from `@backstage/plugin-catalog-backend-module-incremental-ingestion` and instantiate it with `await IncrementalCatalogBuilder.create(env, builder)`. You have to pass `builder` into `IncrementalCatalogBuilder.create` function because `IncrementalCatalogBuilder` will convert an `IncrementalEntityProvider` into an `EntityProvider` and call `builder.addEntityProvider`.
|
|
46
45
|
|
|
47
|
-
|
|
48
|
-
const builder = CatalogBuilder.create(env);
|
|
49
|
-
// incremental builder receives builder because it'll register
|
|
50
|
-
// incremental entity providers with the builder
|
|
51
|
-
const incrementalBuilder = await IncrementalCatalogBuilder.create(env, builder);
|
|
52
|
-
```
|
|
46
|
+
2. Add the following code to the `packages/backend/src/index.ts` file:
|
|
53
47
|
|
|
54
|
-
|
|
48
|
+
```diff
|
|
49
|
+
+ import { catalogModuleCustomIncrementalIngestionProvider } from './extensions/catalogCustomIncrementalIngestion';
|
|
55
50
|
|
|
56
|
-
```ts
|
|
57
|
-
// Must be run first to ensure CatalogBuilder database migrations run before Incremental Entity Provider database migrations
|
|
58
|
-
const { processingEngine, router } = await builder.build();
|
|
59
51
|
|
|
60
|
-
|
|
61
|
-
const { incrementalAdminRouter } = await incrementBuilder.build();
|
|
62
|
-
```
|
|
52
|
+
const backend = createBackend();
|
|
63
53
|
|
|
64
|
-
|
|
54
|
+
+ backend.add(
|
|
55
|
+
+ import(
|
|
56
|
+
+ '@backstage/plugin-catalog-backend-module-incremental-ingestion/alpha'
|
|
57
|
+
+ ),
|
|
58
|
+
+ );
|
|
65
59
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
import { Router } from 'express';
|
|
71
|
-
import { Duration } from 'luxon';
|
|
72
|
-
import { PluginEnvironment } from '../types';
|
|
73
|
-
|
|
74
|
-
export default async function createPlugin(
|
|
75
|
-
env: PluginEnvironment,
|
|
76
|
-
): Promise<Router> {
|
|
77
|
-
const builder = CatalogBuilder.create(env);
|
|
78
|
-
// incremental builder receives builder because it'll register
|
|
79
|
-
// incremental entity providers with the builder
|
|
80
|
-
const incrementalBuilder = await IncrementalCatalogBuilder.create(
|
|
81
|
-
env,
|
|
82
|
-
builder,
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
builder.addProcessor(new ScaffolderEntitiesProcessor());
|
|
86
|
-
|
|
87
|
-
const { processingEngine, router } = await builder.build();
|
|
88
|
-
const { incrementalAdminRouter } = await incrementalBuilder.build();
|
|
89
|
-
|
|
90
|
-
router.use(incrementalAdminRouter);
|
|
91
|
-
|
|
92
|
-
await processingEngine.start();
|
|
93
|
-
|
|
94
|
-
return router;
|
|
95
|
-
}
|
|
60
|
+
// We have created this in section **Adding an Incremental Entity Provider to the catalog**
|
|
61
|
+
+ backend.add(catalogModuleCustomIncrementalIngestionProvider);
|
|
62
|
+
|
|
63
|
+
backend.start();
|
|
96
64
|
```
|
|
97
65
|
|
|
98
66
|
## Administrative Routes
|
|
@@ -116,7 +84,7 @@ In all cases, `:provider` is the name of the incremental entity provider.
|
|
|
116
84
|
|
|
117
85
|
## Writing an Incremental Entity Provider
|
|
118
86
|
|
|
119
|
-
To create an Incremental Entity Provider, you need to know how to retrieve a single page of the data that you wish to ingest into the Backstage catalog. If the API has pagination and you know how to make a paginated request to that API, you'll be able to implement an Incremental Entity Provider for this API. For more information about compatibility, check out the
|
|
87
|
+
To create an Incremental Entity Provider, you need to know how to retrieve a single page of the data that you wish to ingest into the Backstage catalog. If the API has pagination and you know how to make a paginated request to that API, you'll be able to implement an Incremental Entity Provider for this API. For more information about compatibility, check out the [requirements](#requirements) section of this page.
|
|
120
88
|
|
|
121
89
|
Here is the type definition for an Incremental Entity Provider.
|
|
122
90
|
|
|
@@ -309,45 +277,73 @@ Now that you have your new Incremental Entity Provider, we can connect it to the
|
|
|
309
277
|
|
|
310
278
|
## Adding an Incremental Entity Provider to the catalog
|
|
311
279
|
|
|
312
|
-
We'll assume you followed the
|
|
280
|
+
We'll assume you followed the [Installation](#installation) instructions. Now create a module inside `packages/backend/src/extensions/catalogCustomIncrementalIngestion.ts`.
|
|
313
281
|
|
|
314
282
|
```ts
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
283
|
+
import {
|
|
284
|
+
coreServices,
|
|
285
|
+
createBackendModule,
|
|
286
|
+
} from '@backstage/backend-plugin-api';
|
|
287
|
+
import { incrementalIngestionProvidersExtensionPoint } from '@backstage/plugin-catalog-backend-module-incremental-ingestion/alpha';
|
|
288
|
+
|
|
289
|
+
export const catalogModuleCustomIncrementalIngestionProvider =
|
|
290
|
+
createBackendModule({
|
|
291
|
+
pluginId: 'catalog',
|
|
292
|
+
moduleId: 'custom-incremental-ingestion-provider',
|
|
293
|
+
register(env) {
|
|
294
|
+
env.registerInit({
|
|
295
|
+
deps: {
|
|
296
|
+
incrementalBuilder: incrementalIngestionProvidersExtensionPoint,
|
|
297
|
+
config: coreServices.rootConfig,
|
|
298
|
+
},
|
|
299
|
+
async init({ incrementalBuilder, config }) {
|
|
300
|
+
// Assuming the token for the API comes from config
|
|
301
|
+
const token = config.getString('myApiClient.token');
|
|
302
|
+
const myEntityProvider = new MyIncrementalEntityProvider(token);
|
|
303
|
+
|
|
304
|
+
const options = {
|
|
305
|
+
// How long should it attempt to read pages from the API in a
|
|
306
|
+
// single burst? Keep this short. The Incremental Entity Provider
|
|
307
|
+
// will attempt to read as many pages as it can in this time
|
|
308
|
+
burstLength: { seconds: 3 },
|
|
309
|
+
|
|
310
|
+
// How long should it wait between bursts?
|
|
311
|
+
burstInterval: { seconds: 3 },
|
|
312
|
+
|
|
313
|
+
// How long should it rest before re-ingesting again?
|
|
314
|
+
restLength: { day: 1 },
|
|
315
|
+
|
|
316
|
+
// Optional back-off configuration - how long should it wait to retry
|
|
317
|
+
// in the event of an error?
|
|
318
|
+
backoff: [
|
|
319
|
+
{ seconds: 5 },
|
|
320
|
+
{ seconds: 30 },
|
|
321
|
+
{ minutes: 10 },
|
|
322
|
+
{ hours: 3 },
|
|
323
|
+
],
|
|
324
|
+
|
|
325
|
+
// Optional. Use this to prevent removal of entities above a given
|
|
326
|
+
// percentage. This can be helpful if a data source is flaky and
|
|
327
|
+
// sometimes returns a successful status, but fewer than expected
|
|
328
|
+
// assets to add or maintain in the catalog.
|
|
329
|
+
rejectRemovalsAbovePercentage: 5,
|
|
330
|
+
|
|
331
|
+
// Optional. Similar to rejectRemovalsAbovePercentage, except it
|
|
332
|
+
// applies to complete, 100% failure of a data source. If true,
|
|
333
|
+
// a data source that returns a successful status but does not
|
|
334
|
+
// provide any assets to turn into entities will have its empty
|
|
335
|
+
// data set rejected.
|
|
336
|
+
rejectEmptySourceCollections: true,
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
incrementalBuilder.addProvider({
|
|
340
|
+
provider: myEntityProvider,
|
|
341
|
+
options,
|
|
342
|
+
});
|
|
343
|
+
},
|
|
344
|
+
});
|
|
345
|
+
},
|
|
346
|
+
});
|
|
351
347
|
```
|
|
352
348
|
|
|
353
349
|
That's it!!!
|
package/alpha/package.json
CHANGED
package/dist/alpha.d.ts
CHANGED
|
@@ -52,6 +52,6 @@ declare const incrementalIngestionProvidersExtensionPoint: _backstage_backend_pl
|
|
|
52
52
|
*
|
|
53
53
|
* @alpha
|
|
54
54
|
*/
|
|
55
|
-
declare const catalogModuleIncrementalIngestionEntityProvider: _backstage_backend_plugin_api.
|
|
55
|
+
declare const catalogModuleIncrementalIngestionEntityProvider: _backstage_backend_plugin_api.BackendFeature;
|
|
56
56
|
|
|
57
57
|
export { type IncrementalIngestionProviderExtensionPoint, catalogModuleIncrementalIngestionEntityProvider as default, incrementalIngestionProvidersExtensionPoint };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-catalog-backend-module-incremental-ingestion",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3-next.1",
|
|
4
4
|
"description": "An entity provider for streaming large asset sources into the catalog",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin-module",
|
|
@@ -50,14 +50,14 @@
|
|
|
50
50
|
"test": "backstage-cli package test"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@backstage/backend-common": "^0.
|
|
54
|
-
"@backstage/backend-plugin-api": "^0.
|
|
53
|
+
"@backstage/backend-common": "^0.25.0-next.1",
|
|
54
|
+
"@backstage/backend-plugin-api": "^0.9.0-next.1",
|
|
55
55
|
"@backstage/catalog-model": "^1.6.0",
|
|
56
56
|
"@backstage/config": "^1.2.0",
|
|
57
57
|
"@backstage/errors": "^1.2.4",
|
|
58
|
-
"@backstage/plugin-catalog-backend": "^1.25.
|
|
59
|
-
"@backstage/plugin-catalog-node": "^1.12.
|
|
60
|
-
"@backstage/plugin-events-node": "^0.
|
|
58
|
+
"@backstage/plugin-catalog-backend": "^1.25.3-next.1",
|
|
59
|
+
"@backstage/plugin-catalog-node": "^1.12.7-next.1",
|
|
60
|
+
"@backstage/plugin-events-node": "^0.4.0-next.1",
|
|
61
61
|
"@backstage/plugin-permission-common": "^0.8.1",
|
|
62
62
|
"@types/express": "^4.17.6",
|
|
63
63
|
"@types/luxon": "^3.0.0",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"uuid": "^9.0.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@backstage/backend-defaults": "^0.
|
|
72
|
-
"@backstage/backend-test-utils": "^0.
|
|
73
|
-
"@backstage/cli": "^0.27.
|
|
71
|
+
"@backstage/backend-defaults": "^0.5.0-next.1",
|
|
72
|
+
"@backstage/backend-test-utils": "^0.6.0-next.1",
|
|
73
|
+
"@backstage/cli": "^0.27.1-next.1"
|
|
74
74
|
}
|
|
75
75
|
}
|