fix!: fix event support for Bitbucket Cloud
Fixes the event-based updates at `BitbucketCloudEntityProvider`. Previously, this entity provider had optional event support for legacy backends that could be enabled by passing `catalogApi`, `events`, and `tokenManager`. For the new/current backend system, the `catalogModuleBitbucketCloudEntityProvider` (`catalog.bitbucket-cloud-entity-provider`), event support was enabled by default. A recent change removed `tokenManager` as a dependency from the module as well as removed it as input. While this didn't break the instantiation of the module, it broke the event-based updates and led to a runtime misbehavior, accompanied by an info log message. This change will replace the use of `tokenManager` with the use of `auth` (`AuthService`). Additionally, it will make `catalogApi` and `events` required dependencies. For the current backend system, this change is transparent and doesn't require any action. For the legacy backend system, this change will require you to pass those dependencies if you didn't do it already. **BREAKING CHANGES:** > _(For legacy backend users only.)_ > > Previously optional `catalogApi`, and `events` are required now. > A new required dependency `auth` was added. Fixes: #26925 Relates-to: PR #26141 Signed-off-by: Patrick Jungermann <Patrick.Jungermann@gmail.com>
This commit is contained in:
@@ -51,33 +51,6 @@ Further documentation:
|
||||
|
||||
### Installation with Legacy Backend System
|
||||
|
||||
#### Installation without Events Support
|
||||
|
||||
And then add the entity provider to your catalog builder:
|
||||
|
||||
```ts title="packages/backend/src/plugins/catalog.ts"
|
||||
/* highlight-add-next-line */
|
||||
import { BitbucketCloudEntityProvider } from '@backstage/plugin-catalog-backend-module-bitbucket-cloud';
|
||||
|
||||
export default async function createPlugin(
|
||||
env: PluginEnvironment,
|
||||
): Promise<Router> {
|
||||
const builder = await CatalogBuilder.create(env);
|
||||
/* highlight-add-start */
|
||||
builder.addEntityProvider(
|
||||
BitbucketCloudEntityProvider.fromConfig(env.config, {
|
||||
logger: env.logger,
|
||||
scheduler: env.scheduler,
|
||||
}),
|
||||
);
|
||||
/* highlight-add-end */
|
||||
|
||||
// ..
|
||||
}
|
||||
```
|
||||
|
||||
#### Installation with Events Support
|
||||
|
||||
Please follow the installation instructions at
|
||||
|
||||
- <https://github.com/backstage/backstage/tree/master/plugins/events-backend/README.md>
|
||||
@@ -104,19 +77,17 @@ export default async function createPlugin(
|
||||
env: PluginEnvironment,
|
||||
): Promise<Router> {
|
||||
const builder = await CatalogBuilder.create(env);
|
||||
builder.addProcessor(new ScaffolderEntitiesProcessor());
|
||||
/* highlight-add-start */
|
||||
const bitbucketCloudProvider = BitbucketCloudEntityProvider.fromConfig(
|
||||
env.config,
|
||||
{
|
||||
auth: env.auth,
|
||||
catalogApi: new CatalogClient({ discoveryApi: env.discovery }),
|
||||
events: env.events,
|
||||
logger: env.logger,
|
||||
scheduler: env.scheduler,
|
||||
tokenManager: env.tokenManager,
|
||||
},
|
||||
);
|
||||
env.eventBroker.subscribe(bitbucketCloudProvider);
|
||||
builder.addEntityProvider(bitbucketCloudProvider);
|
||||
/* highlight-add-end */
|
||||
const { processingEngine, router } = await builder.build();
|
||||
|
||||
Reference in New Issue
Block a user