move to alpha

Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com>
This commit is contained in:
aramissennyeydd
2025-11-10 14:36:49 -05:00
parent 2b6279edb3
commit db45906aa1
23 changed files with 45 additions and 143 deletions
+1 -1
View File
@@ -3,4 +3,4 @@
'@backstage/backend-plugin-api': minor
---
Adds a new experimental `SystemMetadataService` for tracking the collection of Backstage instances that may be deployed at any one time.
Adds a new experimental `RootSystemMetadataService` for tracking the collection of Backstage instances that may be deployed at any one time. It currently offers a single API, `getInstalledPlugins` that returns a list of installed plugins based on config you have set up in `discovery.endpoints` as well as the plugins installed on the instance you're calling the API with. It does not handle wildcard values or fallback values. The intention is for this plugin to provide plugin authors with a simple interface to fetch a trustworthy list of all installed plugins.
-4
View File
@@ -33,7 +33,6 @@
"./permissions": "./src/entrypoints/permissions/index.ts",
"./rootConfig": "./src/entrypoints/rootConfig/index.ts",
"./rootHealth": "./src/entrypoints/rootHealth/index.ts",
"./rootSystemMetadata": "./src/entrypoints/rootSystemMetadata/index.ts",
"./rootHttpRouter": "./src/entrypoints/rootHttpRouter/index.ts",
"./rootLifecycle": "./src/entrypoints/rootLifecycle/index.ts",
"./rootLogger": "./src/entrypoints/rootLogger/index.ts",
@@ -86,9 +85,6 @@
"rootHealth": [
"src/entrypoints/rootHealth/index.ts"
],
"rootSystemMetadata": [
"src/entrypoints/rootSystemMetadata/index.ts"
],
"rootHttpRouter": [
"src/entrypoints/rootHttpRouter/index.ts"
],
@@ -6,6 +6,7 @@
import { ActionsRegistryService } from '@backstage/backend-plugin-api/alpha';
import { ActionsService } from '@backstage/backend-plugin-api/alpha';
import { InstanceMetadataService } from '@backstage/backend-plugin-api/alpha';
import { RootSystemMetadataService } from '@backstage/backend-plugin-api/alpha';
import { ServiceFactory } from '@backstage/backend-plugin-api';
// @public (undocumented)
@@ -29,5 +30,12 @@ export const instanceMetadataServiceFactory: ServiceFactory<
'singleton'
>;
// @alpha
export const rootSystemMetadataServiceFactory: ServiceFactory<
RootSystemMetadataService,
'root',
'singleton'
>;
// (No @packageDocumentation comment for this package)
```
@@ -3,7 +3,6 @@
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { Config } from '@backstage/config';
import { DiscoveryService } from '@backstage/backend-plugin-api';
import { LoggerService } from '@backstage/backend-plugin-api';
import { RootConfigService } from '@backstage/backend-plugin-api';
@@ -28,11 +27,6 @@ export class HostDiscovery implements DiscoveryService {
// (undocumented)
getExternalBaseUrl(pluginId: string): Promise<string>;
// (undocumented)
getInstanceAddress(config: Config): {
internal: string;
external: string;
};
// (undocumented)
listResolutions(): Promise<
Map<
string,
@@ -1,40 +0,0 @@
## API Report File for "@backstage/backend-defaults"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { LoggerService } from '@backstage/backend-plugin-api';
import { RootConfigService } from '@backstage/backend-plugin-api';
import { RootInstanceMetadataService } from '@backstage/backend-plugin-api';
import { RootSystemMetadataService } from '@backstage/backend-plugin-api';
import { RootSystemMetadataServicePluginInfo } from '@backstage/backend-plugin-api';
import { ServiceFactory } from '@backstage/backend-plugin-api';
// @alpha (undocumented)
export class DefaultRootSystemMetadataService
implements RootSystemMetadataService
{
constructor(options: {
logger: LoggerService;
config: RootConfigService;
instanceMetadata: RootInstanceMetadataService;
});
// (undocumented)
static create(pluginEnv: {
logger: LoggerService;
config: RootConfigService;
instanceMetadata: RootInstanceMetadataService;
}): DefaultRootSystemMetadataService;
// (undocumented)
getInstalledPlugins(): Promise<RootSystemMetadataServicePluginInfo[]>;
}
// @alpha
export const rootSystemMetadataServiceFactory: ServiceFactory<
RootSystemMetadataService,
'root',
'singleton'
>;
// (No @packageDocumentation comment for this package)
```
@@ -39,8 +39,6 @@ import {
actionsRegistryServiceFactory,
actionsServiceFactory,
} from '@backstage/backend-defaults/alpha';
import { instanceMetadataServiceFactory } from './alpha/entrypoints/instanceMetadata/instanceMetadataServiceFactory';
import { rootSystemMetadataServiceFactory } from './entrypoints/rootSystemMetadata';
export const defaultServiceFactories = [
auditorServiceFactory,
@@ -63,14 +61,10 @@ export const defaultServiceFactories = [
userInfoServiceFactory,
urlReaderServiceFactory,
eventsServiceFactory,
rootSystemMetadataServiceFactory,
// alpha services
actionsRegistryServiceFactory,
actionsServiceFactory,
// Unexported alpha services kept around for compatibility reasons
instanceMetadataServiceFactory,
];
/**
@@ -23,6 +23,7 @@ import {
import Router from 'express-promise-router';
import request from 'supertest';
import { rootSystemMetadataServiceFactory } from './rootSystemMetadataServiceFactory';
import { rootSystemMetadataServiceRef } from '@backstage/backend-plugin-api/alpha';
describe('SystemMetadataService', () => {
describe('returns plugins from config', () => {
@@ -31,7 +32,7 @@ describe('SystemMetadataService', () => {
register(reg) {
reg.registerInit({
deps: {
systemMetadata: coreServices.rootSystemMetadata,
systemMetadata: rootSystemMetadataServiceRef,
rootHttpRouter: coreServices.rootHttpRouter,
},
init: async ({ systemMetadata, rootHttpRouter }) => {
@@ -18,10 +18,12 @@ import {
LoggerService,
RootConfigService,
RootInstanceMetadataService,
} from '@backstage/backend-plugin-api';
import { HostDiscovery } from '../../../../entrypoints/discovery';
import {
RootSystemMetadataService,
RootSystemMetadataServicePluginInfo,
} from '@backstage/backend-plugin-api';
import { HostDiscovery } from '../../discovery';
} from '@backstage/backend-plugin-api/alpha';
/**
* @alpha
@@ -19,6 +19,7 @@ import {
createServiceFactory,
} from '@backstage/backend-plugin-api';
import { DefaultRootSystemMetadataService } from './lib/DefaultRootSystemMetadataService';
import { rootSystemMetadataServiceRef } from '@backstage/backend-plugin-api/alpha';
/**
* Metadata about an entire Backstage system, a collection of Backstage instances.
@@ -26,7 +27,7 @@ import { DefaultRootSystemMetadataService } from './lib/DefaultRootSystemMetadat
* @alpha
*/
export const rootSystemMetadataServiceFactory = createServiceFactory({
service: coreServices.rootSystemMetadata,
service: rootSystemMetadataServiceRef,
deps: {
logger: coreServices.rootLogger,
config: coreServices.rootConfig,
@@ -16,3 +16,4 @@
export { actionsRegistryServiceFactory } from './entrypoints/actionsRegistry';
export { actionsServiceFactory } from './entrypoints/actions';
export { rootSystemMetadataServiceFactory } from './entrypoints/rootSystemMetadata';
@@ -214,7 +214,7 @@ export class HostDiscovery implements DiscoveryService {
return _targets;
}
getInstanceAddress(config: Config) {
#getInstanceAddress(config: Config) {
const backendBaseUrl = trimEnd(config.getString('backend.baseUrl'), '/');
const {
@@ -248,7 +248,7 @@ export class HostDiscovery implements DiscoveryService {
}
#updateFallbackResolvers(config: Config) {
const { internal, external } = this.getInstanceAddress(config);
const { internal, external } = this.#getInstanceAddress(config);
this.#internalFallbackResolver = this.#makeResolver(
`${internal}/api/{{pluginId}}`,
-19
View File
@@ -237,11 +237,6 @@ export namespace coreServices {
'root',
'singleton'
>;
const rootSystemMetadata: ServiceRef<
RootSystemMetadataService,
'root',
'singleton'
>;
}
// @public
@@ -633,20 +628,6 @@ export interface RootServiceFactoryOptions<
service: ServiceRef<TService, 'root', TInstances>;
}
// @public (undocumented)
export interface RootSystemMetadataService {
// (undocumented)
getInstalledPlugins: () => Promise<
ReadonlyArray<RootSystemMetadataServicePluginInfo>
>;
}
// @public (undocumented)
export interface RootSystemMetadataServicePluginInfo {
// (undocumented)
readonly pluginId: string;
}
// @public
export interface SchedulerService {
createScheduledTaskRunner(
+10 -4
View File
@@ -14,6 +14,11 @@
* limitations under the License.
*/
export type {
RootSystemMetadataServicePluginInfo,
RootSystemMetadataService,
} from './RootSystemMetadataService';
export type {
ActionsRegistryService,
ActionsRegistryActionOptions,
@@ -22,11 +27,12 @@ export type {
export type { ActionsService, ActionsServiceAction } from './ActionsService';
export { actionsRegistryServiceRef, actionsServiceRef } from './refs';
import { createServiceRef } from '@backstage/backend-plugin-api';
export type {
BackstageInstance,
SystemMetadataService,
} from './services/definitions/SystemMetadataService';
export {
actionsRegistryServiceRef,
actionsServiceRef,
rootSystemMetadataServiceRef,
} from './refs';
@@ -45,3 +45,14 @@ export const actionsRegistryServiceRef = createServiceRef<
>({
id: 'alpha.core.actionsRegistry',
});
/**
* Read information about your current Backstage deployment.
* @alpha
*/
export const rootSystemMetadataServiceRef = createServiceRef<
import('./RootSystemMetadataService').RootSystemMetadataService
>({
id: 'alpha.core.rootSystemMetadata',
scope: 'root',
});
@@ -289,15 +289,4 @@ export namespace coreServices {
id: 'core.rootInstanceMetadata',
scope: 'root',
});
/**
* Read information about your current Backstage deployment.
* @public
*/
export const rootSystemMetadata = createServiceRef<
import('./RootSystemMetadataService').RootSystemMetadataService
>({
id: 'core.rootSystemMetadata',
scope: 'root',
});
}
@@ -72,10 +72,6 @@ export type {
SchedulerServiceTaskScheduleDefinition,
SchedulerServiceTaskScheduleDefinitionConfig,
} from './SchedulerService';
export type {
RootSystemMetadataServicePluginInfo,
RootSystemMetadataService,
} from './RootSystemMetadataService';
export type {
UrlReaderService,
UrlReaderServiceReadTreeOptions,
-14
View File
@@ -38,7 +38,6 @@ import { RootHttpRouterService } from '@backstage/backend-plugin-api';
import { RootInstanceMetadataService } from '@backstage/backend-plugin-api';
import { RootLifecycleService } from '@backstage/backend-plugin-api';
import { RootLoggerService } from '@backstage/backend-plugin-api';
import { RootSystemMetadataService } from '@backstage/backend-plugin-api';
import { SchedulerService } from '@backstage/backend-plugin-api';
import { ServiceFactory } from '@backstage/backend-plugin-api';
import { ServiceRef } from '@backstage/backend-plugin-api';
@@ -383,19 +382,6 @@ export namespace mockServices {
) => ServiceMock<RootLoggerService>;
}
// (undocumented)
export function rootSystemMetadata(): RootSystemMetadataService;
// (undocumented)
export namespace rootSystemMetadata {
const factory: () => ServiceFactory<
RootSystemMetadataService,
'root',
'singleton' | 'multiton'
>;
const mock: (
partialImpl?: Partial<RootSystemMetadataService> | undefined,
) => ServiceMock<RootSystemMetadataService>;
}
// (undocumented)
export function scheduler(): SchedulerService;
// (undocumented)
export namespace scheduler {
@@ -43,8 +43,6 @@ import {
UserInfoService,
coreServices,
createServiceFactory,
RootLoggerService,
RootSystemMetadataService,
} from '@backstage/backend-plugin-api';
import { ConfigReader } from '@backstage/config';
import { EventsService, eventsServiceRef } from '@backstage/plugin-events-node';
@@ -574,28 +572,4 @@ export namespace mockServices {
rootInstanceMetadata,
);
}
export function rootSystemMetadata(): RootSystemMetadataService {
return {
getInstalledPlugins: () => Promise.resolve([]),
};
}
export namespace rootSystemMetadata {
/**
* Creates a functional mock factory for the
* {@link @backstage/backend-plugin-api#coreServices.systemMetadata}.
*/
export const factory = simpleFactoryWithOptions(
coreServices.rootSystemMetadata,
rootSystemMetadata,
);
/**
* Creates a mock of the
* {@link @backstage/backend-events-node#systemMetadata}, optionally
* with some given method implementations.
*/
export const mock = simpleMock(coreServices.rootSystemMetadata, () => ({
getInstalledPlugins: jest.fn(),
}));
}
}
@@ -88,7 +88,6 @@ export const defaultServiceFactories = [
mockServices.userInfo.factory(),
mockServices.urlReader.factory(),
mockServices.events.factory(),
mockServices.rootSystemMetadata.factory(),
// Alpha services
actionsRegistryServiceMock.factory(),
+2
View File
@@ -15,6 +15,7 @@
*/
import { createBackend } from '@backstage/backend-defaults';
import { rootSystemMetadataServiceFactory } from '@backstage/backend-defaults/alpha';
import {
coreServices,
createBackendFeatureLoader,
@@ -70,6 +71,7 @@ backend.add(import('@backstage/plugin-techdocs-backend'));
backend.add(import('@backstage/plugin-signals-backend'));
backend.add(import('@backstage/plugin-notifications-backend'));
backend.add(import('./systemMetadataPlugin'));
backend.add(rootSystemMetadataServiceFactory);
backend.add(import('@backstage/plugin-events-backend-module-google-pubsub'));
backend.add(import('@backstage/plugin-mcp-actions-backend'));
+2 -1
View File
@@ -18,6 +18,7 @@ import {
coreServices,
createBackendPlugin,
} from '@backstage/backend-plugin-api';
import { rootSystemMetadataServiceRef } from '@backstage/backend-plugin-api/alpha';
import Router from 'express-promise-router';
/**
@@ -29,7 +30,7 @@ export default createBackendPlugin({
register: reg => {
reg.registerInit({
deps: {
systemMetadata: coreServices.rootSystemMetadata,
systemMetadata: rootSystemMetadataServiceRef,
rootHttpRouter: coreServices.rootHttpRouter,
},
async init({ systemMetadata, rootHttpRouter }) {