fixes and api report

Signed-off-by: Brian Fletcher <brian@roadie.io>
This commit is contained in:
Brian Fletcher
2023-04-06 10:54:22 +01:00
parent 7a89555e73
commit 0299dd40d6
4 changed files with 18 additions and 8 deletions
+2
View File
@@ -3,3 +3,5 @@
---
Lighthouse backend plugin can now use an authenticated catalog backend API.
- Breaking \* You must now pass the `tokenManager` to the lighthouse `createScheduler`.
+3
View File
@@ -7,6 +7,7 @@ import { CatalogClient } from '@backstage/catalog-client';
import { Config } from '@backstage/config';
import { Logger } from 'winston';
import { PluginTaskScheduler } from '@backstage/backend-tasks';
import { TokenManager } from '@backstage/backend-common';
// @public (undocumented)
export interface CreateLighthouseSchedulerOptions {
@@ -18,6 +19,8 @@ export interface CreateLighthouseSchedulerOptions {
logger: Logger;
// (undocumented)
scheduler?: PluginTaskScheduler;
// (undocumented)
tokenManager: TokenManager;
}
// @public (undocumented)
@@ -32,8 +32,10 @@ export async function loadLighthouseEntities(
const { token } = await tokenManager.getToken();
return await catalogClient.getEntities({
filter: [filter],
token,
});
return await catalogClient.getEntities(
{
filter: [filter],
},
{ token },
);
}
@@ -24,6 +24,7 @@ import { Config } from '@backstage/config';
import { LighthouseRestApi } from '@backstage/plugin-lighthouse-common';
import { stringifyEntityRef } from '@backstage/catalog-model';
import { LighthouseAuditScheduleImpl } from '../config';
import { TokenManager } from '@backstage/backend-common';
/** @public **/
export interface CreateLighthouseSchedulerOptions {
@@ -79,10 +80,12 @@ export async function createScheduler(
logger.info('Running Lighthouse Audit Task');
const { token } = await tokenManager.getToken();
const websitesWithUrl = await catalogClient.getEntities({
filter: [filter],
token,
});
const websitesWithUrl = await catalogClient.getEntities(
{
filter: [filter],
},
{ token },
);
let index = 0;
for (const entity of websitesWithUrl.items) {