Merge branch 'backstage:master' into master
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
---
|
||||
'@backstage/plugin-search-backend-module-pg': patch
|
||||
---
|
||||
|
||||
Enable module only on supported databases
|
||||
|
||||
Also pass logger to the service
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-kubernetes-react': patch
|
||||
---
|
||||
|
||||
Added the `no-top-level-material-ui-4-imports` ESLint rule to aid with the migration to Material UI v5
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'@backstage/plugin-kubernetes-backend': minor
|
||||
'@backstage/plugin-tech-insights-node': minor
|
||||
---
|
||||
|
||||
**BREAKING** Winston logger has been replaced with `LoggerService`
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
'@backstage/plugin-search-backend-module-stack-overflow-collator': patch
|
||||
'@backstage/plugin-catalog-backend-module-incremental-ingestion': patch
|
||||
'@backstage/plugin-catalog-backend-module-bitbucket-server': patch
|
||||
'@backstage/plugin-tech-insights-backend-module-jsonfc': patch
|
||||
'@backstage/plugin-catalog-backend-module-github-org': patch
|
||||
'@backstage/plugin-scaffolder-backend-module-github': patch
|
||||
'@backstage/plugin-catalog-backend-module-puppetdb': patch
|
||||
'@backstage/plugin-catalog-backend-module-msgraph': patch
|
||||
'@backstage/plugin-search-backend-module-techdocs': patch
|
||||
'@backstage/plugin-catalog-backend-module-gerrit': patch
|
||||
'@backstage/plugin-catalog-backend-module-github': patch
|
||||
'@backstage/plugin-catalog-backend-module-gitlab': patch
|
||||
'@backstage/plugin-search-backend-module-explore': patch
|
||||
'@backstage/plugin-catalog-backend-module-azure': patch
|
||||
'@backstage/plugin-catalog-backend-module-aws': patch
|
||||
'@backstage/plugin-catalog-backend-module-gcp': patch
|
||||
'@backstage/plugin-entity-feedback-backend': patch
|
||||
'@backstage/plugin-code-coverage-backend': patch
|
||||
'@backstage/plugin-tech-insights-backend': patch
|
||||
'@backstage/plugin-azure-devops-backend': patch
|
||||
'@backstage/plugin-azure-sites-backend': patch
|
||||
'@backstage/plugin-search-backend-node': patch
|
||||
'@backstage/plugin-lighthouse-backend': patch
|
||||
'@backstage/plugin-permission-backend': patch
|
||||
'@backstage/plugin-sonarqube-backend': patch
|
||||
'@backstage/backend-app-api': patch
|
||||
'@backstage/plugin-airbrake-backend': patch
|
||||
'@backstage/plugin-devtools-backend': patch
|
||||
'@backstage/plugin-linguist-backend': patch
|
||||
'@backstage/plugin-periskop-backend': patch
|
||||
'@backstage/plugin-playlist-backend': patch
|
||||
'@backstage/plugin-catalog-backend': patch
|
||||
'@backstage/plugin-explore-backend': patch
|
||||
'@backstage/plugin-jenkins-backend': patch
|
||||
'@backstage/backend-tasks': patch
|
||||
'@backstage/plugin-badges-backend': patch
|
||||
'@backstage/plugin-bazaar-backend': patch
|
||||
'@backstage/plugin-search-backend': patch
|
||||
'@backstage/plugin-kafka-backend': patch
|
||||
'@backstage/plugin-nomad-backend': patch
|
||||
'@backstage/plugin-todo-backend': patch
|
||||
'@backstage/plugin-adr-backend': patch
|
||||
'@backstage/plugin-app-backend': patch
|
||||
---
|
||||
|
||||
Replaced winston logger with `LoggerService`
|
||||
@@ -0,0 +1,19 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-backend-module-github': minor
|
||||
---
|
||||
|
||||
Remove use of `EventBroker` and `EventSubscriber` for the GitHub org data providers.
|
||||
|
||||
BREAKING CHANGE:
|
||||
|
||||
- `GithubOrgEntityProvider.onEvent` made private
|
||||
- `GithubOrgEntityProvider.supportsEventTopics` removed
|
||||
- `eventBroker` option was removed from `GithubMultiOrgEntityProvider.fromConfig`
|
||||
- `GithubMultiOrgEntityProvider.supportsEventTopics` removed
|
||||
|
||||
This change only impacts users who still use the legacy backend system
|
||||
**and** who still use `eventBroker` as option when creating these
|
||||
entity providers.
|
||||
|
||||
Please pass the `EventsService` instance as option `events` instead.
|
||||
You can find more information at the [installation documentation](https://backstage.io/docs/integrations/github/org/#legacy-backend-system).
|
||||
@@ -266,3 +266,4 @@ _You can do this by using the [Adopter form](https://info.backstage.spotify.com/
|
||||
| [Wefox](https://www.wefox.com) | [@dibenlloch](https://github.com/dibenlloch) | Internal developer portal to consolidate all developers dashboards, company inventory with compliance reports, team management and self-service portal for IT/Team operations. |
|
||||
| [Aurora Innovation](https://aurorainnovation.com) | [@O5ten](https://github.com/O5ten) | Heavy usage of scaffolder, techdocs, homepage, k8s plugin and homegrown plugins to track migration paths and so on within a developer portal. It acts as a starting point for new and old developers to find all of our internal tooling in one place.
|
||||
| [ENSEK](https://ensek.com/) | [Timothy Deakin](https://github.com/cftad) |We are using Backstage as our internal developer portal to provide a single pane of glass for our developers to access all the tools and services they need to build and maintain our software. |
|
||||
| [OP Financial Group](https://www.op.fi/op-financial-group) | [Heikki Hellgren](https://github.com/drodil), [Jyrki Koistinen](https://github.com/snyvision) | We are using Backstage as a gateway into our internal development platform offering to simplify complexity. |
|
||||
|
||||
@@ -156,7 +156,11 @@ Backstage as _the_ platform:
|
||||
Again, any feedback is appreciated. Please use the Edit button at the bottom of the
|
||||
page to make a suggestion.
|
||||
|
||||
_**Note!** It might be tempting to try to optimize Backstage usage and
|
||||
:::note Note
|
||||
|
||||
It might be tempting to try to optimize Backstage usage and
|
||||
"engagement". Even though you want to consolidate all your tooling and technical
|
||||
documentation in Backstage, it is important to remember that time spent in
|
||||
Backstage is time not spent writing code_ 🙃
|
||||
Backstage is time not spent writing code 🙃
|
||||
|
||||
:::
|
||||
|
||||
+1
-2
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { loggerToWinstonLogger } from '@backstage/backend-common';
|
||||
import {
|
||||
coreServices,
|
||||
createServiceFactory,
|
||||
@@ -33,7 +32,7 @@ export const schedulerServiceFactory = createServiceFactory({
|
||||
return TaskScheduler.forPlugin({
|
||||
pluginId: plugin.getId(),
|
||||
databaseManager,
|
||||
logger: loggerToWinstonLogger(logger),
|
||||
logger,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { loggerToWinstonLogger, UrlReaders } from '@backstage/backend-common';
|
||||
import { UrlReaders } from '@backstage/backend-common';
|
||||
import {
|
||||
coreServices,
|
||||
createServiceFactory,
|
||||
@@ -30,7 +30,7 @@ export const urlReaderServiceFactory = createServiceFactory({
|
||||
async factory({ config, logger }) {
|
||||
return UrlReaders.default({
|
||||
config,
|
||||
logger: loggerToWinstonLogger(logger),
|
||||
logger,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Duration } from 'luxon';
|
||||
import { HumanDuration as HumanDuration_2 } from '@backstage/types';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { LegacyRootDatabaseService } from '@backstage/backend-common';
|
||||
import { Logger } from 'winston';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
import { PluginDatabaseManager } from '@backstage/backend-common';
|
||||
|
||||
// @public @deprecated
|
||||
@@ -83,20 +83,23 @@ export interface TaskScheduleDefinitionConfig {
|
||||
|
||||
// @public
|
||||
export class TaskScheduler {
|
||||
constructor(databaseManager: LegacyRootDatabaseService, logger: Logger);
|
||||
constructor(
|
||||
databaseManager: LegacyRootDatabaseService,
|
||||
logger: LoggerService,
|
||||
);
|
||||
forPlugin(pluginId: string): PluginTaskScheduler;
|
||||
// (undocumented)
|
||||
static forPlugin(opts: {
|
||||
pluginId: string;
|
||||
databaseManager: PluginDatabaseManager;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
}): PluginTaskScheduler;
|
||||
// (undocumented)
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options?: {
|
||||
databaseManager?: LegacyRootDatabaseService;
|
||||
logger?: Logger;
|
||||
logger?: LoggerService;
|
||||
},
|
||||
): TaskScheduler;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/backend-common": "workspace:^",
|
||||
"@backstage/backend-plugin-api": "workspace:^",
|
||||
"@backstage/config": "workspace:^",
|
||||
"@backstage/errors": "workspace:^",
|
||||
"@backstage/types": "workspace:^",
|
||||
@@ -43,7 +44,6 @@
|
||||
"lodash": "^4.17.21",
|
||||
"luxon": "^3.0.0",
|
||||
"uuid": "^9.0.0",
|
||||
"winston": "^3.2.1",
|
||||
"zod": "^3.22.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
import { ConflictError } from '@backstage/errors';
|
||||
import { CronTime } from 'cron';
|
||||
import { DateTime, Duration } from 'luxon';
|
||||
import { Logger } from 'winston';
|
||||
import { TaskFunction, TaskSettingsV2 } from './types';
|
||||
import { delegateAbortController, sleep } from './util';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
/**
|
||||
* Implements tasks that run locally without cross-host collaboration.
|
||||
@@ -32,7 +32,7 @@ export class LocalTaskWorker {
|
||||
constructor(
|
||||
private readonly taskId: string,
|
||||
private readonly fn: TaskFunction,
|
||||
private readonly logger: Logger,
|
||||
private readonly logger: LoggerService,
|
||||
) {}
|
||||
|
||||
start(settings: TaskSettingsV2, options?: { signal?: AbortSignal }) {
|
||||
|
||||
@@ -16,20 +16,20 @@
|
||||
|
||||
import { Knex } from 'knex';
|
||||
import { Duration } from 'luxon';
|
||||
import { Logger } from 'winston';
|
||||
import { LocalTaskWorker } from './LocalTaskWorker';
|
||||
import { TaskWorker } from './TaskWorker';
|
||||
import {
|
||||
PluginTaskScheduler,
|
||||
TaskDescriptor,
|
||||
TaskFunction,
|
||||
TaskInvocationDefinition,
|
||||
TaskRunner,
|
||||
TaskScheduleDefinition,
|
||||
TaskSettingsV2,
|
||||
} from './types';
|
||||
import { validateId } from './util';
|
||||
import { TaskFunction } from './types';
|
||||
import { metrics, Counter, Histogram } from '@opentelemetry/api';
|
||||
import { Counter, Histogram, metrics } from '@opentelemetry/api';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
/**
|
||||
* Implements the actual task management.
|
||||
@@ -43,7 +43,7 @@ export class PluginTaskSchedulerImpl implements PluginTaskScheduler {
|
||||
|
||||
constructor(
|
||||
private readonly databaseFactory: () => Promise<Knex>,
|
||||
private readonly logger: Logger,
|
||||
private readonly logger: LoggerService,
|
||||
) {
|
||||
const meter = metrics.getMeter('default');
|
||||
this.counter = meter.createCounter('backend_tasks.task.runs.count', {
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
|
||||
import { Knex } from 'knex';
|
||||
import { Duration } from 'luxon';
|
||||
import { Logger } from 'winston';
|
||||
import { DbTasksRow, DB_TASKS_TABLE } from '../database/tables';
|
||||
import { DB_TASKS_TABLE, DbTasksRow } from '../database/tables';
|
||||
import { sleep } from './util';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
/**
|
||||
* Makes sure to auto-expire and clean up things that time out or for other
|
||||
@@ -27,12 +27,12 @@ import { sleep } from './util';
|
||||
export class PluginTaskSchedulerJanitor {
|
||||
private readonly knex: Knex;
|
||||
private readonly waitBetweenRuns: Duration;
|
||||
private readonly logger: Logger;
|
||||
private readonly logger: LoggerService;
|
||||
|
||||
constructor(options: {
|
||||
knex: Knex;
|
||||
waitBetweenRuns: Duration;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
}) {
|
||||
this.knex = options.knex;
|
||||
this.waitBetweenRuns = options.waitBetweenRuns;
|
||||
|
||||
@@ -23,11 +23,11 @@ import {
|
||||
import { Config } from '@backstage/config';
|
||||
import { once } from 'lodash';
|
||||
import { Duration } from 'luxon';
|
||||
import { Logger } from 'winston';
|
||||
import { migrateBackendTasks } from '../database/migrateBackendTasks';
|
||||
import { PluginTaskSchedulerImpl } from './PluginTaskSchedulerImpl';
|
||||
import { PluginTaskSchedulerJanitor } from './PluginTaskSchedulerJanitor';
|
||||
import { PluginTaskScheduler } from './types';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
/**
|
||||
* Deals with the scheduling of distributed tasks.
|
||||
@@ -39,7 +39,7 @@ export class TaskScheduler {
|
||||
config: Config,
|
||||
options?: {
|
||||
databaseManager?: LegacyRootDatabaseService;
|
||||
logger?: Logger;
|
||||
logger?: LoggerService;
|
||||
},
|
||||
): TaskScheduler {
|
||||
const databaseManager =
|
||||
@@ -52,7 +52,7 @@ export class TaskScheduler {
|
||||
|
||||
constructor(
|
||||
private readonly databaseManager: LegacyRootDatabaseService,
|
||||
private readonly logger: Logger,
|
||||
private readonly logger: LoggerService,
|
||||
) {}
|
||||
|
||||
/**
|
||||
@@ -72,7 +72,7 @@ export class TaskScheduler {
|
||||
static forPlugin(opts: {
|
||||
pluginId: string;
|
||||
databaseManager: PluginDatabaseManager;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
}): PluginTaskScheduler {
|
||||
const databaseFactory = once(async () => {
|
||||
const knex = await opts.databaseManager.getClient();
|
||||
|
||||
@@ -19,10 +19,10 @@ import { CronTime } from 'cron';
|
||||
import { Knex } from 'knex';
|
||||
import { DateTime, Duration } from 'luxon';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import { Logger } from 'winston';
|
||||
import { DbTasksRow, DB_TASKS_TABLE } from '../database/tables';
|
||||
import { DB_TASKS_TABLE, DbTasksRow } from '../database/tables';
|
||||
import { TaskFunction, TaskSettingsV2, taskSettingsV2Schema } from './types';
|
||||
import { delegateAbortController, nowPlus, sleep } from './util';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
const DEFAULT_WORK_CHECK_FREQUENCY = Duration.fromObject({ seconds: 5 });
|
||||
|
||||
@@ -36,7 +36,7 @@ export class TaskWorker {
|
||||
private readonly taskId: string,
|
||||
private readonly fn: TaskFunction,
|
||||
private readonly knex: Knex,
|
||||
private readonly logger: Logger,
|
||||
private readonly logger: LoggerService,
|
||||
private readonly workCheckFrequency: Duration = DEFAULT_WORK_CHECK_FREQUENCY,
|
||||
) {}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import { Config } from '@backstage/config';
|
||||
import { DocumentCollatorFactory } from '@backstage/plugin-search-common';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import express from 'express';
|
||||
import { Logger } from 'winston';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
import { PluginCacheManager } from '@backstage/backend-common';
|
||||
import { PluginEndpointDiscovery } from '@backstage/backend-common';
|
||||
import { Readable } from 'stream';
|
||||
@@ -29,7 +29,7 @@ export type AdrCollatorFactoryOptions = {
|
||||
config: Config;
|
||||
catalogClient?: CatalogApi;
|
||||
discovery: PluginEndpointDiscovery;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
parser?: AdrParser;
|
||||
reader: UrlReader;
|
||||
tokenManager: TokenManager;
|
||||
@@ -54,7 +54,7 @@ export default adrPlugin;
|
||||
export type AdrRouterOptions = {
|
||||
reader: UrlReader;
|
||||
cacheClient: CacheClient;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
};
|
||||
|
||||
// @public
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
"luxon": "^3.0.0",
|
||||
"marked": "^12.0.0",
|
||||
"node-fetch": "^2.6.5",
|
||||
"winston": "^3.2.1",
|
||||
"yn": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { loggerToWinstonLogger } from '@backstage/backend-common';
|
||||
import {
|
||||
coreServices,
|
||||
createBackendPlugin,
|
||||
@@ -38,7 +37,7 @@ export const adrPlugin = createBackendPlugin({
|
||||
async init({ httpRouter, logger, reader, cache }) {
|
||||
httpRouter.use(
|
||||
await createRouter({
|
||||
logger: loggerToWinstonLogger(logger),
|
||||
logger,
|
||||
reader,
|
||||
cacheClient: cache,
|
||||
}),
|
||||
|
||||
@@ -15,19 +15,18 @@
|
||||
*/
|
||||
|
||||
import { Readable } from 'stream';
|
||||
import { Logger } from 'winston';
|
||||
import {
|
||||
CacheClient,
|
||||
createLegacyAuthAdapters,
|
||||
PluginCacheManager,
|
||||
PluginEndpointDiscovery,
|
||||
TokenManager,
|
||||
UrlReader,
|
||||
createLegacyAuthAdapters,
|
||||
} from '@backstage/backend-common';
|
||||
import {
|
||||
CATALOG_FILTER_EXISTS,
|
||||
CatalogApi,
|
||||
CatalogClient,
|
||||
CATALOG_FILTER_EXISTS,
|
||||
} from '@backstage/catalog-client';
|
||||
import { stringifyEntityRef } from '@backstage/catalog-model';
|
||||
import { Config } from '@backstage/config';
|
||||
@@ -47,7 +46,7 @@ import { DocumentCollatorFactory } from '@backstage/plugin-search-common';
|
||||
|
||||
import { createMadrParser } from './createMadrParser';
|
||||
import { AdrParser } from './types';
|
||||
import { AuthService } from '@backstage/backend-plugin-api';
|
||||
import { AuthService, LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
/**
|
||||
* Options to configure the AdrCollatorFactory
|
||||
@@ -78,7 +77,7 @@ export type AdrCollatorFactoryOptions = {
|
||||
/**
|
||||
* Logger
|
||||
*/
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
/**
|
||||
* ADR content parser. Defaults to built in MADR parser.
|
||||
*/
|
||||
@@ -106,7 +105,7 @@ export class DefaultAdrCollatorFactory implements DocumentCollatorFactory {
|
||||
private readonly adrFilePathFilterFn: AdrFilePathFilterFn;
|
||||
private readonly cacheClient: CacheClient;
|
||||
private readonly catalogClient: CatalogApi;
|
||||
private readonly logger: Logger;
|
||||
private readonly logger: LoggerService;
|
||||
private readonly parser: AdrParser;
|
||||
private readonly reader: UrlReader;
|
||||
private readonly auth: AuthService;
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
import express from 'express';
|
||||
import request from 'supertest';
|
||||
import { createRouter } from './router';
|
||||
import { Logger } from 'winston';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
const listEndpointName = '/list';
|
||||
const fileEndpointName = '/file';
|
||||
@@ -122,7 +122,7 @@ describe('createRouter', () => {
|
||||
cacheClient: new MockCacheClient(),
|
||||
logger: {
|
||||
error: (message: any) => message,
|
||||
} as Logger,
|
||||
} as LoggerService,
|
||||
});
|
||||
app = express().use(router);
|
||||
});
|
||||
|
||||
@@ -16,16 +16,16 @@
|
||||
|
||||
import { CacheClient, UrlReader } from '@backstage/backend-common';
|
||||
import { NotModifiedError, stringifyError } from '@backstage/errors';
|
||||
import { Logger } from 'winston';
|
||||
import express from 'express';
|
||||
import Router from 'express-promise-router';
|
||||
import { madrParser } from '../search/madrParser';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
/** @public */
|
||||
export type AdrRouterOptions = {
|
||||
reader: UrlReader;
|
||||
cacheClient: CacheClient;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { BackendFeature } from '@backstage/backend-plugin-api';
|
||||
import { Config } from '@backstage/config';
|
||||
import express from 'express';
|
||||
import { Logger } from 'winston';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
// @public
|
||||
export interface AirbrakeConfig {
|
||||
@@ -26,6 +26,6 @@ export function extractAirbrakeConfig(config: Config): AirbrakeConfig;
|
||||
// @public
|
||||
export interface RouterOptions {
|
||||
airbrakeConfig: AirbrakeConfig;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
}
|
||||
```
|
||||
|
||||
@@ -35,10 +35,10 @@
|
||||
"express": "^4.17.1",
|
||||
"express-promise-router": "^4.1.0",
|
||||
"http-proxy-middleware": "^2.0.0",
|
||||
"winston": "^3.2.1",
|
||||
"yn": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/backend-test-utils": "workspace:^",
|
||||
"@backstage/cli": "workspace:^",
|
||||
"@types/http-proxy-middleware": "^1.0.0",
|
||||
"@types/supertest": "^2.0.8",
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { loggerToWinstonLogger } from '@backstage/backend-common';
|
||||
import {
|
||||
coreServices,
|
||||
createBackendPlugin,
|
||||
@@ -40,7 +39,7 @@ export const airbrakePlugin = createBackendPlugin({
|
||||
httpRouter.use(
|
||||
await createRouter({
|
||||
airbrakeConfig: extractAirbrakeConfig(config),
|
||||
logger: loggerToWinstonLogger(logger),
|
||||
logger,
|
||||
}),
|
||||
);
|
||||
httpRouter.addAuthPolicy({
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { getVoidLogger } from '@backstage/backend-common';
|
||||
import express from 'express';
|
||||
import request from 'supertest';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
@@ -24,17 +23,18 @@ import {
|
||||
RouterOptions,
|
||||
} from './router';
|
||||
import { AirbrakeConfig, extractAirbrakeConfig } from '../config';
|
||||
import * as winston from 'winston';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
import { mockServices } from '@backstage/backend-test-utils';
|
||||
|
||||
describe('createRouter', () => {
|
||||
let app: express.Express;
|
||||
let airbrakeConfig: AirbrakeConfig;
|
||||
let voidLogger: winston.Logger;
|
||||
let voidLogger: LoggerService;
|
||||
|
||||
beforeEach(async () => {
|
||||
jest.resetAllMocks();
|
||||
|
||||
voidLogger = getVoidLogger();
|
||||
voidLogger = mockServices.logger.mock();
|
||||
const config = new ConfigReader({
|
||||
airbrake: {
|
||||
apiKey: 'fakeApiKey',
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
import { errorHandler } from '@backstage/backend-common';
|
||||
import express from 'express';
|
||||
import Router from 'express-promise-router';
|
||||
import { Logger } from 'winston';
|
||||
import { createProxyMiddleware } from 'http-proxy-middleware';
|
||||
import { AirbrakeConfig } from '../config';
|
||||
import { Options } from 'http-proxy-middleware/dist/types';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
/**
|
||||
* The router options that are needed when creating a router.
|
||||
@@ -31,7 +31,7 @@ export interface RouterOptions {
|
||||
/**
|
||||
* A logger object
|
||||
*/
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
|
||||
/**
|
||||
* The Airbrake config obtained from {@link extractAirbrakeConfig}
|
||||
|
||||
@@ -19,14 +19,14 @@ import {
|
||||
loadBackendConfig,
|
||||
} from '@backstage/backend-common';
|
||||
import { Server } from 'http';
|
||||
import { Logger } from 'winston';
|
||||
import { createRouter } from './router';
|
||||
import { extractAirbrakeConfig } from '../config';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
export interface ServerOptions {
|
||||
port: number;
|
||||
enableCors: boolean;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
}
|
||||
|
||||
export async function startStandaloneServer(
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Config } from '@backstage/config';
|
||||
import { ConfigSchema } from '@backstage/config-loader';
|
||||
import express from 'express';
|
||||
import { HttpAuthService } from '@backstage/backend-plugin-api';
|
||||
import { Logger } from 'winston';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
import { PluginDatabaseManager } from '@backstage/backend-common';
|
||||
|
||||
// @public (undocumented)
|
||||
@@ -26,7 +26,7 @@ export interface RouterOptions {
|
||||
// (undocumented)
|
||||
httpAuth?: HttpAuthService;
|
||||
// (undocumented)
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
schema?: ConfigSchema;
|
||||
staticFallbackHandler?: express.Handler;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,6 @@
|
||||
"knex": "^3.0.0",
|
||||
"lodash": "^4.17.21",
|
||||
"luxon": "^3.0.0",
|
||||
"winston": "^3.2.1",
|
||||
"yn": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -19,10 +19,10 @@ import {
|
||||
resolvePackagePath,
|
||||
} from '@backstage/backend-common';
|
||||
import { Knex } from 'knex';
|
||||
import { Logger } from 'winston';
|
||||
import { DateTime } from 'luxon';
|
||||
import partition from 'lodash/partition';
|
||||
import { StaticAsset, StaticAssetInput, StaticAssetProvider } from './types';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
const migrationsDir = resolvePackagePath(
|
||||
'@backstage/plugin-app-backend',
|
||||
@@ -39,7 +39,7 @@ interface StaticAssetRow {
|
||||
/** @internal */
|
||||
export interface StaticAssetsStoreOptions {
|
||||
database: PluginDatabaseManager;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,7 +49,7 @@ export interface StaticAssetsStoreOptions {
|
||||
*/
|
||||
export class StaticAssetsStore implements StaticAssetProvider {
|
||||
#db: Knex;
|
||||
#logger: Logger;
|
||||
#logger: LoggerService;
|
||||
#namespace: string;
|
||||
|
||||
static async create(options: StaticAssetsStoreOptions) {
|
||||
@@ -65,7 +65,7 @@ export class StaticAssetsStore implements StaticAssetProvider {
|
||||
return new StaticAssetsStore(client, options.logger);
|
||||
}
|
||||
|
||||
private constructor(client: Knex, logger: Logger, namespace?: string) {
|
||||
private constructor(client: Knex, logger: LoggerService, namespace?: string) {
|
||||
this.#db = client;
|
||||
this.#logger = logger;
|
||||
this.#namespace = namespace ?? 'default';
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import { resolve as resolvePath } from 'path';
|
||||
import { Logger } from 'winston';
|
||||
import { AppConfig, Config } from '@backstage/config';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import {
|
||||
@@ -24,12 +23,13 @@ import {
|
||||
loadConfigSchema,
|
||||
readEnvConfig,
|
||||
} from '@backstage/config-loader';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
type InjectOptions = {
|
||||
appConfigs: AppConfig[];
|
||||
// Directory of the static JS files to search for file to inject
|
||||
staticDir: string;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,7 +20,6 @@ import {
|
||||
createBackendPlugin,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
import { createRouter } from './router';
|
||||
import { loggerToWinstonLogger } from '@backstage/backend-common';
|
||||
import {
|
||||
configSchemaExtensionPoint,
|
||||
staticFallbackHandlerExtensionPoint,
|
||||
@@ -72,10 +71,8 @@ export const appPlugin = createBackendPlugin({
|
||||
const appPackageName =
|
||||
config.getOptionalString('app.packageName') ?? 'app';
|
||||
|
||||
const winstonLogger = loggerToWinstonLogger(logger);
|
||||
|
||||
const router = await createRouter({
|
||||
logger: winstonLogger,
|
||||
logger,
|
||||
config,
|
||||
database,
|
||||
auth,
|
||||
|
||||
@@ -25,12 +25,11 @@ import express from 'express';
|
||||
import Router from 'express-promise-router';
|
||||
import fs from 'fs-extra';
|
||||
import { resolve as resolvePath } from 'path';
|
||||
import { Logger } from 'winston';
|
||||
import { injectConfig, readConfigs } from '../lib/config';
|
||||
import {
|
||||
StaticAssetsStore,
|
||||
findStaticAssets,
|
||||
createStaticAssetMiddleware,
|
||||
findStaticAssets,
|
||||
StaticAssetsStore,
|
||||
} from '../lib/assets';
|
||||
import {
|
||||
CACHE_CONTROL_MAX_CACHE,
|
||||
@@ -38,7 +37,11 @@ import {
|
||||
CACHE_CONTROL_REVALIDATE_CACHE,
|
||||
} from '../lib/headers';
|
||||
import { ConfigSchema } from '@backstage/config-loader';
|
||||
import { AuthService, HttpAuthService } from '@backstage/backend-plugin-api';
|
||||
import {
|
||||
AuthService,
|
||||
HttpAuthService,
|
||||
LoggerService,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
import { AuthenticationError } from '@backstage/errors';
|
||||
|
||||
// express uses mime v1 while we only have types for mime v2
|
||||
@@ -47,7 +50,7 @@ type Mime = { lookup(arg0: string): string };
|
||||
/** @public */
|
||||
export interface RouterOptions {
|
||||
config: Config;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
auth?: AuthService;
|
||||
httpAuth?: HttpAuthService;
|
||||
|
||||
@@ -270,7 +273,7 @@ async function createEntryPointRouter({
|
||||
appMode,
|
||||
appConfigs,
|
||||
}: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
rootDir: string;
|
||||
assetStore?: StaticAssetsStore;
|
||||
staticFallbackHandler?: express.Handler;
|
||||
|
||||
@@ -15,16 +15,16 @@
|
||||
*/
|
||||
|
||||
import { Server } from 'http';
|
||||
import { Logger } from 'winston';
|
||||
import { createServiceBuilder } from '@backstage/backend-common';
|
||||
import { Config } from '@backstage/config';
|
||||
import { createRouter } from './router';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
export interface ServerOptions {
|
||||
port: number;
|
||||
enableCors: boolean;
|
||||
config: Config;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
}
|
||||
|
||||
export async function startStandaloneServer(
|
||||
|
||||
@@ -15,7 +15,7 @@ import express from 'express';
|
||||
import { GitRepository } from 'azure-devops-node-api/interfaces/GitInterfaces';
|
||||
import { GitTag } from '@backstage/plugin-azure-devops-common';
|
||||
import { LocationSpec } from '@backstage/plugin-catalog-common';
|
||||
import { Logger } from 'winston';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
import { PermissionEvaluator } from '@backstage/plugin-permission-common';
|
||||
import { Project } from '@backstage/plugin-azure-devops-common';
|
||||
import { PullRequest } from '@backstage/plugin-azure-devops-common';
|
||||
@@ -51,7 +51,7 @@ export class AzureDevOpsApi {
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
urlReader: UrlReader;
|
||||
},
|
||||
): AzureDevOpsApi;
|
||||
@@ -159,7 +159,7 @@ export interface RouterOptions {
|
||||
// (undocumented)
|
||||
config: Config;
|
||||
// (undocumented)
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
// (undocumented)
|
||||
permissions: PermissionEvaluator;
|
||||
// (undocumented)
|
||||
|
||||
@@ -47,7 +47,6 @@
|
||||
"lodash": "^4.17.21",
|
||||
"mime-types": "^2.1.27",
|
||||
"p-limit": "^3.1.0",
|
||||
"winston": "^3.2.1",
|
||||
"yn": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -23,12 +23,12 @@ import {
|
||||
DashboardPullRequest,
|
||||
GitTag,
|
||||
Policy,
|
||||
Project,
|
||||
PullRequest,
|
||||
PullRequestOptions,
|
||||
RepoBuild,
|
||||
Team,
|
||||
TeamMember,
|
||||
Project,
|
||||
} from '@backstage/plugin-azure-devops-common';
|
||||
import {
|
||||
GitPullRequest,
|
||||
@@ -37,20 +37,19 @@ import {
|
||||
GitRepository,
|
||||
} from 'azure-devops-node-api/interfaces/GitInterfaces';
|
||||
import {
|
||||
buildEncodedUrl,
|
||||
convertDashboardPullRequest,
|
||||
convertPolicy,
|
||||
getArtifactId,
|
||||
replaceReadme,
|
||||
buildEncodedUrl,
|
||||
} from '../utils';
|
||||
|
||||
import { TeamMember as AdoTeamMember } from 'azure-devops-node-api/interfaces/common/VSSInterfaces';
|
||||
import { Logger } from 'winston';
|
||||
import { PolicyEvaluationRecord } from 'azure-devops-node-api/interfaces/PolicyInterfaces';
|
||||
import {
|
||||
WebApi,
|
||||
getHandlerFromToken,
|
||||
getPersonalAccessTokenHandler,
|
||||
WebApi,
|
||||
} from 'azure-devops-node-api';
|
||||
import {
|
||||
TeamProjectReference,
|
||||
@@ -69,16 +68,17 @@ import {
|
||||
mappedPullRequest,
|
||||
mappedRepoBuild,
|
||||
} from './mappers';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
/** @public */
|
||||
export class AzureDevOpsApi {
|
||||
private readonly logger: Logger;
|
||||
private readonly logger: LoggerService;
|
||||
private readonly urlReader: UrlReader;
|
||||
private readonly config: Config;
|
||||
private readonly credentialsProvider: AzureDevOpsCredentialsProvider;
|
||||
|
||||
private constructor(
|
||||
logger: Logger,
|
||||
logger: LoggerService,
|
||||
urlReader: UrlReader,
|
||||
config: Config,
|
||||
credentialsProvider: AzureDevOpsCredentialsProvider,
|
||||
@@ -91,7 +91,7 @@ export class AzureDevOpsApi {
|
||||
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: { logger: Logger; urlReader: UrlReader },
|
||||
options: { logger: LoggerService; urlReader: UrlReader },
|
||||
) {
|
||||
const scmIntegrations = ScmIntegrations.fromConfig(config);
|
||||
const credentialsProvider =
|
||||
|
||||
@@ -22,8 +22,8 @@ import {
|
||||
} from '@backstage/plugin-azure-devops-common';
|
||||
|
||||
import { AzureDevOpsApi } from './AzureDevOpsApi';
|
||||
import { Logger } from 'winston';
|
||||
import limiterFactory from 'p-limit';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
export const DEFAULT_TEAMS_LIMIT = 100;
|
||||
|
||||
@@ -33,12 +33,12 @@ export class PullRequestsDashboardProvider {
|
||||
private teamMembers = new Map<string, TeamMember>();
|
||||
|
||||
private constructor(
|
||||
private readonly logger: Logger,
|
||||
private readonly logger: LoggerService,
|
||||
private readonly azureDevOpsApi: AzureDevOpsApi,
|
||||
) {}
|
||||
|
||||
public static async create(
|
||||
logger: Logger,
|
||||
logger: LoggerService,
|
||||
azureDevOpsApi: AzureDevOpsApi,
|
||||
): Promise<PullRequestsDashboardProvider> {
|
||||
const provider = new PullRequestsDashboardProvider(logger, azureDevOpsApi);
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { loggerToWinstonLogger } from '@backstage/backend-common';
|
||||
import {
|
||||
coreServices,
|
||||
createBackendPlugin,
|
||||
@@ -41,7 +40,7 @@ export const azureDevOpsPlugin = createBackendPlugin({
|
||||
httpRouter.use(
|
||||
await createRouter({
|
||||
config,
|
||||
logger: loggerToWinstonLogger(logger),
|
||||
logger,
|
||||
reader,
|
||||
permissions,
|
||||
}),
|
||||
|
||||
@@ -15,6 +15,11 @@
|
||||
*/
|
||||
|
||||
import {
|
||||
azureDevOpsGitTagReadPermission,
|
||||
azureDevOpsPermissions,
|
||||
azureDevOpsPipelineReadPermission,
|
||||
azureDevOpsPullRequestDashboardReadPermission,
|
||||
azureDevOpsPullRequestReadPermission,
|
||||
DashboardPullRequest,
|
||||
PullRequestOptions,
|
||||
PullRequestStatus,
|
||||
@@ -22,10 +27,9 @@ import {
|
||||
|
||||
import { AzureDevOpsApi } from '../api';
|
||||
import { Config } from '@backstage/config';
|
||||
import { Logger } from 'winston';
|
||||
import {
|
||||
PullRequestsDashboardProvider,
|
||||
DEFAULT_TEAMS_LIMIT,
|
||||
PullRequestsDashboardProvider,
|
||||
} from '../api/PullRequestsDashboardProvider';
|
||||
import Router from 'express-promise-router';
|
||||
import { errorHandler, UrlReader } from '@backstage/backend-common';
|
||||
@@ -33,24 +37,18 @@ import express from 'express';
|
||||
import { InputError, NotAllowedError } from '@backstage/errors';
|
||||
import { getBearerTokenFromAuthorizationHeader } from '@backstage/plugin-auth-node';
|
||||
import {
|
||||
PermissionEvaluator,
|
||||
AuthorizeResult,
|
||||
PermissionEvaluator,
|
||||
} from '@backstage/plugin-permission-common';
|
||||
import { createPermissionIntegrationRouter } from '@backstage/plugin-permission-node';
|
||||
import {
|
||||
azureDevOpsPullRequestReadPermission,
|
||||
azureDevOpsPermissions,
|
||||
azureDevOpsPullRequestDashboardReadPermission,
|
||||
azureDevOpsGitTagReadPermission,
|
||||
azureDevOpsPipelineReadPermission,
|
||||
} from '@backstage/plugin-azure-devops-common';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
const DEFAULT_TOP = 10;
|
||||
|
||||
/** @public */
|
||||
export interface RouterOptions {
|
||||
azureDevOpsApi?: AzureDevOpsApi;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
config: Config;
|
||||
reader: UrlReader;
|
||||
permissions: PermissionEvaluator;
|
||||
|
||||
@@ -16,20 +16,20 @@
|
||||
|
||||
import {
|
||||
createServiceBuilder,
|
||||
loadBackendConfig,
|
||||
UrlReaders,
|
||||
ServerTokenManager,
|
||||
HostDiscovery,
|
||||
loadBackendConfig,
|
||||
ServerTokenManager,
|
||||
UrlReaders,
|
||||
} from '@backstage/backend-common';
|
||||
import { Server } from 'http';
|
||||
import { Logger } from 'winston';
|
||||
import { createRouter } from './router';
|
||||
import { ServerPermissionClient } from '@backstage/plugin-permission-node';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
export interface ServerOptions {
|
||||
port: number;
|
||||
enableCors: boolean;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
}
|
||||
|
||||
export async function startStandaloneServer(
|
||||
|
||||
@@ -13,7 +13,7 @@ import { Config } from '@backstage/config';
|
||||
import { DiscoveryService } from '@backstage/backend-plugin-api';
|
||||
import express from 'express';
|
||||
import { HttpAuthService } from '@backstage/backend-plugin-api';
|
||||
import { Logger } from 'winston';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
import { PermissionsService } from '@backstage/backend-plugin-api';
|
||||
|
||||
// @public (undocumented)
|
||||
@@ -74,7 +74,7 @@ export interface RouterOptions {
|
||||
// (undocumented)
|
||||
httpAuth?: HttpAuthService;
|
||||
// (undocumented)
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
// (undocumented)
|
||||
permissions: PermissionsService;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,6 @@
|
||||
"@types/express": "^4.17.6",
|
||||
"express": "^4.17.1",
|
||||
"express-promise-router": "^4.1.0",
|
||||
"winston": "^3.2.1",
|
||||
"yn": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { loggerToWinstonLogger } from '@backstage/backend-common';
|
||||
import {
|
||||
coreServices,
|
||||
createBackendPlugin,
|
||||
@@ -54,7 +53,7 @@ export const azureSitesPlugin = createBackendPlugin({
|
||||
const azureSitesApi = AzureSitesApi.fromConfig(config);
|
||||
httpRouter.use(
|
||||
await createRouter({
|
||||
logger: loggerToWinstonLogger(logger),
|
||||
logger,
|
||||
azureSitesApi,
|
||||
permissions,
|
||||
catalogApi,
|
||||
|
||||
@@ -20,29 +20,29 @@ import {
|
||||
} from '@backstage/backend-common';
|
||||
import express from 'express';
|
||||
import Router from 'express-promise-router';
|
||||
import { Logger } from 'winston';
|
||||
|
||||
import { InputError, NotAllowedError, NotFoundError } from '@backstage/errors';
|
||||
import { AuthorizeResult } from '@backstage/plugin-permission-common';
|
||||
import {
|
||||
AZURE_WEB_SITE_NAME_ANNOTATION,
|
||||
azureSitesActionPermission,
|
||||
azureSitesPermissions,
|
||||
AZURE_WEB_SITE_NAME_ANNOTATION,
|
||||
} from '@backstage/plugin-azure-sites-common';
|
||||
import { createPermissionIntegrationRouter } from '@backstage/plugin-permission-node';
|
||||
import { CatalogApi } from '@backstage/catalog-client';
|
||||
|
||||
import { AzureSitesApi } from '../api';
|
||||
import {
|
||||
DiscoveryService,
|
||||
AuthService,
|
||||
DiscoveryService,
|
||||
HttpAuthService,
|
||||
LoggerService,
|
||||
PermissionsService,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
|
||||
/** @public */
|
||||
export interface RouterOptions {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
azureSitesApi: AzureSitesApi;
|
||||
catalogApi: CatalogApi;
|
||||
permissions: PermissionsService;
|
||||
|
||||
@@ -21,16 +21,16 @@ import {
|
||||
SingleHostDiscovery,
|
||||
} from '@backstage/backend-common';
|
||||
import { Server } from 'http';
|
||||
import { Logger } from 'winston';
|
||||
import { AzureSitesApi } from '../api';
|
||||
import { createRouter } from './router';
|
||||
import { ServerPermissionClient } from '@backstage/plugin-permission-node';
|
||||
import { CatalogClient } from '@backstage/catalog-client';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
export interface ServerOptions {
|
||||
port: number;
|
||||
enableCors: boolean;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
}
|
||||
|
||||
export async function startStandaloneServer(
|
||||
|
||||
@@ -11,7 +11,7 @@ import { Entity } from '@backstage/catalog-model';
|
||||
import express from 'express';
|
||||
import { HttpAuthService } from '@backstage/backend-plugin-api';
|
||||
import { IdentityApi } from '@backstage/plugin-auth-node';
|
||||
import { Logger } from 'winston';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
import { PluginEndpointDiscovery } from '@backstage/backend-common';
|
||||
import { TokenManager } from '@backstage/backend-common';
|
||||
|
||||
@@ -152,7 +152,7 @@ export interface RouterOptions {
|
||||
// (undocumented)
|
||||
identity: IdentityApi;
|
||||
// (undocumented)
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
// (undocumented)
|
||||
tokenManager: TokenManager;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { loggerToWinstonLogger } from '@backstage/backend-common';
|
||||
import {
|
||||
coreServices,
|
||||
createBackendPlugin,
|
||||
@@ -54,7 +53,7 @@ export const badgesPlugin = createBackendPlugin({
|
||||
httpRouter.use(
|
||||
await createRouter({
|
||||
config,
|
||||
logger: loggerToWinstonLogger(logger),
|
||||
logger,
|
||||
badgeFactories: createDefaultBadgeFactories(),
|
||||
discovery,
|
||||
tokenManager,
|
||||
|
||||
@@ -29,11 +29,14 @@ import { NotFoundError } from '@backstage/errors';
|
||||
import { BadgeBuilder, DefaultBadgeBuilder } from '../lib/BadgeBuilder';
|
||||
import { BadgeContext, BadgeFactories } from '../types';
|
||||
import { isNil } from 'lodash';
|
||||
import { Logger } from 'winston';
|
||||
import { IdentityApi } from '@backstage/plugin-auth-node';
|
||||
import { BadgesStore, DatabaseBadgesStore } from '../database/badgesStore';
|
||||
import { createDefaultBadgeFactories } from '../badges';
|
||||
import { AuthService, HttpAuthService } from '@backstage/backend-plugin-api';
|
||||
import {
|
||||
AuthService,
|
||||
HttpAuthService,
|
||||
LoggerService,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
|
||||
/** @public */
|
||||
export interface RouterOptions {
|
||||
@@ -45,7 +48,7 @@ export interface RouterOptions {
|
||||
tokenManager: TokenManager;
|
||||
auth?: AuthService;
|
||||
httpAuth?: HttpAuthService;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
identity: IdentityApi;
|
||||
badgeStore?: BadgesStore;
|
||||
}
|
||||
@@ -95,7 +98,7 @@ async function obfuscatedRoute(
|
||||
router: express.Router,
|
||||
catalog: CatalogApi,
|
||||
badgeBuilder: BadgeBuilder,
|
||||
logger: Logger,
|
||||
logger: LoggerService,
|
||||
options: RouterOptions,
|
||||
config: Config,
|
||||
baseUrl: string,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { Config } from '@backstage/config';
|
||||
import express from 'express';
|
||||
import { IdentityApi } from '@backstage/plugin-auth-node';
|
||||
import { Logger } from 'winston';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
import { PluginDatabaseManager } from '@backstage/backend-common';
|
||||
|
||||
// @public (undocumented)
|
||||
@@ -21,7 +21,7 @@ export interface RouterOptions {
|
||||
// (undocumented)
|
||||
identity: IdentityApi;
|
||||
// (undocumented)
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
}
|
||||
|
||||
// (No @packageDocumentation comment for this package)
|
||||
|
||||
@@ -54,7 +54,6 @@
|
||||
"express": "^4.17.1",
|
||||
"express-promise-router": "^4.1.0",
|
||||
"knex": "^3.0.0",
|
||||
"winston": "^3.2.1",
|
||||
"yn": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { loggerToWinstonLogger } from '@backstage/backend-common';
|
||||
import {
|
||||
coreServices,
|
||||
createBackendPlugin,
|
||||
@@ -43,7 +42,7 @@ export default createBackendPlugin({
|
||||
database,
|
||||
config,
|
||||
identity,
|
||||
logger: loggerToWinstonLogger(logger),
|
||||
logger,
|
||||
}),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
import { errorHandler, PluginDatabaseManager } from '@backstage/backend-common';
|
||||
import express from 'express';
|
||||
import Router from 'express-promise-router';
|
||||
import { Logger } from 'winston';
|
||||
import { Config } from '@backstage/config';
|
||||
import { IdentityApi } from '@backstage/plugin-auth-node';
|
||||
import { DatabaseHandler } from './DatabaseHandler';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
/** @public */
|
||||
export interface RouterOptions {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
database: PluginDatabaseManager;
|
||||
config: Config;
|
||||
identity: IdentityApi;
|
||||
|
||||
@@ -15,20 +15,20 @@
|
||||
*/
|
||||
|
||||
import {
|
||||
DatabaseManager,
|
||||
createServiceBuilder,
|
||||
DatabaseManager,
|
||||
loadBackendConfig,
|
||||
} from '@backstage/backend-common';
|
||||
import { IdentityApi } from '@backstage/plugin-auth-node';
|
||||
import { Server } from 'http';
|
||||
import { Logger } from 'winston';
|
||||
import { createRouter } from './router';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
export interface ServerOptions {
|
||||
port: number;
|
||||
enableCors: boolean;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
}
|
||||
|
||||
export async function startStandaloneServer(
|
||||
|
||||
@@ -14,7 +14,7 @@ import type { Entity } from '@backstage/catalog-model';
|
||||
import { EntityProvider } from '@backstage/plugin-catalog-node';
|
||||
import { EntityProviderConnection } from '@backstage/plugin-catalog-node';
|
||||
import { LocationSpec } from '@backstage/plugin-catalog-common';
|
||||
import { Logger } from 'winston';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
import { PluginTaskScheduler } from '@backstage/backend-tasks';
|
||||
import { TaskRunner } from '@backstage/backend-tasks';
|
||||
import { UrlReader } from '@backstage/backend-common';
|
||||
@@ -60,7 +60,7 @@ export class AwsOrganizationCloudAccountProcessor implements CatalogProcessor {
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
},
|
||||
): Promise<AwsOrganizationCloudAccountProcessor>;
|
||||
// (undocumented)
|
||||
@@ -95,7 +95,7 @@ export class AwsS3EntityProvider implements EntityProvider {
|
||||
static fromConfig(
|
||||
configRoot: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
schedule?: TaskRunner;
|
||||
scheduler?: PluginTaskScheduler;
|
||||
},
|
||||
@@ -103,7 +103,7 @@ export class AwsS3EntityProvider implements EntityProvider {
|
||||
// (undocumented)
|
||||
getProviderName(): string;
|
||||
// (undocumented)
|
||||
refresh(logger: Logger): Promise<void>;
|
||||
refresh(logger: LoggerService): Promise<void>;
|
||||
}
|
||||
|
||||
// @public
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { loggerToWinstonLogger } from '@backstage/backend-common';
|
||||
import {
|
||||
coreServices,
|
||||
createBackendModule,
|
||||
@@ -41,7 +40,7 @@ export const catalogModuleAwsS3EntityProvider = createBackendModule({
|
||||
async init({ config, catalog, logger, scheduler }) {
|
||||
catalog.addEntityProvider(
|
||||
AwsS3EntityProvider.fromConfig(config, {
|
||||
logger: loggerToWinstonLogger(logger),
|
||||
logger,
|
||||
scheduler,
|
||||
}),
|
||||
);
|
||||
|
||||
+4
-4
@@ -27,12 +27,12 @@ import {
|
||||
ListAccountsResponse,
|
||||
Organizations,
|
||||
} from '@aws-sdk/client-organizations';
|
||||
import { Logger } from 'winston';
|
||||
import { readAwsOrganizationConfig } from '../awsOrganization/config';
|
||||
import {
|
||||
AwsCredentialProvider,
|
||||
DefaultAwsCredentialsManager,
|
||||
} from '@backstage/integration-aws-node';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
const AWS_ORGANIZATION_REGION = 'us-east-1';
|
||||
const LOCATION_TYPE = 'aws-cloud-accounts';
|
||||
@@ -54,9 +54,9 @@ const ACCOUNT_STATUS_LABEL = 'amazonaws.com/account-status';
|
||||
*/
|
||||
export class AwsOrganizationCloudAccountProcessor implements CatalogProcessor {
|
||||
private readonly organizations: Organizations;
|
||||
private readonly logger: Logger;
|
||||
private readonly logger: LoggerService;
|
||||
|
||||
static async fromConfig(config: Config, options: { logger: Logger }) {
|
||||
static async fromConfig(config: Config, options: { logger: LoggerService }) {
|
||||
const c = config.getOptionalConfig('catalog.processors.awsOrganization');
|
||||
const orgConfig = c ? readAwsOrganizationConfig(c) : undefined;
|
||||
const awsCredentialsManager =
|
||||
@@ -72,7 +72,7 @@ export class AwsOrganizationCloudAccountProcessor implements CatalogProcessor {
|
||||
|
||||
private constructor(
|
||||
private readonly credProvider: AwsCredentialProvider,
|
||||
logger: Logger,
|
||||
logger: LoggerService,
|
||||
) {
|
||||
this.logger = logger?.child({
|
||||
target: this.getProcessorName(),
|
||||
|
||||
@@ -31,12 +31,12 @@ import {
|
||||
S3,
|
||||
} from '@aws-sdk/client-s3';
|
||||
import * as uuid from 'uuid';
|
||||
import { Logger } from 'winston';
|
||||
import { getEndpointFromInstructions } from '@aws-sdk/middleware-endpoint';
|
||||
import {
|
||||
AwsCredentialsManager,
|
||||
DefaultAwsCredentialsManager,
|
||||
} from '@backstage/integration-aws-node';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
// TODO: event-based updates using S3 events (+ queue like SQS)?
|
||||
/**
|
||||
@@ -47,7 +47,7 @@ import {
|
||||
* @public
|
||||
*/
|
||||
export class AwsS3EntityProvider implements EntityProvider {
|
||||
private readonly logger: Logger;
|
||||
private readonly logger: LoggerService;
|
||||
private s3?: S3;
|
||||
private readonly scheduleFn: () => Promise<void>;
|
||||
private connection?: EntityProviderConnection;
|
||||
@@ -56,7 +56,7 @@ export class AwsS3EntityProvider implements EntityProvider {
|
||||
static fromConfig(
|
||||
configRoot: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
schedule?: TaskRunner;
|
||||
scheduler?: PluginTaskScheduler;
|
||||
},
|
||||
@@ -106,7 +106,7 @@ export class AwsS3EntityProvider implements EntityProvider {
|
||||
private readonly config: AwsS3Config,
|
||||
private readonly integration: AwsS3Integration,
|
||||
private readonly awsCredentialsManager: AwsCredentialsManager,
|
||||
logger: Logger,
|
||||
logger: LoggerService,
|
||||
taskRunner: TaskRunner,
|
||||
) {
|
||||
this.logger = logger.child({
|
||||
@@ -176,7 +176,7 @@ export class AwsS3EntityProvider implements EntityProvider {
|
||||
await this.scheduleFn();
|
||||
}
|
||||
|
||||
async refresh(logger: Logger) {
|
||||
async refresh(logger: LoggerService) {
|
||||
if (!this.connection) {
|
||||
throw new Error('Not initialized');
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Config } from '@backstage/config';
|
||||
import { EntityProvider } from '@backstage/plugin-catalog-node';
|
||||
import { EntityProviderConnection } from '@backstage/plugin-catalog-node';
|
||||
import { LocationSpec } from '@backstage/plugin-catalog-common';
|
||||
import { Logger } from 'winston';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
import { PluginTaskScheduler } from '@backstage/backend-tasks';
|
||||
import { ScmIntegrationRegistry } from '@backstage/integration';
|
||||
import { TaskRunner } from '@backstage/backend-tasks';
|
||||
@@ -18,13 +18,13 @@ import { TaskRunner } from '@backstage/backend-tasks';
|
||||
export class AzureDevOpsDiscoveryProcessor implements CatalogProcessor {
|
||||
constructor(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
});
|
||||
// (undocumented)
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
},
|
||||
): AzureDevOpsDiscoveryProcessor;
|
||||
// (undocumented)
|
||||
@@ -45,7 +45,7 @@ export class AzureDevOpsEntityProvider implements EntityProvider {
|
||||
static fromConfig(
|
||||
configRoot: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
schedule?: TaskRunner;
|
||||
scheduler?: PluginTaskScheduler;
|
||||
},
|
||||
@@ -53,6 +53,6 @@ export class AzureDevOpsEntityProvider implements EntityProvider {
|
||||
// (undocumented)
|
||||
getProviderName(): string;
|
||||
// (undocumented)
|
||||
refresh(logger: Logger): Promise<void>;
|
||||
refresh(logger: LoggerService): Promise<void>;
|
||||
}
|
||||
```
|
||||
|
||||
@@ -57,8 +57,7 @@
|
||||
"@backstage/plugin-catalog-common": "workspace:^",
|
||||
"@backstage/plugin-catalog-node": "workspace:^",
|
||||
"node-fetch": "^2.6.7",
|
||||
"uuid": "^9.0.0",
|
||||
"winston": "^3.2.1"
|
||||
"uuid": "^9.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/backend-test-utils": "workspace:^",
|
||||
|
||||
+2
-3
@@ -14,10 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { loggerToWinstonLogger } from '@backstage/backend-common';
|
||||
import {
|
||||
createBackendModule,
|
||||
coreServices,
|
||||
createBackendModule,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha';
|
||||
import { AzureDevOpsEntityProvider } from '../providers';
|
||||
@@ -41,7 +40,7 @@ export const catalogModuleAzureDevOpsEntityProvider = createBackendModule({
|
||||
async init({ config, catalog, logger, scheduler }) {
|
||||
catalog.addEntityProvider(
|
||||
AzureDevOpsEntityProvider.fromConfig(config, {
|
||||
logger: loggerToWinstonLogger(logger),
|
||||
logger,
|
||||
scheduler,
|
||||
}),
|
||||
);
|
||||
|
||||
+4
-4
@@ -27,8 +27,8 @@ import {
|
||||
processingResult,
|
||||
} from '@backstage/plugin-catalog-node';
|
||||
import { LocationSpec } from '@backstage/plugin-catalog-common';
|
||||
import { Logger } from 'winston';
|
||||
import { codeSearch } from '../lib';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
/**
|
||||
* Extracts repositories out of an Azure DevOps org.
|
||||
@@ -49,9 +49,9 @@ import { codeSearch } from '../lib';
|
||||
export class AzureDevOpsDiscoveryProcessor implements CatalogProcessor {
|
||||
private readonly integrations: ScmIntegrationRegistry;
|
||||
private readonly credentialsProvider: AzureDevOpsCredentialsProvider;
|
||||
private readonly logger: Logger;
|
||||
private readonly logger: LoggerService;
|
||||
|
||||
static fromConfig(config: Config, options: { logger: Logger }) {
|
||||
static fromConfig(config: Config, options: { logger: LoggerService }) {
|
||||
const integrations = ScmIntegrations.fromConfig(config);
|
||||
|
||||
return new AzureDevOpsDiscoveryProcessor({
|
||||
@@ -62,7 +62,7 @@ export class AzureDevOpsDiscoveryProcessor implements CatalogProcessor {
|
||||
|
||||
constructor(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
}) {
|
||||
this.integrations = options.integrations;
|
||||
this.logger = options.logger;
|
||||
|
||||
@@ -29,10 +29,10 @@ import {
|
||||
} from '@backstage/plugin-catalog-node';
|
||||
import { LocationSpec } from '@backstage/plugin-catalog-common';
|
||||
import { readAzureDevOpsConfigs } from './config';
|
||||
import { Logger } from 'winston';
|
||||
import { AzureDevOpsConfig } from './types';
|
||||
import * as uuid from 'uuid';
|
||||
import { codeSearch, CodeSearchResultItem } from '../lib';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
/**
|
||||
* Provider which discovers catalog files within an Azure DevOps repositories.
|
||||
@@ -42,14 +42,14 @@ import { codeSearch, CodeSearchResultItem } from '../lib';
|
||||
* @public
|
||||
*/
|
||||
export class AzureDevOpsEntityProvider implements EntityProvider {
|
||||
private readonly logger: Logger;
|
||||
private readonly logger: LoggerService;
|
||||
private readonly scheduleFn: () => Promise<void>;
|
||||
private connection?: EntityProviderConnection;
|
||||
|
||||
static fromConfig(
|
||||
configRoot: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
schedule?: TaskRunner;
|
||||
scheduler?: PluginTaskScheduler;
|
||||
},
|
||||
@@ -98,7 +98,7 @@ export class AzureDevOpsEntityProvider implements EntityProvider {
|
||||
private readonly config: AzureDevOpsConfig,
|
||||
private readonly integration: AzureIntegration,
|
||||
private readonly credentialsProvider: AzureDevOpsCredentialsProvider,
|
||||
logger: Logger,
|
||||
logger: LoggerService,
|
||||
taskRunner: TaskRunner,
|
||||
) {
|
||||
this.logger = logger.child({
|
||||
@@ -144,7 +144,7 @@ export class AzureDevOpsEntityProvider implements EntityProvider {
|
||||
await this.scheduleFn();
|
||||
}
|
||||
|
||||
async refresh(logger: Logger) {
|
||||
async refresh(logger: LoggerService) {
|
||||
if (!this.connection) {
|
||||
throw new Error('Not initialized');
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Entity } from '@backstage/catalog-model';
|
||||
import { EntityProvider } from '@backstage/plugin-catalog-node';
|
||||
import { EntityProviderConnection } from '@backstage/plugin-catalog-node';
|
||||
import { LocationSpec } from '@backstage/plugin-catalog-node';
|
||||
import { Logger } from 'winston';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
import { PluginTaskScheduler } from '@backstage/backend-tasks';
|
||||
import { Response as Response_2 } from 'node-fetch';
|
||||
import { TaskRunner } from '@backstage/backend-tasks';
|
||||
@@ -55,7 +55,7 @@ export class BitbucketServerEntityProvider implements EntityProvider {
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
parser?: BitbucketServerLocationParser;
|
||||
schedule?: TaskRunner;
|
||||
scheduler?: PluginTaskScheduler;
|
||||
@@ -64,7 +64,7 @@ export class BitbucketServerEntityProvider implements EntityProvider {
|
||||
// (undocumented)
|
||||
getProviderName(): string;
|
||||
// (undocumented)
|
||||
refresh(logger: Logger): Promise<void>;
|
||||
refresh(logger: LoggerService): Promise<void>;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
@@ -78,7 +78,7 @@ export type BitbucketServerListOptions = {
|
||||
export type BitbucketServerLocationParser = (options: {
|
||||
client: BitbucketServerClient;
|
||||
location: LocationSpec;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
}) => AsyncIterable<Entity>;
|
||||
|
||||
// @public (undocumented)
|
||||
|
||||
@@ -54,8 +54,7 @@
|
||||
"@backstage/plugin-catalog-node": "workspace:^",
|
||||
"@types/node-fetch": "^2.5.12",
|
||||
"node-fetch": "^2.6.7",
|
||||
"uuid": "^9.0.0",
|
||||
"winston": "^3.2.1"
|
||||
"uuid": "^9.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/backend-test-utils": "workspace:^",
|
||||
|
||||
+1
-3
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { loggerToWinstonLogger } from '@backstage/backend-common';
|
||||
import {
|
||||
coreServices,
|
||||
createBackendModule,
|
||||
@@ -37,9 +36,8 @@ export const catalogModuleBitbucketServerEntityProvider = createBackendModule({
|
||||
scheduler: coreServices.scheduler,
|
||||
},
|
||||
async init({ catalog, config, logger, scheduler }) {
|
||||
const winstonLogger = loggerToWinstonLogger(logger);
|
||||
const providers = BitbucketServerEntityProvider.fromConfig(config, {
|
||||
logger: winstonLogger,
|
||||
logger,
|
||||
scheduler,
|
||||
});
|
||||
|
||||
|
||||
+5
-5
@@ -26,7 +26,6 @@ import {
|
||||
EntityProvider,
|
||||
EntityProviderConnection,
|
||||
} from '@backstage/plugin-catalog-node';
|
||||
import { Logger } from 'winston';
|
||||
import * as uuid from 'uuid';
|
||||
import { BitbucketServerClient, paginated } from '../lib';
|
||||
import {
|
||||
@@ -37,6 +36,7 @@ import {
|
||||
BitbucketServerLocationParser,
|
||||
defaultBitbucketServerLocationParser,
|
||||
} from './BitbucketServerLocationParser';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
/**
|
||||
* Discovers catalog files located in Bitbucket Server.
|
||||
@@ -50,14 +50,14 @@ export class BitbucketServerEntityProvider implements EntityProvider {
|
||||
private readonly integration: BitbucketServerIntegration;
|
||||
private readonly config: BitbucketServerEntityProviderConfig;
|
||||
private readonly parser: BitbucketServerLocationParser;
|
||||
private readonly logger: Logger;
|
||||
private readonly logger: LoggerService;
|
||||
private readonly scheduleFn: () => Promise<void>;
|
||||
private connection?: EntityProviderConnection;
|
||||
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
parser?: BitbucketServerLocationParser;
|
||||
schedule?: TaskRunner;
|
||||
scheduler?: PluginTaskScheduler;
|
||||
@@ -102,7 +102,7 @@ export class BitbucketServerEntityProvider implements EntityProvider {
|
||||
private constructor(
|
||||
config: BitbucketServerEntityProviderConfig,
|
||||
integration: BitbucketServerIntegration,
|
||||
logger: Logger,
|
||||
logger: LoggerService,
|
||||
taskRunner: TaskRunner,
|
||||
parser?: BitbucketServerLocationParser,
|
||||
) {
|
||||
@@ -151,7 +151,7 @@ export class BitbucketServerEntityProvider implements EntityProvider {
|
||||
await this.scheduleFn();
|
||||
}
|
||||
|
||||
async refresh(logger: Logger) {
|
||||
async refresh(logger: LoggerService) {
|
||||
if (!this.connection) {
|
||||
throw new Error('Not initialized');
|
||||
}
|
||||
|
||||
+2
-2
@@ -19,8 +19,8 @@ import {
|
||||
locationSpecToLocationEntity,
|
||||
} from '@backstage/plugin-catalog-node';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { Logger } from 'winston';
|
||||
import { BitbucketServerClient } from '../lib';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
/**
|
||||
* A custom callback that reacts to finding a location by yielding entities.
|
||||
@@ -31,7 +31,7 @@ import { BitbucketServerClient } from '../lib';
|
||||
export type BitbucketServerLocationParser = (options: {
|
||||
client: BitbucketServerClient;
|
||||
location: LocationSpec;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
}) => AsyncIterable<Entity>;
|
||||
|
||||
export const defaultBitbucketServerLocationParser =
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Config } from '@backstage/config';
|
||||
import * as container from '@google-cloud/container';
|
||||
import { EntityProvider } from '@backstage/plugin-catalog-node';
|
||||
import { EntityProviderConnection } from '@backstage/plugin-catalog-node';
|
||||
import { Logger } from 'winston';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
import { SchedulerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
// @public
|
||||
@@ -25,7 +25,7 @@ export class GkeEntityProvider implements EntityProvider {
|
||||
scheduler,
|
||||
config,
|
||||
}: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
scheduler: SchedulerService;
|
||||
config: Config;
|
||||
}): GkeEntityProvider;
|
||||
@@ -36,7 +36,7 @@ export class GkeEntityProvider implements EntityProvider {
|
||||
config,
|
||||
clusterManagerClient,
|
||||
}: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
scheduler: SchedulerService;
|
||||
config: Config;
|
||||
clusterManagerClient: container.v1.ClusterManagerClient;
|
||||
|
||||
@@ -56,8 +56,7 @@
|
||||
"@backstage/config": "workspace:^",
|
||||
"@backstage/plugin-catalog-node": "workspace:^",
|
||||
"@backstage/plugin-kubernetes-common": "workspace:^",
|
||||
"@google-cloud/container": "^5.0.0",
|
||||
"winston": "^3.2.1"
|
||||
"@google-cloud/container": "^5.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/backend-test-utils": "workspace:^",
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { loggerToWinstonLogger } from '@backstage/backend-common';
|
||||
import {
|
||||
coreServices,
|
||||
createBackendModule,
|
||||
@@ -41,7 +40,7 @@ export const catalogModuleGcpGkeEntityProvider = createBackendModule({
|
||||
async init({ config, catalog, logger, scheduler }) {
|
||||
catalog.addEntityProvider(
|
||||
GkeEntityProvider.fromConfig({
|
||||
logger: loggerToWinstonLogger(logger),
|
||||
logger,
|
||||
scheduler,
|
||||
config,
|
||||
}),
|
||||
|
||||
@@ -14,16 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {
|
||||
TaskRunner,
|
||||
readTaskScheduleDefinitionFromConfig,
|
||||
TaskRunner,
|
||||
} from '@backstage/backend-tasks';
|
||||
import {
|
||||
DeferredEntity,
|
||||
EntityProvider,
|
||||
EntityProviderConnection,
|
||||
} from '@backstage/plugin-catalog-node';
|
||||
|
||||
import { Logger } from 'winston';
|
||||
import * as container from '@google-cloud/container';
|
||||
import {
|
||||
ANNOTATION_KUBERNETES_API_SERVER,
|
||||
@@ -33,7 +31,7 @@ import {
|
||||
ANNOTATION_KUBERNETES_DASHBOARD_PARAMETERS,
|
||||
} from '@backstage/plugin-kubernetes-common';
|
||||
import { Config } from '@backstage/config';
|
||||
import { SchedulerService } from '@backstage/backend-plugin-api';
|
||||
import { LoggerService, SchedulerService } from '@backstage/backend-plugin-api';
|
||||
import {
|
||||
ANNOTATION_LOCATION,
|
||||
ANNOTATION_ORIGIN_LOCATION,
|
||||
@@ -45,14 +43,14 @@ import {
|
||||
* @public
|
||||
*/
|
||||
export class GkeEntityProvider implements EntityProvider {
|
||||
private readonly logger: Logger;
|
||||
private readonly logger: LoggerService;
|
||||
private readonly scheduleFn: () => Promise<void>;
|
||||
private readonly gkeParents: string[];
|
||||
private readonly clusterManagerClient: container.v1.ClusterManagerClient;
|
||||
private connection?: EntityProviderConnection;
|
||||
|
||||
private constructor(
|
||||
logger: Logger,
|
||||
logger: LoggerService,
|
||||
taskRunner: TaskRunner,
|
||||
gkeParents: string[],
|
||||
clusterManagerClient: container.v1.ClusterManagerClient,
|
||||
@@ -68,7 +66,7 @@ export class GkeEntityProvider implements EntityProvider {
|
||||
scheduler,
|
||||
config,
|
||||
}: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
scheduler: SchedulerService;
|
||||
config: Config;
|
||||
}) {
|
||||
@@ -86,7 +84,7 @@ export class GkeEntityProvider implements EntityProvider {
|
||||
config,
|
||||
clusterManagerClient,
|
||||
}: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
scheduler: SchedulerService;
|
||||
config: Config;
|
||||
clusterManagerClient: container.v1.ClusterManagerClient;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { Config } from '@backstage/config';
|
||||
import { EntityProvider } from '@backstage/plugin-catalog-node';
|
||||
import { EntityProviderConnection } from '@backstage/plugin-catalog-node';
|
||||
import { Logger } from 'winston';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
import { PluginTaskScheduler } from '@backstage/backend-tasks';
|
||||
import { TaskRunner } from '@backstage/backend-tasks';
|
||||
|
||||
@@ -18,7 +18,7 @@ export class GerritEntityProvider implements EntityProvider {
|
||||
static fromConfig(
|
||||
configRoot: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
schedule?: TaskRunner;
|
||||
scheduler?: PluginTaskScheduler;
|
||||
},
|
||||
@@ -26,7 +26,7 @@ export class GerritEntityProvider implements EntityProvider {
|
||||
// (undocumented)
|
||||
getProviderName(): string;
|
||||
// (undocumented)
|
||||
refresh(logger: Logger): Promise<void>;
|
||||
refresh(logger: LoggerService): Promise<void>;
|
||||
}
|
||||
|
||||
// (No @packageDocumentation comment for this package)
|
||||
|
||||
@@ -54,8 +54,7 @@
|
||||
"@backstage/plugin-catalog-node": "workspace:^",
|
||||
"fs-extra": "^11.2.0",
|
||||
"node-fetch": "^2.6.7",
|
||||
"uuid": "^9.0.0",
|
||||
"winston": "^3.2.1"
|
||||
"uuid": "^9.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/backend-test-utils": "workspace:^",
|
||||
|
||||
+1
-3
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { loggerToWinstonLogger } from '@backstage/backend-common';
|
||||
import {
|
||||
coreServices,
|
||||
createBackendModule,
|
||||
@@ -37,9 +36,8 @@ export const catalogModuleGerritEntityProvider = createBackendModule({
|
||||
scheduler: coreServices.scheduler,
|
||||
},
|
||||
async init({ catalog, config, logger, scheduler }) {
|
||||
const winstonLogger = loggerToWinstonLogger(logger);
|
||||
const providers = GerritEntityProvider.fromConfig(config, {
|
||||
logger: winstonLogger,
|
||||
logger,
|
||||
scheduler,
|
||||
});
|
||||
|
||||
|
||||
@@ -32,23 +32,23 @@ import {
|
||||
ScmIntegrations,
|
||||
} from '@backstage/integration';
|
||||
import * as uuid from 'uuid';
|
||||
import { Logger } from 'winston';
|
||||
|
||||
import { readGerritConfigs } from './config';
|
||||
import { GerritProjectQueryResult, GerritProviderConfig } from './types';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
/** @public */
|
||||
export class GerritEntityProvider implements EntityProvider {
|
||||
private readonly config: GerritProviderConfig;
|
||||
private readonly integration: GerritIntegration;
|
||||
private readonly logger: Logger;
|
||||
private readonly logger: LoggerService;
|
||||
private readonly scheduleFn: () => Promise<void>;
|
||||
private connection?: EntityProviderConnection;
|
||||
|
||||
static fromConfig(
|
||||
configRoot: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
schedule?: TaskRunner;
|
||||
scheduler?: PluginTaskScheduler;
|
||||
},
|
||||
@@ -94,7 +94,7 @@ export class GerritEntityProvider implements EntityProvider {
|
||||
private constructor(
|
||||
config: GerritProviderConfig,
|
||||
integration: GerritIntegration,
|
||||
logger: Logger,
|
||||
logger: LoggerService,
|
||||
taskRunner: TaskRunner,
|
||||
) {
|
||||
this.config = config;
|
||||
@@ -139,7 +139,7 @@ export class GerritEntityProvider implements EntityProvider {
|
||||
};
|
||||
}
|
||||
|
||||
async refresh(logger: Logger): Promise<void> {
|
||||
async refresh(logger: LoggerService): Promise<void> {
|
||||
if (!this.connection) {
|
||||
throw new Error('Gerrit discovery connection not initialized');
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { loggerToWinstonLogger } from '@backstage/backend-common';
|
||||
import {
|
||||
coreServices,
|
||||
createBackendModule,
|
||||
@@ -111,7 +110,7 @@ export const catalogModuleGithubOrgEntityProvider = createBackendModule({
|
||||
schedule: scheduler.createScheduledTaskRunner(
|
||||
definition.schedule,
|
||||
),
|
||||
logger: loggerToWinstonLogger(logger),
|
||||
logger,
|
||||
userTransformer,
|
||||
teamTransformer,
|
||||
}),
|
||||
|
||||
@@ -11,7 +11,6 @@ import { Config } from '@backstage/config';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { EntityProvider } from '@backstage/plugin-catalog-node';
|
||||
import { EntityProviderConnection } from '@backstage/plugin-catalog-node';
|
||||
import { EventBroker } from '@backstage/plugin-events-node';
|
||||
import { EventParams } from '@backstage/plugin-events-node';
|
||||
import { EventsService } from '@backstage/plugin-events-node';
|
||||
import { EventSubscriber } from '@backstage/plugin-events-node';
|
||||
@@ -19,7 +18,7 @@ import { GithubCredentialsProvider } from '@backstage/integration';
|
||||
import { GithubIntegrationConfig } from '@backstage/integration';
|
||||
import { graphql } from '@octokit/graphql';
|
||||
import { LocationSpec } from '@backstage/plugin-catalog-node';
|
||||
import { Logger } from 'winston';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
import { PluginEndpointDiscovery } from '@backstage/backend-common';
|
||||
import { PluginTaskScheduler } from '@backstage/backend-tasks';
|
||||
import { ScmIntegrationRegistry } from '@backstage/integration';
|
||||
@@ -41,14 +40,14 @@ export const defaultUserTransformer: (
|
||||
export class GithubDiscoveryProcessor implements CatalogProcessor {
|
||||
constructor(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
});
|
||||
// (undocumented)
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
},
|
||||
): GithubDiscoveryProcessor;
|
||||
@@ -70,7 +69,7 @@ export class GitHubEntityProvider implements EntityProvider {
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
schedule?: TaskRunner;
|
||||
scheduler?: PluginTaskScheduler;
|
||||
},
|
||||
@@ -78,7 +77,7 @@ export class GitHubEntityProvider implements EntityProvider {
|
||||
// (undocumented)
|
||||
getProviderName(): string;
|
||||
// (undocumented)
|
||||
refresh(logger: Logger): Promise<void>;
|
||||
refresh(logger: LoggerService): Promise<void>;
|
||||
}
|
||||
|
||||
// @public
|
||||
@@ -90,7 +89,7 @@ export class GithubEntityProvider implements EntityProvider, EventSubscriber {
|
||||
config: Config,
|
||||
options: {
|
||||
events?: EventsService;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
schedule?: TaskRunner;
|
||||
scheduler?: PluginTaskScheduler;
|
||||
},
|
||||
@@ -100,7 +99,7 @@ export class GithubEntityProvider implements EntityProvider, EventSubscriber {
|
||||
// (undocumented)
|
||||
onEvent(params: EventParams): Promise<void>;
|
||||
// (undocumented)
|
||||
refresh(logger: Logger): Promise<void>;
|
||||
refresh(logger: LoggerService): Promise<void>;
|
||||
// (undocumented)
|
||||
supportsEventTopics(): string[];
|
||||
}
|
||||
@@ -147,7 +146,7 @@ export class GithubMultiOrgEntityProvider implements EntityProvider {
|
||||
gitHubConfig: GithubIntegrationConfig;
|
||||
githubCredentialsProvider: GithubCredentialsProvider;
|
||||
githubUrl: string;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
orgs?: string[];
|
||||
userTransformer?: UserTransformer;
|
||||
teamTransformer?: TeamTransformer;
|
||||
@@ -161,18 +160,16 @@ export class GithubMultiOrgEntityProvider implements EntityProvider {
|
||||
): GithubMultiOrgEntityProvider;
|
||||
// (undocumented)
|
||||
getProviderName(): string;
|
||||
read(options?: { logger?: Logger }): Promise<void>;
|
||||
read(options?: { logger?: LoggerService }): Promise<void>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface GithubMultiOrgEntityProviderOptions {
|
||||
// @deprecated
|
||||
eventBroker?: EventBroker;
|
||||
events?: EventsService;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
githubUrl: string;
|
||||
id: string;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
orgs?: string[];
|
||||
schedule?: 'manual' | TaskRunner;
|
||||
teamTransformer?: TeamTransformer;
|
||||
@@ -183,7 +180,7 @@ export interface GithubMultiOrgEntityProviderOptions {
|
||||
export class GithubMultiOrgReaderProcessor implements CatalogProcessor {
|
||||
constructor(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
orgs: GithubMultiOrgConfig;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
userTransformer?: UserTransformer;
|
||||
@@ -193,7 +190,7 @@ export class GithubMultiOrgReaderProcessor implements CatalogProcessor {
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
userTransformer?: UserTransformer;
|
||||
teamTransformer?: TeamTransformer;
|
||||
@@ -219,15 +216,13 @@ export class GitHubOrgEntityProvider extends GithubOrgEntityProvider {
|
||||
}
|
||||
|
||||
// @public
|
||||
export class GithubOrgEntityProvider
|
||||
implements EntityProvider, EventSubscriber
|
||||
{
|
||||
export class GithubOrgEntityProvider implements EntityProvider {
|
||||
constructor(options: {
|
||||
events?: EventsService;
|
||||
id: string;
|
||||
orgUrl: string;
|
||||
gitHubConfig: GithubIntegrationConfig;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
userTransformer?: UserTransformer;
|
||||
teamTransformer?: TeamTransformer;
|
||||
@@ -241,11 +236,7 @@ export class GithubOrgEntityProvider
|
||||
): GithubOrgEntityProvider;
|
||||
// (undocumented)
|
||||
getProviderName(): string;
|
||||
// (undocumented)
|
||||
onEvent(params: EventParams): Promise<void>;
|
||||
read(options?: { logger?: Logger }): Promise<void>;
|
||||
// (undocumented)
|
||||
supportsEventTopics(): string[];
|
||||
read(options?: { logger?: LoggerService }): Promise<void>;
|
||||
}
|
||||
|
||||
// @public @deprecated (undocumented)
|
||||
@@ -256,7 +247,7 @@ export interface GithubOrgEntityProviderOptions {
|
||||
events?: EventsService;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
id: string;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
orgUrl: string;
|
||||
schedule?: 'manual' | TaskRunner;
|
||||
teamTransformer?: TeamTransformer;
|
||||
@@ -267,14 +258,14 @@ export interface GithubOrgEntityProviderOptions {
|
||||
export class GithubOrgReaderProcessor implements CatalogProcessor {
|
||||
constructor(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
});
|
||||
// (undocumented)
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
},
|
||||
): GithubOrgReaderProcessor;
|
||||
|
||||
@@ -66,8 +66,7 @@
|
||||
"lodash": "^4.17.21",
|
||||
"minimatch": "^9.0.0",
|
||||
"node-fetch": "^2.6.7",
|
||||
"uuid": "^9.0.0",
|
||||
"winston": "^3.2.1"
|
||||
"uuid": "^9.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/backend-test-utils": "workspace:^",
|
||||
|
||||
@@ -20,12 +20,12 @@ import {
|
||||
EntityProvider,
|
||||
EntityProviderConnection,
|
||||
} from '@backstage/plugin-catalog-node';
|
||||
import { Logger } from 'winston';
|
||||
import { GithubEntityProvider } from './providers/GithubEntityProvider';
|
||||
import {
|
||||
GithubOrgEntityProvider,
|
||||
GithubOrgEntityProviderOptions,
|
||||
} from './providers/GithubOrgEntityProvider';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
/**
|
||||
* @public
|
||||
@@ -57,7 +57,7 @@ export class GitHubEntityProvider implements EntityProvider {
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
schedule?: TaskRunner;
|
||||
scheduler?: PluginTaskScheduler;
|
||||
},
|
||||
@@ -80,7 +80,7 @@ export class GitHubEntityProvider implements EntityProvider {
|
||||
return this.delegate.getProviderName();
|
||||
}
|
||||
|
||||
refresh(logger: Logger): Promise<void> {
|
||||
refresh(logger: LoggerService): Promise<void> {
|
||||
return this.delegate.refresh(logger);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,9 @@
|
||||
*/
|
||||
|
||||
import {
|
||||
createBackendModule,
|
||||
coreServices,
|
||||
createBackendModule,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
import { loggerToWinstonLogger } from '@backstage/backend-common';
|
||||
import {
|
||||
catalogAnalysisExtensionPoint,
|
||||
catalogProcessingExtensionPoint,
|
||||
@@ -68,7 +67,7 @@ export const githubCatalogModule = createBackendModule({
|
||||
catalog.addEntityProvider(
|
||||
GithubEntityProvider.fromConfig(config, {
|
||||
events,
|
||||
logger: loggerToWinstonLogger(logger),
|
||||
logger,
|
||||
scheduler,
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -28,8 +28,8 @@ import {
|
||||
processingResult,
|
||||
} from '@backstage/plugin-catalog-node';
|
||||
import { graphql } from '@octokit/graphql';
|
||||
import { Logger } from 'winston';
|
||||
import { getOrganizationRepositories } from '../lib';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
/**
|
||||
* Extracts repositories out of a GitHub org.
|
||||
@@ -49,13 +49,13 @@ import { getOrganizationRepositories } from '../lib';
|
||||
*/
|
||||
export class GithubDiscoveryProcessor implements CatalogProcessor {
|
||||
private readonly integrations: ScmIntegrationRegistry;
|
||||
private readonly logger: Logger;
|
||||
private readonly logger: LoggerService;
|
||||
private readonly githubCredentialsProvider: GithubCredentialsProvider;
|
||||
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
},
|
||||
) {
|
||||
@@ -69,7 +69,7 @@ export class GithubDiscoveryProcessor implements CatalogProcessor {
|
||||
|
||||
constructor(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
}) {
|
||||
this.integrations = options.integrations;
|
||||
|
||||
+4
-4
@@ -36,7 +36,6 @@ import {
|
||||
processingResult,
|
||||
} from '@backstage/plugin-catalog-node';
|
||||
import { graphql } from '@octokit/graphql';
|
||||
import { Logger } from 'winston';
|
||||
import {
|
||||
assignGroupsToUsers,
|
||||
buildOrgHierarchy,
|
||||
@@ -50,6 +49,7 @@ import {
|
||||
UserTransformer,
|
||||
} from '../lib';
|
||||
import { areGroupEntities, areUserEntities } from '../lib/guards';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
/**
|
||||
* Extracts teams and users out of a multiple GitHub orgs namespaced per org.
|
||||
@@ -61,13 +61,13 @@ import { areGroupEntities, areUserEntities } from '../lib/guards';
|
||||
export class GithubMultiOrgReaderProcessor implements CatalogProcessor {
|
||||
private readonly integrations: ScmIntegrationRegistry;
|
||||
private readonly orgs: GithubMultiOrgConfig;
|
||||
private readonly logger: Logger;
|
||||
private readonly logger: LoggerService;
|
||||
private readonly githubCredentialsProvider: GithubCredentialsProvider;
|
||||
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
userTransformer?: UserTransformer;
|
||||
teamTransformer?: TeamTransformer;
|
||||
@@ -86,7 +86,7 @@ export class GithubMultiOrgReaderProcessor implements CatalogProcessor {
|
||||
constructor(
|
||||
private options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
orgs: GithubMultiOrgConfig;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
userTransformer?: UserTransformer;
|
||||
|
||||
@@ -29,7 +29,6 @@ import {
|
||||
processingResult,
|
||||
} from '@backstage/plugin-catalog-node';
|
||||
import { graphql } from '@octokit/graphql';
|
||||
import { Logger } from 'winston';
|
||||
import {
|
||||
assignGroupsToUsers,
|
||||
buildOrgHierarchy,
|
||||
@@ -38,6 +37,7 @@ import {
|
||||
parseGithubOrgUrl,
|
||||
} from '../lib';
|
||||
import { areGroupEntities, areUserEntities } from '../lib/guards';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
type GraphQL = typeof graphql;
|
||||
|
||||
@@ -52,13 +52,13 @@ type GraphQL = typeof graphql;
|
||||
*/
|
||||
export class GithubOrgReaderProcessor implements CatalogProcessor {
|
||||
private readonly integrations: ScmIntegrationRegistry;
|
||||
private readonly logger: Logger;
|
||||
private readonly logger: LoggerService;
|
||||
private readonly githubCredentialsProvider: GithubCredentialsProvider;
|
||||
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
},
|
||||
) {
|
||||
@@ -72,7 +72,7 @@ export class GithubOrgReaderProcessor implements CatalogProcessor {
|
||||
|
||||
constructor(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
}) {
|
||||
this.integrations = options.integrations;
|
||||
|
||||
@@ -18,9 +18,9 @@ import { PluginTaskScheduler, TaskRunner } from '@backstage/backend-tasks';
|
||||
import { Config } from '@backstage/config';
|
||||
import {
|
||||
GithubCredentialsProvider,
|
||||
ScmIntegrations,
|
||||
GithubIntegrationConfig,
|
||||
GithubIntegration,
|
||||
GithubIntegrationConfig,
|
||||
ScmIntegrations,
|
||||
SingleInstanceGithubCredentialsProvider,
|
||||
} from '@backstage/integration';
|
||||
import {
|
||||
@@ -34,15 +34,14 @@ import { LocationSpec } from '@backstage/plugin-catalog-common';
|
||||
|
||||
import { graphql } from '@octokit/graphql';
|
||||
import * as uuid from 'uuid';
|
||||
import { Logger } from 'winston';
|
||||
import {
|
||||
readProviderConfigs,
|
||||
GithubEntityProviderConfig,
|
||||
readProviderConfigs,
|
||||
} from './GithubEntityProviderConfig';
|
||||
import { getOrganizationRepositories } from '../lib/github';
|
||||
import {
|
||||
satisfiesTopicFilter,
|
||||
satisfiesForkFilter,
|
||||
satisfiesTopicFilter,
|
||||
satisfiesVisibilityFilter,
|
||||
} from '../lib/util';
|
||||
|
||||
@@ -51,8 +50,9 @@ import {
|
||||
EventsService,
|
||||
EventSubscriber,
|
||||
} from '@backstage/plugin-events-node';
|
||||
import { PushEvent, Commit } from '@octokit/webhooks-types';
|
||||
import { Commit, PushEvent } from '@octokit/webhooks-types';
|
||||
import { Minimatch } from 'minimatch';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
const TOPIC_REPO_PUSH = 'github.push';
|
||||
|
||||
@@ -78,7 +78,7 @@ type Repository = {
|
||||
export class GithubEntityProvider implements EntityProvider, EventSubscriber {
|
||||
private readonly config: GithubEntityProviderConfig;
|
||||
private readonly events?: EventsService;
|
||||
private readonly logger: Logger;
|
||||
private readonly logger: LoggerService;
|
||||
private readonly integration: GithubIntegrationConfig;
|
||||
private readonly scheduleFn: () => Promise<void>;
|
||||
private connection?: EntityProviderConnection;
|
||||
@@ -88,7 +88,7 @@ export class GithubEntityProvider implements EntityProvider, EventSubscriber {
|
||||
config: Config,
|
||||
options: {
|
||||
events?: EventsService;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
schedule?: TaskRunner;
|
||||
scheduler?: PluginTaskScheduler;
|
||||
},
|
||||
@@ -132,7 +132,7 @@ export class GithubEntityProvider implements EntityProvider, EventSubscriber {
|
||||
private constructor(
|
||||
config: GithubEntityProviderConfig,
|
||||
integration: GithubIntegration,
|
||||
logger: Logger,
|
||||
logger: LoggerService,
|
||||
taskRunner: TaskRunner,
|
||||
events?: EventsService,
|
||||
) {
|
||||
@@ -187,7 +187,7 @@ export class GithubEntityProvider implements EntityProvider, EventSubscriber {
|
||||
};
|
||||
}
|
||||
|
||||
async refresh(logger: Logger) {
|
||||
async refresh(logger: LoggerService) {
|
||||
if (!this.connection) {
|
||||
throw new Error('Not initialized');
|
||||
}
|
||||
|
||||
+22
-25
@@ -19,13 +19,16 @@ import { GroupEntity, UserEntity } from '@backstage/catalog-model';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import { GithubCredentialsProvider } from '@backstage/integration';
|
||||
import { EntityProviderConnection } from '@backstage/plugin-catalog-node';
|
||||
import { EventSubscriber } from '@backstage/plugin-events-node';
|
||||
import {
|
||||
DefaultEventsService,
|
||||
EventsService,
|
||||
} from '@backstage/plugin-events-node';
|
||||
import { graphql } from '@octokit/graphql';
|
||||
import {
|
||||
GithubMultiOrgEntityProvider,
|
||||
withLocations,
|
||||
} from './GithubMultiOrgEntityProvider';
|
||||
import { Logger } from 'winston';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
jest.mock('@octokit/graphql');
|
||||
|
||||
@@ -43,7 +46,7 @@ describe('GithubMultiOrgEntityProvider', () => {
|
||||
describe('read', () => {
|
||||
let mockClient: jest.Mock<any, any, any>;
|
||||
let entityProviderConnection: EntityProviderConnection;
|
||||
let logger: Logger;
|
||||
let logger: LoggerService;
|
||||
let gitHubConfig: { host: string };
|
||||
let mockGetCredentials: jest.Mock<any, any, any>;
|
||||
let entityProvider: GithubMultiOrgEntityProvider;
|
||||
@@ -717,15 +720,16 @@ describe('GithubMultiOrgEntityProvider', () => {
|
||||
});
|
||||
|
||||
describe('events', () => {
|
||||
let onEvent: Function;
|
||||
let events: EventsService;
|
||||
|
||||
const entityProviderConnection: EntityProviderConnection = {
|
||||
applyMutation: jest.fn(),
|
||||
refresh: jest.fn(),
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
beforeEach(async () => {
|
||||
const logger = getVoidLogger();
|
||||
events = DefaultEventsService.create({ logger });
|
||||
const config = new ConfigReader({
|
||||
integrations: {
|
||||
github: [
|
||||
@@ -745,29 +749,22 @@ describe('GithubMultiOrgEntityProvider', () => {
|
||||
getCredentials: mockGetCredentials,
|
||||
};
|
||||
|
||||
const mockEventBroker = {
|
||||
publish: async () => {},
|
||||
subscribe: (subscriber: EventSubscriber) => {
|
||||
onEvent = subscriber.onEvent;
|
||||
},
|
||||
};
|
||||
|
||||
const entityProvider = GithubMultiOrgEntityProvider.fromConfig(config, {
|
||||
events,
|
||||
id: 'my-id',
|
||||
githubCredentialsProvider,
|
||||
githubUrl: 'https://github.com',
|
||||
logger,
|
||||
orgs: ['orgA', 'orgB'],
|
||||
eventBroker: mockEventBroker,
|
||||
});
|
||||
|
||||
entityProvider.connect(entityProviderConnection);
|
||||
await entityProvider.connect(entityProviderConnection);
|
||||
});
|
||||
|
||||
afterEach(() => jest.resetAllMocks());
|
||||
|
||||
it('should ignore events from non-applicable orgs', async () => {
|
||||
await onEvent({
|
||||
await events.publish({
|
||||
topic: 'github.organization',
|
||||
eventPayload: {
|
||||
action: 'member_added',
|
||||
@@ -787,7 +784,7 @@ describe('GithubMultiOrgEntityProvider', () => {
|
||||
|
||||
expect(entityProviderConnection.applyMutation).not.toHaveBeenCalled();
|
||||
|
||||
await onEvent({
|
||||
await events.publish({
|
||||
topic: 'github.installation',
|
||||
eventPayload: {
|
||||
action: 'created',
|
||||
@@ -901,7 +898,7 @@ describe('GithubMultiOrgEntityProvider', () => {
|
||||
|
||||
(graphql.defaults as jest.Mock).mockReturnValue(mockClient);
|
||||
|
||||
await onEvent({
|
||||
await events.publish({
|
||||
topic: 'github.installation',
|
||||
eventPayload: {
|
||||
action: 'created',
|
||||
@@ -1033,7 +1030,7 @@ describe('GithubMultiOrgEntityProvider', () => {
|
||||
|
||||
(graphql.defaults as jest.Mock).mockReturnValue(mockClient);
|
||||
|
||||
await onEvent({
|
||||
await events.publish({
|
||||
topic: 'github.organization',
|
||||
eventPayload: {
|
||||
action: 'member_added',
|
||||
@@ -1103,7 +1100,7 @@ describe('GithubMultiOrgEntityProvider', () => {
|
||||
|
||||
(graphql.defaults as jest.Mock).mockReturnValue(mockClient);
|
||||
|
||||
await onEvent({
|
||||
await events.publish({
|
||||
topic: 'github.organization',
|
||||
eventPayload: {
|
||||
action: 'member_removed',
|
||||
@@ -1198,7 +1195,7 @@ describe('GithubMultiOrgEntityProvider', () => {
|
||||
|
||||
(graphql.defaults as jest.Mock).mockReturnValue(mockClient);
|
||||
|
||||
await onEvent({
|
||||
await events.publish({
|
||||
topic: 'github.organization',
|
||||
eventPayload: {
|
||||
action: 'member_removed',
|
||||
@@ -1253,7 +1250,7 @@ describe('GithubMultiOrgEntityProvider', () => {
|
||||
|
||||
describe('team', () => {
|
||||
it('should create a new group from a new team', async () => {
|
||||
await onEvent({
|
||||
await events.publish({
|
||||
topic: 'github.team',
|
||||
eventPayload: {
|
||||
action: 'created',
|
||||
@@ -1312,7 +1309,7 @@ describe('GithubMultiOrgEntityProvider', () => {
|
||||
});
|
||||
|
||||
it('should remove a group from a deleted team', async () => {
|
||||
await onEvent({
|
||||
await events.publish({
|
||||
topic: 'github.team',
|
||||
eventPayload: {
|
||||
action: 'deleted',
|
||||
@@ -1467,7 +1464,7 @@ describe('GithubMultiOrgEntityProvider', () => {
|
||||
|
||||
(graphql.defaults as jest.Mock).mockReturnValue(mockClient);
|
||||
|
||||
await onEvent({
|
||||
await events.publish({
|
||||
topic: 'github.team',
|
||||
eventPayload: {
|
||||
action: 'edited',
|
||||
@@ -1676,7 +1673,7 @@ describe('GithubMultiOrgEntityProvider', () => {
|
||||
|
||||
(graphql.defaults as jest.Mock).mockReturnValue(mockClient);
|
||||
|
||||
await onEvent({
|
||||
await events.publish({
|
||||
topic: 'github.membership',
|
||||
eventPayload: {
|
||||
action: 'added',
|
||||
@@ -1848,7 +1845,7 @@ describe('GithubMultiOrgEntityProvider', () => {
|
||||
|
||||
(graphql.defaults as jest.Mock).mockReturnValue(mockClient);
|
||||
|
||||
await onEvent({
|
||||
await events.publish({
|
||||
topic: 'github.membership',
|
||||
eventPayload: {
|
||||
action: 'removed',
|
||||
|
||||
+7
-29
@@ -38,19 +38,15 @@ import {
|
||||
EntityProvider,
|
||||
EntityProviderConnection,
|
||||
} from '@backstage/plugin-catalog-node';
|
||||
import {
|
||||
EventBroker,
|
||||
EventParams,
|
||||
EventsService,
|
||||
} from '@backstage/plugin-events-node';
|
||||
import { EventParams, EventsService } from '@backstage/plugin-events-node';
|
||||
import { graphql } from '@octokit/graphql';
|
||||
import {
|
||||
InstallationCreatedEvent,
|
||||
InstallationEvent,
|
||||
MembershipEvent,
|
||||
OrganizationEvent,
|
||||
OrganizationMemberAddedEvent,
|
||||
OrganizationMemberRemovedEvent,
|
||||
MembershipEvent,
|
||||
TeamCreatedEvent,
|
||||
TeamDeletedEvent,
|
||||
TeamEditedEvent,
|
||||
@@ -58,7 +54,6 @@ import {
|
||||
} from '@octokit/webhooks-types';
|
||||
import { merge } from 'lodash';
|
||||
import * as uuid from 'uuid';
|
||||
import { Logger } from 'winston';
|
||||
|
||||
import {
|
||||
assignGroupsToUsers,
|
||||
@@ -83,6 +78,7 @@ import {
|
||||
} from '../lib/github';
|
||||
import { splitTeamSlug } from '../lib/util';
|
||||
import { areGroupEntities, areUserEntities } from '../lib/guards';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
const EVENT_TOPICS = [
|
||||
'github.installation',
|
||||
@@ -140,7 +136,7 @@ export interface GithubMultiOrgEntityProviderOptions {
|
||||
/**
|
||||
* The logger to use.
|
||||
*/
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
|
||||
/**
|
||||
* Optionally supply a custom credentials provider, replacing the default one.
|
||||
@@ -157,13 +153,6 @@ export interface GithubMultiOrgEntityProviderOptions {
|
||||
* By default, groups will be namespaced according to their GitHub org.
|
||||
*/
|
||||
teamTransformer?: TeamTransformer;
|
||||
|
||||
/**
|
||||
* An EventBroker to subscribe this provider to GitHub events to trigger delta mutations
|
||||
*
|
||||
* @deprecated Use `events` instead.
|
||||
*/
|
||||
eventBroker?: EventBroker;
|
||||
}
|
||||
|
||||
type CreateDeltaOperation = (entities: Entity[]) => {
|
||||
@@ -213,13 +202,6 @@ export class GithubMultiOrgEntityProvider implements EntityProvider {
|
||||
|
||||
provider.schedule(options.schedule);
|
||||
|
||||
if (options.eventBroker) {
|
||||
options.eventBroker.subscribe({
|
||||
supportsEventTopics: provider.supportsEventTopics.bind(provider),
|
||||
onEvent: provider.onEvent.bind(provider),
|
||||
});
|
||||
}
|
||||
|
||||
return provider;
|
||||
}
|
||||
|
||||
@@ -230,7 +212,7 @@ export class GithubMultiOrgEntityProvider implements EntityProvider {
|
||||
gitHubConfig: GithubIntegrationConfig;
|
||||
githubCredentialsProvider: GithubCredentialsProvider;
|
||||
githubUrl: string;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
orgs?: string[];
|
||||
userTransformer?: UserTransformer;
|
||||
teamTransformer?: TeamTransformer;
|
||||
@@ -257,7 +239,7 @@ export class GithubMultiOrgEntityProvider implements EntityProvider {
|
||||
* Runs one single complete ingestion. This is only necessary if you use
|
||||
* manual scheduling.
|
||||
*/
|
||||
async read(options?: { logger?: Logger }) {
|
||||
async read(options?: { logger?: LoggerService }) {
|
||||
if (!this.connection) {
|
||||
throw new Error('Not initialized');
|
||||
}
|
||||
@@ -336,10 +318,6 @@ export class GithubMultiOrgEntityProvider implements EntityProvider {
|
||||
markCommitComplete();
|
||||
}
|
||||
|
||||
private supportsEventTopics(): string[] {
|
||||
return EVENT_TOPICS;
|
||||
}
|
||||
|
||||
private async onEvent(params: EventParams): Promise<void> {
|
||||
const { logger } = this.options;
|
||||
logger.debug(`Received event from ${params.topic}`);
|
||||
@@ -925,7 +903,7 @@ export class GithubMultiOrgEntityProvider implements EntityProvider {
|
||||
}
|
||||
|
||||
// Helps wrap the timing and logging behaviors
|
||||
function trackProgress(logger: Logger) {
|
||||
function trackProgress(logger: LoggerService) {
|
||||
let timestamp = Date.now();
|
||||
let summary: string;
|
||||
|
||||
|
||||
+31
-16
@@ -22,7 +22,10 @@ import {
|
||||
} from '@backstage/integration';
|
||||
import { EntityProviderConnection } from '@backstage/plugin-catalog-node';
|
||||
import { graphql } from '@octokit/graphql';
|
||||
import { EventParams } from '@backstage/plugin-events-node';
|
||||
import {
|
||||
DefaultEventsService,
|
||||
EventParams,
|
||||
} from '@backstage/plugin-events-node';
|
||||
import { GithubOrgEntityProvider } from './GithubOrgEntityProvider';
|
||||
import { withLocations } from '../lib/withLocations';
|
||||
|
||||
@@ -267,6 +270,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
};
|
||||
|
||||
const logger = getVoidLogger();
|
||||
const events = DefaultEventsService.create({ logger });
|
||||
const gitHubConfig: GithubIntegrationConfig = {
|
||||
host: 'github.com',
|
||||
};
|
||||
@@ -281,6 +285,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
};
|
||||
|
||||
const entityProvider = new GithubOrgEntityProvider({
|
||||
events,
|
||||
id: 'my-id',
|
||||
githubCredentialsProvider,
|
||||
orgUrl: 'https://github.com/backstage',
|
||||
@@ -288,7 +293,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
logger,
|
||||
});
|
||||
|
||||
entityProvider.connect(entityProviderConnection);
|
||||
await entityProvider.connect(entityProviderConnection);
|
||||
|
||||
const expectedEntity = {
|
||||
apiVersion: 'backstage.io/v1alpha1',
|
||||
@@ -330,8 +335,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
await entityProvider.onEvent(event);
|
||||
await events.publish(event);
|
||||
|
||||
expect(entityProviderConnection.applyMutation).toHaveBeenCalledTimes(1);
|
||||
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
|
||||
@@ -353,6 +357,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
};
|
||||
|
||||
const logger = getVoidLogger();
|
||||
const events = DefaultEventsService.create({ logger });
|
||||
const gitHubConfig: GithubIntegrationConfig = {
|
||||
host: 'github.com',
|
||||
};
|
||||
@@ -367,6 +372,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
};
|
||||
|
||||
const entityProvider = new GithubOrgEntityProvider({
|
||||
events,
|
||||
id: 'my-id',
|
||||
githubCredentialsProvider,
|
||||
orgUrl: 'https://github.com/backstage',
|
||||
@@ -374,7 +380,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
logger,
|
||||
});
|
||||
|
||||
entityProvider.connect(entityProviderConnection);
|
||||
await entityProvider.connect(entityProviderConnection);
|
||||
|
||||
const expectedEntity = {
|
||||
apiVersion: 'backstage.io/v1alpha1',
|
||||
@@ -416,8 +422,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
await entityProvider.onEvent(event);
|
||||
await events.publish(event);
|
||||
|
||||
expect(entityProviderConnection.applyMutation).toHaveBeenCalledTimes(1);
|
||||
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
|
||||
@@ -439,6 +444,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
};
|
||||
|
||||
const logger = getVoidLogger();
|
||||
const events = DefaultEventsService.create({ logger });
|
||||
const gitHubConfig: GithubIntegrationConfig = {
|
||||
host: 'github.com',
|
||||
};
|
||||
@@ -453,6 +459,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
};
|
||||
|
||||
const entityProvider = new GithubOrgEntityProvider({
|
||||
events,
|
||||
id: 'my-id',
|
||||
githubCredentialsProvider,
|
||||
orgUrl: 'https://github.com/backstage',
|
||||
@@ -508,7 +515,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
},
|
||||
};
|
||||
|
||||
await entityProvider.onEvent(event);
|
||||
await events.publish(event);
|
||||
|
||||
expect(entityProviderConnection.applyMutation).toHaveBeenCalledTimes(1);
|
||||
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
|
||||
@@ -530,6 +537,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
};
|
||||
|
||||
const logger = getVoidLogger();
|
||||
const events = DefaultEventsService.create({ logger });
|
||||
const gitHubConfig: GithubIntegrationConfig = {
|
||||
host: 'github.com',
|
||||
};
|
||||
@@ -544,6 +552,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
};
|
||||
|
||||
const entityProvider = new GithubOrgEntityProvider({
|
||||
events,
|
||||
id: 'my-id',
|
||||
githubCredentialsProvider,
|
||||
orgUrl: 'https://github.com/backstage',
|
||||
@@ -551,7 +560,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
logger,
|
||||
});
|
||||
|
||||
entityProvider.connect(entityProviderConnection);
|
||||
await entityProvider.connect(entityProviderConnection);
|
||||
|
||||
const expectedEntity = {
|
||||
apiVersion: 'backstage.io/v1alpha1',
|
||||
@@ -600,7 +609,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
},
|
||||
};
|
||||
|
||||
await entityProvider.onEvent(event);
|
||||
await events.publish(event);
|
||||
|
||||
expect(entityProviderConnection.applyMutation).toHaveBeenCalledTimes(1);
|
||||
expect(entityProviderConnection.applyMutation).toHaveBeenCalledWith({
|
||||
@@ -622,6 +631,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
};
|
||||
|
||||
const logger = getVoidLogger();
|
||||
const events = DefaultEventsService.create({ logger });
|
||||
const gitHubConfig: GithubIntegrationConfig = {
|
||||
host: 'github.com',
|
||||
};
|
||||
@@ -636,6 +646,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
};
|
||||
|
||||
const entityProvider = new GithubOrgEntityProvider({
|
||||
events,
|
||||
id: 'my-id',
|
||||
githubCredentialsProvider,
|
||||
orgUrl: 'https://github.com/backstage',
|
||||
@@ -717,7 +728,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
|
||||
(graphql.defaults as jest.Mock).mockReturnValue(mockClient);
|
||||
|
||||
entityProvider.connect(entityProviderConnection);
|
||||
await entityProvider.connect(entityProviderConnection);
|
||||
|
||||
const event: EventParams = {
|
||||
topic: 'github.team',
|
||||
@@ -744,7 +755,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
},
|
||||
};
|
||||
|
||||
await entityProvider.onEvent(event);
|
||||
await events.publish(event);
|
||||
await new Promise(process.nextTick);
|
||||
|
||||
expect(entityProviderConnection.applyMutation).toHaveBeenCalledTimes(1);
|
||||
@@ -871,6 +882,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
};
|
||||
|
||||
const logger = getVoidLogger();
|
||||
const events = DefaultEventsService.create({ logger });
|
||||
const gitHubConfig: GithubIntegrationConfig = {
|
||||
host: 'github.com',
|
||||
};
|
||||
@@ -885,6 +897,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
};
|
||||
|
||||
const entityProvider = new GithubOrgEntityProvider({
|
||||
events,
|
||||
id: 'my-id',
|
||||
githubCredentialsProvider,
|
||||
orgUrl: 'https://github.com/backstage',
|
||||
@@ -965,7 +978,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
});
|
||||
|
||||
(graphql.defaults as jest.Mock).mockReturnValue(mockClient);
|
||||
entityProvider.connect(entityProviderConnection);
|
||||
await entityProvider.connect(entityProviderConnection);
|
||||
|
||||
const event: EventParams = {
|
||||
topic: 'github.membership',
|
||||
@@ -989,7 +1002,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
},
|
||||
};
|
||||
|
||||
await entityProvider.onEvent(event);
|
||||
await events.publish(event);
|
||||
await new Promise(process.nextTick);
|
||||
|
||||
expect(entityProviderConnection.applyMutation).toHaveBeenCalledTimes(1);
|
||||
@@ -1117,6 +1130,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
};
|
||||
|
||||
const logger = getVoidLogger();
|
||||
const events = DefaultEventsService.create({ logger });
|
||||
const gitHubConfig: GithubIntegrationConfig = {
|
||||
host: 'github.com',
|
||||
};
|
||||
@@ -1131,6 +1145,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
};
|
||||
|
||||
const entityProvider = new GithubOrgEntityProvider({
|
||||
events,
|
||||
id: 'my-id',
|
||||
githubCredentialsProvider,
|
||||
orgUrl: 'https://github.com/backstage',
|
||||
@@ -1187,7 +1202,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
});
|
||||
|
||||
(graphql.defaults as jest.Mock).mockReturnValue(mockClient);
|
||||
entityProvider.connect(entityProviderConnection);
|
||||
await entityProvider.connect(entityProviderConnection);
|
||||
|
||||
const event: EventParams = {
|
||||
topic: 'github.membership',
|
||||
@@ -1211,7 +1226,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
},
|
||||
};
|
||||
|
||||
await entityProvider.onEvent(event);
|
||||
await events.publish(event);
|
||||
await new Promise(process.nextTick);
|
||||
|
||||
expect(entityProviderConnection.applyMutation).toHaveBeenCalledTimes(1);
|
||||
|
||||
@@ -28,11 +28,7 @@ import {
|
||||
EntityProvider,
|
||||
EntityProviderConnection,
|
||||
} from '@backstage/plugin-catalog-node';
|
||||
import {
|
||||
EventParams,
|
||||
EventsService,
|
||||
EventSubscriber,
|
||||
} from '@backstage/plugin-events-node';
|
||||
import { EventParams, EventsService } from '@backstage/plugin-events-node';
|
||||
import { graphql } from '@octokit/graphql';
|
||||
import {
|
||||
MembershipEvent,
|
||||
@@ -43,28 +39,28 @@ import {
|
||||
TeamEvent,
|
||||
} from '@octokit/webhooks-types';
|
||||
import * as uuid from 'uuid';
|
||||
import { Logger } from 'winston';
|
||||
import {
|
||||
TeamTransformer,
|
||||
UserTransformer,
|
||||
defaultOrganizationTeamTransformer,
|
||||
defaultUserTransformer,
|
||||
TeamTransformer,
|
||||
UserTransformer,
|
||||
} from '../lib/defaultTransformers';
|
||||
import {
|
||||
DeferredEntitiesBuilder,
|
||||
GithubTeam,
|
||||
createAddEntitiesOperation,
|
||||
createRemoveEntitiesOperation,
|
||||
createReplaceEntitiesOperation,
|
||||
DeferredEntitiesBuilder,
|
||||
getOrganizationTeam,
|
||||
getOrganizationTeams,
|
||||
getOrganizationTeamsFromUsers,
|
||||
getOrganizationUsers,
|
||||
GithubTeam,
|
||||
} from '../lib/github';
|
||||
import { assignGroupsToUsers, buildOrgHierarchy } from '../lib/org';
|
||||
import { parseGithubOrgUrl } from '../lib/util';
|
||||
import { withLocations } from '../lib/withLocations';
|
||||
import { areGroupEntities, areUserEntities } from '../lib/guards';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
const EVENT_TOPICS = [
|
||||
'github.membership',
|
||||
@@ -115,7 +111,7 @@ export interface GithubOrgEntityProviderOptions {
|
||||
/**
|
||||
* The logger to use.
|
||||
*/
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
|
||||
/**
|
||||
* Optionally supply a custom credentials provider, replacing the default one.
|
||||
@@ -138,9 +134,7 @@ export interface GithubOrgEntityProviderOptions {
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export class GithubOrgEntityProvider
|
||||
implements EntityProvider, EventSubscriber
|
||||
{
|
||||
export class GithubOrgEntityProvider implements EntityProvider {
|
||||
private readonly credentialsProvider: GithubCredentialsProvider;
|
||||
private connection?: EntityProviderConnection;
|
||||
private scheduleFn?: () => Promise<void>;
|
||||
@@ -183,7 +177,7 @@ export class GithubOrgEntityProvider
|
||||
id: string;
|
||||
orgUrl: string;
|
||||
gitHubConfig: GithubIntegrationConfig;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
userTransformer?: UserTransformer;
|
||||
teamTransformer?: TeamTransformer;
|
||||
@@ -214,7 +208,7 @@ export class GithubOrgEntityProvider
|
||||
* Runs one single complete ingestion. This is only necessary if you use
|
||||
* manual scheduling.
|
||||
*/
|
||||
async read(options?: { logger?: Logger }) {
|
||||
async read(options?: { logger?: LoggerService }) {
|
||||
if (!this.connection) {
|
||||
throw new Error('Not initialized');
|
||||
}
|
||||
@@ -268,8 +262,7 @@ export class GithubOrgEntityProvider
|
||||
markCommitComplete();
|
||||
}
|
||||
|
||||
/** {@inheritdoc @backstage/plugin-events-node#EventSubscriber.onEvent} */
|
||||
async onEvent(params: EventParams): Promise<void> {
|
||||
private async onEvent(params: EventParams): Promise<void> {
|
||||
const { logger } = this.options;
|
||||
logger.debug(`Received event from ${params.topic}`);
|
||||
|
||||
@@ -335,11 +328,6 @@ export class GithubOrgEntityProvider
|
||||
return;
|
||||
}
|
||||
|
||||
/** {@inheritdoc @backstage/plugin-events-node#EventSubscriber.supportsEventTopics} */
|
||||
supportsEventTopics(): string[] {
|
||||
return EVENT_TOPICS;
|
||||
}
|
||||
|
||||
private async onTeamEditedInOrganization(
|
||||
event: TeamEditedEvent,
|
||||
createDeltaOperation: DeferredEntitiesBuilder,
|
||||
@@ -618,7 +606,7 @@ export class GithubOrgEntityProvider
|
||||
}
|
||||
|
||||
// Helps wrap the timing and logging behaviors
|
||||
function trackProgress(logger: Logger) {
|
||||
function trackProgress(logger: LoggerService) {
|
||||
let timestamp = Date.now();
|
||||
let summary: string;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import { EntityProviderConnection } from '@backstage/plugin-catalog-node';
|
||||
import { GitLabIntegrationConfig } from '@backstage/integration';
|
||||
import { GroupEntity } from '@backstage/catalog-model';
|
||||
import { LocationSpec } from '@backstage/plugin-catalog-node';
|
||||
import { Logger } from 'winston';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
import { PluginTaskScheduler } from '@backstage/backend-tasks';
|
||||
import { TaskRunner } from '@backstage/backend-tasks';
|
||||
import { TaskScheduleDefinition } from '@backstage/backend-tasks';
|
||||
@@ -25,7 +25,7 @@ export class GitlabDiscoveryEntityProvider implements EntityProvider {
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
schedule?: TaskRunner;
|
||||
scheduler?: PluginTaskScheduler;
|
||||
},
|
||||
@@ -33,7 +33,7 @@ export class GitlabDiscoveryEntityProvider implements EntityProvider {
|
||||
// (undocumented)
|
||||
getProviderName(): string;
|
||||
// (undocumented)
|
||||
refresh(logger: Logger): Promise<void>;
|
||||
refresh(logger: LoggerService): Promise<void>;
|
||||
}
|
||||
|
||||
// @public
|
||||
@@ -42,7 +42,7 @@ export class GitLabDiscoveryProcessor implements CatalogProcessor {
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
skipReposWithoutExactFileMatch?: boolean;
|
||||
skipForkedRepos?: boolean;
|
||||
},
|
||||
@@ -80,7 +80,7 @@ export class GitlabOrgDiscoveryEntityProvider implements EntityProvider {
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
schedule?: TaskRunner;
|
||||
scheduler?: PluginTaskScheduler;
|
||||
userTransformer?: UserTransformer;
|
||||
|
||||
@@ -54,8 +54,7 @@
|
||||
"@backstage/plugin-catalog-node": "workspace:^",
|
||||
"lodash": "^4.17.21",
|
||||
"node-fetch": "^2.6.7",
|
||||
"uuid": "^9.0.0",
|
||||
"winston": "^3.2.1"
|
||||
"uuid": "^9.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/backend-test-utils": "workspace:^",
|
||||
|
||||
@@ -30,8 +30,8 @@ import {
|
||||
LocationSpec,
|
||||
processingResult,
|
||||
} from '@backstage/plugin-catalog-node';
|
||||
import { Logger } from 'winston';
|
||||
import { GitLabClient, GitLabProject, paginated } from './lib';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
/**
|
||||
* Extracts repositories out of an GitLab instance.
|
||||
@@ -39,7 +39,7 @@ import { GitLabClient, GitLabProject, paginated } from './lib';
|
||||
*/
|
||||
export class GitLabDiscoveryProcessor implements CatalogProcessor {
|
||||
private readonly integrations: ScmIntegrationRegistry;
|
||||
private readonly logger: Logger;
|
||||
private readonly logger: LoggerService;
|
||||
private readonly cache: CacheClient;
|
||||
private readonly skipReposWithoutExactFileMatch: boolean;
|
||||
private readonly skipForkedRepos: boolean;
|
||||
@@ -47,7 +47,7 @@ export class GitLabDiscoveryProcessor implements CatalogProcessor {
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
skipReposWithoutExactFileMatch?: boolean;
|
||||
skipForkedRepos?: boolean;
|
||||
},
|
||||
@@ -66,7 +66,7 @@ export class GitLabDiscoveryProcessor implements CatalogProcessor {
|
||||
private constructor(options: {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
pluginCache: PluginCacheManager;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
skipReposWithoutExactFileMatch?: boolean;
|
||||
skipForkedRepos?: boolean;
|
||||
}) {
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
GitLabIntegrationConfig,
|
||||
} from '@backstage/integration';
|
||||
import fetch from 'node-fetch';
|
||||
import { Logger } from 'winston';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
import {
|
||||
GitLabDescendantGroupsResponse,
|
||||
@@ -47,9 +47,12 @@ interface UserListOptions extends CommonListOptions {
|
||||
|
||||
export class GitLabClient {
|
||||
private readonly config: GitLabIntegrationConfig;
|
||||
private readonly logger: Logger;
|
||||
private readonly logger: LoggerService;
|
||||
|
||||
constructor(options: { config: GitLabIntegrationConfig; logger: Logger }) {
|
||||
constructor(options: {
|
||||
config: GitLabIntegrationConfig;
|
||||
logger: LoggerService;
|
||||
}) {
|
||||
this.config = options.config;
|
||||
this.logger = options.logger;
|
||||
}
|
||||
|
||||
+2
-3
@@ -15,10 +15,9 @@
|
||||
*/
|
||||
|
||||
import {
|
||||
createBackendModule,
|
||||
coreServices,
|
||||
createBackendModule,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
import { loggerToWinstonLogger } from '@backstage/backend-common';
|
||||
import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha';
|
||||
import { GitlabDiscoveryEntityProvider } from '../providers';
|
||||
|
||||
@@ -41,7 +40,7 @@ export const catalogModuleGitlabDiscoveryEntityProvider = createBackendModule({
|
||||
async init({ config, catalog, logger, scheduler }) {
|
||||
catalog.addEntityProvider(
|
||||
GitlabDiscoveryEntityProvider.fromConfig(config, {
|
||||
logger: loggerToWinstonLogger(logger),
|
||||
logger,
|
||||
scheduler,
|
||||
}),
|
||||
);
|
||||
|
||||
+5
-5
@@ -24,7 +24,6 @@ import {
|
||||
locationSpecToLocationEntity,
|
||||
} from '@backstage/plugin-catalog-node';
|
||||
import * as uuid from 'uuid';
|
||||
import { Logger } from 'winston';
|
||||
import {
|
||||
GitLabClient,
|
||||
GitLabProject,
|
||||
@@ -32,6 +31,7 @@ import {
|
||||
paginated,
|
||||
readGitlabConfigs,
|
||||
} from '../lib';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
type Result = {
|
||||
scanned: number;
|
||||
@@ -45,14 +45,14 @@ type Result = {
|
||||
export class GitlabDiscoveryEntityProvider implements EntityProvider {
|
||||
private readonly config: GitlabProviderConfig;
|
||||
private readonly integration: GitLabIntegration;
|
||||
private readonly logger: Logger;
|
||||
private readonly logger: LoggerService;
|
||||
private readonly scheduleFn: () => Promise<void>;
|
||||
private connection?: EntityProviderConnection;
|
||||
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
schedule?: TaskRunner;
|
||||
scheduler?: PluginTaskScheduler;
|
||||
},
|
||||
@@ -98,7 +98,7 @@ export class GitlabDiscoveryEntityProvider implements EntityProvider {
|
||||
private constructor(options: {
|
||||
config: GitlabProviderConfig;
|
||||
integration: GitLabIntegration;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
taskRunner: TaskRunner;
|
||||
}) {
|
||||
this.config = options.config;
|
||||
@@ -143,7 +143,7 @@ export class GitlabDiscoveryEntityProvider implements EntityProvider {
|
||||
};
|
||||
}
|
||||
|
||||
async refresh(logger: Logger): Promise<void> {
|
||||
async refresh(logger: LoggerService): Promise<void> {
|
||||
if (!this.connection) {
|
||||
throw new Error(
|
||||
`Gitlab discovery connection not initialized for ${this.getProviderName()}`,
|
||||
|
||||
+8
-8
@@ -27,7 +27,7 @@ import {
|
||||
} from '@backstage/plugin-catalog-node';
|
||||
import { merge } from 'lodash';
|
||||
import * as uuid from 'uuid';
|
||||
import { Logger } from 'winston';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
import {
|
||||
GitLabClient,
|
||||
@@ -38,14 +38,14 @@ import {
|
||||
import {
|
||||
GitLabGroup,
|
||||
GitLabUser,
|
||||
GroupNameTransformer,
|
||||
GroupTransformer as GroupEntitiesTransformer,
|
||||
PagedResponse,
|
||||
UserTransformer,
|
||||
GroupTransformer as GroupEntitiesTransformer,
|
||||
GroupNameTransformer,
|
||||
} from '../lib/types';
|
||||
import {
|
||||
defaultGroupNameTransformer,
|
||||
defaultGroupEntitiesTransformer,
|
||||
defaultGroupNameTransformer,
|
||||
defaultUserTransformer,
|
||||
} from '../lib/defaultTransformers';
|
||||
|
||||
@@ -66,7 +66,7 @@ type GroupResult = {
|
||||
export class GitlabOrgDiscoveryEntityProvider implements EntityProvider {
|
||||
private readonly config: GitlabProviderConfig;
|
||||
private readonly integration: GitLabIntegration;
|
||||
private readonly logger: Logger;
|
||||
private readonly logger: LoggerService;
|
||||
private readonly scheduleFn: () => Promise<void>;
|
||||
private connection?: EntityProviderConnection;
|
||||
private userTransformer: UserTransformer;
|
||||
@@ -76,7 +76,7 @@ export class GitlabOrgDiscoveryEntityProvider implements EntityProvider {
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: {
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
schedule?: TaskRunner;
|
||||
scheduler?: PluginTaskScheduler;
|
||||
userTransformer?: UserTransformer;
|
||||
@@ -136,7 +136,7 @@ export class GitlabOrgDiscoveryEntityProvider implements EntityProvider {
|
||||
private constructor(options: {
|
||||
config: GitlabProviderConfig;
|
||||
integration: GitLabIntegration;
|
||||
logger: Logger;
|
||||
logger: LoggerService;
|
||||
taskRunner: TaskRunner;
|
||||
userTransformer?: UserTransformer;
|
||||
groupEntitiesTransformer?: GroupEntitiesTransformer;
|
||||
@@ -189,7 +189,7 @@ export class GitlabOrgDiscoveryEntityProvider implements EntityProvider {
|
||||
};
|
||||
}
|
||||
|
||||
private async refresh(logger: Logger): Promise<void> {
|
||||
private async refresh(logger: LoggerService): Promise<void> {
|
||||
if (!this.connection) {
|
||||
throw new Error(
|
||||
`Gitlab discovery connection not initialized for ${this.getProviderName()}`,
|
||||
|
||||
@@ -65,8 +65,7 @@
|
||||
"express-promise-router": "^4.1.0",
|
||||
"knex": "^3.0.0",
|
||||
"luxon": "^3.0.0",
|
||||
"uuid": "^9.0.0",
|
||||
"winston": "^3.2.1"
|
||||
"uuid": "^9.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/backend-defaults": "workspace:^",
|
||||
|
||||
@@ -15,11 +15,10 @@
|
||||
*/
|
||||
|
||||
import {
|
||||
RootConfigService,
|
||||
LoggerService,
|
||||
RootConfigService,
|
||||
SchedulerService,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
import { loggerToWinstonLogger } from '@backstage/backend-common';
|
||||
import { stringifyError } from '@backstage/errors';
|
||||
import {
|
||||
EntityProvider,
|
||||
@@ -77,7 +76,7 @@ export class WrapperProviders {
|
||||
async adminRouter(): Promise<express.Router> {
|
||||
return await new IncrementalProviderRouter(
|
||||
new IncrementalIngestionDatabaseManager({ client: this.options.client }),
|
||||
loggerToWinstonLogger(this.options.logger),
|
||||
this.options.logger,
|
||||
).createRouter();
|
||||
}
|
||||
|
||||
@@ -86,11 +85,9 @@ export class WrapperProviders {
|
||||
providerOptions: IncrementalEntityProviderOptions,
|
||||
connection: EntityProviderConnection,
|
||||
) {
|
||||
const logger = loggerToWinstonLogger(
|
||||
this.options.logger.child({
|
||||
entityProvider: provider.getProviderName(),
|
||||
}),
|
||||
);
|
||||
const logger = this.options.logger.child({
|
||||
entityProvider: provider.getProviderName(),
|
||||
});
|
||||
|
||||
try {
|
||||
if (!this.migrate) {
|
||||
|
||||
@@ -17,14 +17,17 @@
|
||||
import { errorHandler } from '@backstage/backend-common';
|
||||
import express from 'express';
|
||||
import Router from 'express-promise-router';
|
||||
import { Logger } from 'winston';
|
||||
import { IncrementalIngestionDatabaseManager } from '../database/IncrementalIngestionDatabaseManager';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
|
||||
export class IncrementalProviderRouter {
|
||||
private manager: IncrementalIngestionDatabaseManager;
|
||||
private logger: Logger;
|
||||
private logger: LoggerService;
|
||||
|
||||
constructor(manager: IncrementalIngestionDatabaseManager, logger: Logger) {
|
||||
constructor(
|
||||
manager: IncrementalIngestionDatabaseManager,
|
||||
logger: LoggerService,
|
||||
) {
|
||||
this.manager = manager;
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user