From ddaff02d11154ae4e8a5432f675489b92c0277e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20A=CC=8Ahsberg?= Date: Fri, 26 Mar 2021 23:23:28 +0000 Subject: [PATCH] Add documentation for Bitbucket Discovery processor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathias Åhsberg --- docs/integrations/bitbucket/discovery.md | 43 +++++++++++++++++++ .../processors/BitbucketDiscoveryProcessor.ts | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 docs/integrations/bitbucket/discovery.md diff --git a/docs/integrations/bitbucket/discovery.md b/docs/integrations/bitbucket/discovery.md new file mode 100644 index 0000000000..093dc82adc --- /dev/null +++ b/docs/integrations/bitbucket/discovery.md @@ -0,0 +1,43 @@ +--- +id: discovery +title: Bitbucket Server Discovery +sidebar_label: Discovery +description: + Automatically discovering catalog entities from repositories in a Bitbucket + Server instance +--- + +The Bitbucket integration has a special discovery processor for discovering +catalog entities within a Bitbucket Server instance. The processor will crawl +the Bitbucket Server instance and register entities matching the configured +path. This can be useful as an alternative to static locations or manually +adding things to the catalog. + +> Note: The Bitbucket Discovery Processor currently only supports a self-hosted +> Bitbucket Server, and not the hosted Bitbucket Cloud product. + +To use the discovery processor, you'll need a Bitbucket integration +[set up](locations.md) with a `BITBUCKET_TOKEN`. Then you can add a location +target to the catalog configuration: + +```yaml +catalog: + locations: + - type: bitbucket-discovery + target: https://bitbucket.mycompany.com/projects/my-project/repos/service-*/catalog-info.yaml +``` + +Note the `bitbucket-discovery` type, as this is not a regular `url` processor. + +The target is composed of four parts: + +- The base instance URL, `https://bitbucket.mycompany.com` in this case +- The project key to scan, which accepts \* wildcard tokens. This can simply be + `*` to scan repositories from all projects. This example only scans for + repositories in the `my-project` project. +- The repository blob to scan, which accepts \* wildcard tokens. This can simply + be `*` to scan all repositories in the organization. This example only looks + for repositories prefixed with `service-`. +- The path within each repository to find the catalog YAML file. This will + usually be `/catalog-info.yaml` or a similar variation for catalog files + stored in the root directory of each repository. diff --git a/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.ts b/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.ts index 9c3f9e03b3..15e51b6f9f 100644 --- a/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.ts +++ b/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.ts @@ -130,7 +130,7 @@ function parseUrl( const url = new URL(urlString); const path = url.pathname.substr(1).split('/'); - // /backstage/techdocs-*/blob/master/catalog-info.yaml + // /projects/backstage/repos/techdocs-*/catalog-info.yaml if (path.length > 3 && path[1].length && path[3].length) { return { projectSearchPath: escapeRegExp(decodeURIComponent(path[1])),