This is the main documentation page for the exported classes for backstage-plugin-devcontainers-backkend:
This class provides a custom catalog processor for entity data that comes from GitHub, GitLab, or BitBucket.
type ProcessorOptions = Readonly<{
tagName: string;
logger: Logger;
}>;
type ProcessorSetupOptions = Readonly<
Partial<ProcessorOptions> & {
logger: Logger;
}
>;
class DevcontainersProcessor implements CatalogProcessor {
constructor(urlReader: UrlReader, options: ProcessorOptions) {}
static fromConfig(
readerConfig: Config,
options: ProcessorSetupOptions,
): DevcontainersProcessor;
getProcessorName(): string;
async preProcessEntity(
entity: Entity,
location: LocationSpec,
emit: CatalogProcessorEmit,
): Promise<Entity>;
}- The type definition for
CatalogProcessorcomes from@backstage/plugin-catalog-node - The type definition for
Configcomes from@backstage/config - The type definition for
UrlReadercomes from@backstage/backend-common
// Inside your backend deployment's catalog.ts file
export default async function createPlugin(
env: PluginEnvironment,
): Promise<Router> {
const builder = await CatalogBuilder.create(env);
// Insert other setup steps here
builder.addProcessor(
DevcontainersProcessor.fromConfig(env.config, {
logger: env.logger,
}),
);
const { processingEngine, router } = await builder.build();
await processingEngine.start();
return router;
}- The
preProcessEntitymethod will emit an entitygeneralErrorwhen it is unable to read the URL data for a given repository.
- This class is designed to be instantiated either through the
fromConfigmethod or from the raw constructor.fromConfigwill set up the class instance with a set of "sensible" default values.- If the value of
tagNameis not specified forfromConfig, the class will default to the valuedevcontainers
- If the value of
- The appending/removal process for tags works as follows:
- An entity provider re-validates its data and ingests a new entity
- The processor will run a pre-process step to determine if the Dev Containers tag (which defaults to
devcontainers) should be added. - If the tag is added, this entity will eventually be added if it is brand new, or if there is a matching entity on file, be reconciled with it
- During the reconciliation process, the existing entity will have the new tag added if the new version had it. However, if the new entity does not have the tag, the existing entity will lose the tag during reconciliation.
- Unless another plugin adds the same tag, the only way to ensure that the tag stays applied to the entities available in the UI is by ensuring that the tag is included at each re-validation step.