move out bitbucket into a separate module too

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2022-03-09 17:07:43 +01:00
parent 0dd12e3f35
commit 47a5ae5dd2
22 changed files with 218 additions and 85 deletions
+32 -7
View File
@@ -11,6 +11,34 @@ catalog entities located in Bitbucket. The processor will crawl your Bitbucket
account and register entities matching the configured path. This can be useful
as an alternative to static locations or manually adding things to the catalog.
## Installation
You will have to add the processor in the catalog initialization code of your
backend. The provider is not installed by default, therefore you have to add a
dependency to `@backstage/plugin-catalog-backend-module-bitbucket` to your backend
package.
```bash
# From your Backstage root directory
cd packages/backend
yarn add @backstage/plugin-catalog-backend-module-bitbucket
```
And then add the processor to your catalog builder:
```diff
// In packages/backend/src/plugins/catalog.ts
+import { BitbucketDiscoveryProcessor } from '@backstage/plugin-catalog-backend-module-bitbucket';
export default async function createPlugin(
env: PluginEnvironment,
): Promise<Router> {
const builder = await CatalogBuilder.create(env);
+ builder.addProcessor(
+ BitbucketDiscoveryProcessor.fromConfig(env.config, { logger: env.logger })
+ );
```
## Self-hosted Bitbucket Server
To use the discovery processor with a self-hosted Bitbucket Server, you'll need
@@ -137,14 +165,11 @@ matching repository is processed.
repository.
```typescript
const customRepositoryParser: BitbucketRepositoryParser =
async function* customRepositoryParser({ client, repository }) {
// Custom logic for interpret the matching repository.
// See defaultRepositoryParser for an example
};
const processor = BitbucketDiscoveryProcessor.fromConfig(env.config, {
parser: customRepositoryParser,
parser: async function* customRepositoryParser({ client, repository }) {
// Custom logic for interpreting the matching repository.
// See defaultRepositoryParser for an example
},
logger: env.logger,
});
```