Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #7 from liatrio/feat/autogov-processor-backend
Browse files Browse the repository at this point in the history
feat: add autogov processor
  • Loading branch information
dbhagen authored Nov 7, 2024
2 parents addb962 + 92bf652 commit 800aa2e
Show file tree
Hide file tree
Showing 15 changed files with 15,701 additions and 4 deletions.
2 changes: 1 addition & 1 deletion backstage-plugin-autogov-common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@liatrio/backstage-plugin-autogov-common",
"version": "1.1.0",
"version": "1.2.0",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
Expand Down
1 change: 1 addition & 0 deletions backstage-plugin-autogov-processor-backend/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@backstage/cli/config/eslint-factory")(__dirname);
5 changes: 5 additions & 0 deletions backstage-plugin-autogov-processor-backend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# @internal/backstage-plugin-catalog-backend-module-autogov-processor

The autogov-processor backend module for the catalog plugin.

_This plugin was created through the Backstage CLI_
94 changes: 94 additions & 0 deletions backstage-plugin-autogov-processor-backend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"name": "@liatrio/backstage-plugin-catalog-backend-module-autogov-processor",
"description": "The autogov-processor backend module for the catalog plugin.",
"version": "1.2.0",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
"private": true,
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts"
},
"backstage": {
"role": "backend-plugin-module",
"pluginId": "catalog-backend-module-autogov-processor",
"pluginPackages": [],
"pluginPackage": []
},
"scripts": {
"start": "backstage-cli package start",
"build": "backstage-cli package build",
"lint": "backstage-cli package lint",
"test": "backstage-cli package test",
"clean": "backstage-cli package clean",
"prepack": "backstage-cli package prepack",
"postpack": "backstage-cli package postpack"
},
"dependencies": {
"@backstage/backend-plugin-api": "^1.0.0",
"@backstage/catalog-model": "^1.7.0",
"@backstage/config": "^1.2.0",
"@backstage/integration": "^1.15.1",
"@backstage/plugin-catalog-node": "^1.13.1",
"@backstage/types": "^1.1.1",
"node-fetch": "2"
},
"devDependencies": {
"@backstage/backend-test-utils": "^1.0.0",
"@backstage/cli": "^0.27.1",
"@types/node-fetch": "2"
},
"files": [
"dist"
],
"configSchema": {
"$schema": "https://backstage.io/schema/config-v1",
"title": "@liatrio/backend-module-autogov-processor",
"type": "object",
"properties": {
"github": {
"type": "object",
"description": "GitHub configuration",
"properties": {
"resultsFile": {
"type": "object",
"description": "Autogov results file configuration",
"properties": {
"allowOverride": {
"type": "boolean",
"description": "Whether to allow override of default results file location",
"default": false
},
"default": {
"type": "string",
"description": "Default name for the results file",
"default": "results"
}
}
},
"requireAnnotation": {
"type": "boolean",
"description": "Whether to require annotations for processing",
"default": true
},
"entityKinds": {
"type": "array",
"description": "Array of entity kinds to process",
"default": [
"component"
]
},
"entityTypes": {
"type": "array",
"description": "Array of entity types to process",
"default": [
"website"
]
}
}
}
}
}
}
17 changes: 17 additions & 0 deletions backstage-plugin-autogov-processor-backend/src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export const AUTOGOV_STATUS_FILE_ANNOTATION = "liatrio.com/autogov-result-file";
export const AUTOGOV_STATUS_ANNOTATION =
"liatrio.com/autogov-latest-release-status";

export enum AUTOGOV_STATUSES {
PASSED = "PASSED",
FAILED = "FAILED",
N_A = "N/A",
ERROR = "ERROR",
}

export enum AUTOGOV_STATUS_WEIGHT {
PASSED = 1,
FAILED = 2,
N_A = 3,
UNKNOWN = 4,
}
9 changes: 9 additions & 0 deletions backstage-plugin-autogov-processor-backend/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/***/
/**
* The autogov-processor backend module for the catalog plugin.
*
* @packageDocumentation
*/

export { catalogModuleAutogovProcessor as default } from "./module";
export * from "./constants";
28 changes: 28 additions & 0 deletions backstage-plugin-autogov-processor-backend/src/module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import {
coreServices,
createBackendModule,
} from "@backstage/backend-plugin-api";
import { catalogProcessingExtensionPoint } from "@backstage/plugin-catalog-node/alpha";
import { AutogovProcessor } from "./processor";

export const catalogModuleAutogovProcessor = createBackendModule({
pluginId: "catalog",
moduleId: "autogov-processor",
register(reg) {
reg.registerInit({
deps: {
catalog: catalogProcessingExtensionPoint,
config: coreServices.rootConfig,
logger: coreServices.logger,
},
async init({ catalog, config, logger }) {
logger.info("Initializing Autogov Processor");
catalog.addProcessor(
AutogovProcessor.fromConfig(config, {
logger,
}),
);
},
});
},
});
Loading

0 comments on commit 800aa2e

Please sign in to comment.