Merge pull request #9489 from backstage/freben/processor-integrations
catalog-backend: use `ScmIntegrationRegistry` interface properly
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-backend': patch
|
||||
---
|
||||
|
||||
The following processors now properly accept an `ScmIntegrationRegistry` (an
|
||||
interface) instead of an `ScmIntegrations` (which is a concrete class).
|
||||
|
||||
- `AzureDevOpsDiscoveryProcessor`
|
||||
- `CodeOwnersProcessor`
|
||||
- `GitLabDiscoveryProcessor`
|
||||
- `GithubDiscoveryProcessor`
|
||||
- `GithubMultiOrgReaderProcessor`
|
||||
- `GithubOrgReaderProcessor`
|
||||
@@ -36,7 +36,6 @@ import { PluginEndpointDiscovery } from '@backstage/backend-common';
|
||||
import { ResourceEntityV1alpha1 } from '@backstage/catalog-model';
|
||||
import { Router } from 'express';
|
||||
import { ScmIntegrationRegistry } from '@backstage/integration';
|
||||
import { ScmIntegrations } from '@backstage/integration';
|
||||
import { TokenManager } from '@backstage/backend-common';
|
||||
import { UrlReader } from '@backstage/backend-common';
|
||||
import { Validators } from '@backstage/catalog-model';
|
||||
@@ -177,7 +176,10 @@ export class AwsS3DiscoveryProcessor implements CatalogProcessor {
|
||||
//
|
||||
// @public
|
||||
export class AzureDevOpsDiscoveryProcessor implements CatalogProcessor {
|
||||
constructor(options: { integrations: ScmIntegrations; logger: Logger_2 });
|
||||
constructor(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
logger: Logger_2;
|
||||
});
|
||||
// (undocumented)
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
@@ -464,7 +466,7 @@ export type CatalogRulesEnforcer = {
|
||||
// @public (undocumented)
|
||||
export class CodeOwnersProcessor implements CatalogProcessor {
|
||||
constructor(options: {
|
||||
integrations: ScmIntegrations;
|
||||
integrations: ScmIntegrationRegistry;
|
||||
logger: Logger_2;
|
||||
reader: UrlReader;
|
||||
});
|
||||
@@ -750,7 +752,7 @@ function generalError(
|
||||
// @public
|
||||
export class GithubDiscoveryProcessor implements CatalogProcessor {
|
||||
constructor(options: {
|
||||
integrations: ScmIntegrations;
|
||||
integrations: ScmIntegrationRegistry;
|
||||
logger: Logger_2;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
});
|
||||
@@ -773,7 +775,7 @@ export class GithubDiscoveryProcessor implements CatalogProcessor {
|
||||
// @alpha
|
||||
export class GithubMultiOrgReaderProcessor implements CatalogProcessor {
|
||||
constructor(options: {
|
||||
integrations: ScmIntegrations;
|
||||
integrations: ScmIntegrationRegistry;
|
||||
logger: Logger_2;
|
||||
orgs: GithubMultiOrgConfig;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
@@ -828,7 +830,7 @@ export class GitHubOrgEntityProvider implements EntityProvider {
|
||||
// @public
|
||||
export class GithubOrgReaderProcessor implements CatalogProcessor {
|
||||
constructor(options: {
|
||||
integrations: ScmIntegrations;
|
||||
integrations: ScmIntegrationRegistry;
|
||||
logger: Logger_2;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
});
|
||||
|
||||
@@ -16,7 +16,10 @@
|
||||
|
||||
import { LocationSpec } from '@backstage/catalog-model';
|
||||
import { Config } from '@backstage/config';
|
||||
import { ScmIntegrations } from '@backstage/integration';
|
||||
import {
|
||||
ScmIntegrationRegistry,
|
||||
ScmIntegrations,
|
||||
} from '@backstage/integration';
|
||||
import { Logger } from 'winston';
|
||||
import * as results from './results';
|
||||
import { CatalogProcessor, CatalogProcessorEmit } from './types';
|
||||
@@ -37,7 +40,7 @@ import { codeSearch } from './azure';
|
||||
* target: https://dev.azure.com/org/project/_git/repo
|
||||
**/
|
||||
export class AzureDevOpsDiscoveryProcessor implements CatalogProcessor {
|
||||
private readonly integrations: ScmIntegrations;
|
||||
private readonly integrations: ScmIntegrationRegistry;
|
||||
private readonly logger: Logger;
|
||||
|
||||
static fromConfig(config: Config, options: { logger: Logger }) {
|
||||
@@ -49,7 +52,10 @@ export class AzureDevOpsDiscoveryProcessor implements CatalogProcessor {
|
||||
});
|
||||
}
|
||||
|
||||
constructor(options: { integrations: ScmIntegrations; logger: Logger }) {
|
||||
constructor(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
logger: Logger;
|
||||
}) {
|
||||
this.integrations = options.integrations;
|
||||
this.logger = options.logger;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,10 @@
|
||||
import { UrlReader } from '@backstage/backend-common';
|
||||
import { Entity, LocationSpec } from '@backstage/catalog-model';
|
||||
import { Config } from '@backstage/config';
|
||||
import { ScmIntegrations } from '@backstage/integration';
|
||||
import {
|
||||
ScmIntegrationRegistry,
|
||||
ScmIntegrations,
|
||||
} from '@backstage/integration';
|
||||
import { Logger } from 'winston';
|
||||
import { findCodeOwnerByTarget } from './codeowners';
|
||||
import { CatalogProcessor } from './types';
|
||||
@@ -35,7 +38,7 @@ const ALLOWED_LOCATION_TYPES = [
|
||||
];
|
||||
|
||||
export class CodeOwnersProcessor implements CatalogProcessor {
|
||||
private readonly integrations: ScmIntegrations;
|
||||
private readonly integrations: ScmIntegrationRegistry;
|
||||
private readonly logger: Logger;
|
||||
private readonly reader: UrlReader;
|
||||
|
||||
@@ -52,7 +55,7 @@ export class CodeOwnersProcessor implements CatalogProcessor {
|
||||
}
|
||||
|
||||
constructor(options: {
|
||||
integrations: ScmIntegrations;
|
||||
integrations: ScmIntegrationRegistry;
|
||||
logger: Logger;
|
||||
reader: UrlReader;
|
||||
}) {
|
||||
|
||||
@@ -16,7 +16,10 @@
|
||||
|
||||
import { LocationSpec } from '@backstage/catalog-model';
|
||||
import { Config } from '@backstage/config';
|
||||
import { ScmIntegrations } from '@backstage/integration';
|
||||
import {
|
||||
ScmIntegrationRegistry,
|
||||
ScmIntegrations,
|
||||
} from '@backstage/integration';
|
||||
import { Logger } from 'winston';
|
||||
import * as results from './results';
|
||||
import { CatalogProcessor, CatalogProcessorEmit } from './types';
|
||||
@@ -31,7 +34,7 @@ import {
|
||||
* Extracts repositories out of an GitLab instance.
|
||||
*/
|
||||
export class GitLabDiscoveryProcessor implements CatalogProcessor {
|
||||
private readonly integrations: ScmIntegrations;
|
||||
private readonly integrations: ScmIntegrationRegistry;
|
||||
private readonly logger: Logger;
|
||||
private readonly cache: CacheClient;
|
||||
|
||||
@@ -48,7 +51,7 @@ export class GitLabDiscoveryProcessor implements CatalogProcessor {
|
||||
}
|
||||
|
||||
private constructor(options: {
|
||||
integrations: ScmIntegrations;
|
||||
integrations: ScmIntegrationRegistry;
|
||||
pluginCache: PluginCacheManager;
|
||||
logger: Logger;
|
||||
}) {
|
||||
|
||||
@@ -19,6 +19,7 @@ import { Config } from '@backstage/config';
|
||||
import {
|
||||
DefaultGithubCredentialsProvider,
|
||||
GithubCredentialsProvider,
|
||||
ScmIntegrationRegistry,
|
||||
ScmIntegrations,
|
||||
} from '@backstage/integration';
|
||||
import { graphql } from '@octokit/graphql';
|
||||
@@ -42,7 +43,7 @@ import { CatalogProcessor, CatalogProcessorEmit } from './types';
|
||||
* target: https://github.com/backstage/*\/blob/main/catalog-info.yaml
|
||||
**/
|
||||
export class GithubDiscoveryProcessor implements CatalogProcessor {
|
||||
private readonly integrations: ScmIntegrations;
|
||||
private readonly integrations: ScmIntegrationRegistry;
|
||||
private readonly logger: Logger;
|
||||
private readonly githubCredentialsProvider: GithubCredentialsProvider;
|
||||
|
||||
@@ -62,7 +63,7 @@ export class GithubDiscoveryProcessor implements CatalogProcessor {
|
||||
}
|
||||
|
||||
constructor(options: {
|
||||
integrations: ScmIntegrations;
|
||||
integrations: ScmIntegrationRegistry;
|
||||
logger: Logger;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
}) {
|
||||
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
GithubAppCredentialsMux,
|
||||
GithubCredentialsProvider,
|
||||
GitHubIntegrationConfig,
|
||||
ScmIntegrationRegistry,
|
||||
ScmIntegrations,
|
||||
} from '@backstage/integration';
|
||||
import { graphql } from '@octokit/graphql';
|
||||
@@ -42,7 +43,7 @@ import { buildOrgHierarchy } from './util/org';
|
||||
* Be aware that this processor may not be compatible with future org structures in the catalog.
|
||||
*/
|
||||
export class GithubMultiOrgReaderProcessor implements CatalogProcessor {
|
||||
private readonly integrations: ScmIntegrations;
|
||||
private readonly integrations: ScmIntegrationRegistry;
|
||||
private readonly orgs: GithubMultiOrgConfig;
|
||||
private readonly logger: Logger;
|
||||
private readonly githubCredentialsProvider: GithubCredentialsProvider;
|
||||
@@ -65,7 +66,7 @@ export class GithubMultiOrgReaderProcessor implements CatalogProcessor {
|
||||
}
|
||||
|
||||
constructor(options: {
|
||||
integrations: ScmIntegrations;
|
||||
integrations: ScmIntegrationRegistry;
|
||||
logger: Logger;
|
||||
orgs: GithubMultiOrgConfig;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
|
||||
@@ -18,6 +18,7 @@ import { LocationSpec } from '@backstage/catalog-model';
|
||||
import { Config } from '@backstage/config';
|
||||
import {
|
||||
GithubCredentialType,
|
||||
ScmIntegrationRegistry,
|
||||
ScmIntegrations,
|
||||
GithubCredentialsProvider,
|
||||
DefaultGithubCredentialsProvider,
|
||||
@@ -39,7 +40,7 @@ type GraphQL = typeof graphql;
|
||||
* Extracts teams and users out of a GitHub org.
|
||||
*/
|
||||
export class GithubOrgReaderProcessor implements CatalogProcessor {
|
||||
private readonly integrations: ScmIntegrations;
|
||||
private readonly integrations: ScmIntegrationRegistry;
|
||||
private readonly logger: Logger;
|
||||
private readonly githubCredentialsProvider: GithubCredentialsProvider;
|
||||
|
||||
@@ -59,7 +60,7 @@ export class GithubOrgReaderProcessor implements CatalogProcessor {
|
||||
}
|
||||
|
||||
constructor(options: {
|
||||
integrations: ScmIntegrations;
|
||||
integrations: ScmIntegrationRegistry;
|
||||
logger: Logger;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
}) {
|
||||
|
||||
Reference in New Issue
Block a user