feat(events,github): add support for EventsService, events at new backend

Adds optional support for the EventsService passed
as argument to the factory method.

For the new backend, the EventsService is used as dependency and passed on.
Events support will be active always.

The support for the deprecated EventBroker and its interfaces was kept for
easier migration and will be removed as a separate follow-up change that
could go into a following release.

Signed-off-by: Patrick Jungermann <Patrick.Jungermann@gmail.com>
This commit is contained in:
Patrick Jungermann
2024-03-18 13:08:41 +01:00
parent 0c06b91a73
commit bcf55d5ba2
5 changed files with 68 additions and 4 deletions
+21 -1
View File
@@ -51,6 +51,26 @@ export default async function createPlugin(
## Installation with Events Support
_For the legacy backend system, please read the sub-section below._
The catalog module for GitHub comes with events support enabled.
This will make it subscribe to its relevant topics (`github.push`)
and expects these events to be published via the `EventsService`.
Additionally, you should install the
[event router by `events-backend-module-github`](https://github.com/backstage/backstage/tree/master/plugins/events-backend-module-github/README.md)
which will route received events from the generic topic `github` to more specific ones
based on the event type (e.g., `github.push`).
In order to receive Webhook events by GitHub, you have to decide how you want them
to be ingested into Backstage and published to its `EventsService`.
You can decide between the following options (extensible):
- [via HTTP endpoint](https://github.com/backstage/backstage/tree/master/plugins/events-backend/README.md)
- [via an AWS SQS queue](https://github.com/backstage/backstage/tree/master/plugins/events-backend-module-aws-sqs/README.md)
### Legacy Backend System
Please follow the installation instructions at
- <https://github.com/backstage/backstage/tree/master/plugins/events-backend/README.md>
@@ -78,10 +98,10 @@ export default async function createPlugin(
builder.addProcessor(new ScaffolderEntitiesProcessor());
/* highlight-add-start */
const githubProvider = GithubEntityProvider.fromConfig(env.config, {
events: env.events,
logger: env.logger,
scheduler: env.scheduler,
});
env.eventBroker.subscribe(githubProvider);
builder.addEntityProvider(githubProvider);
/* highlight-add-end */
const { processingEngine, router } = await builder.build();