Skip to content

Commit

Permalink
New plugin workspace: manage
Browse files Browse the repository at this point in the history
Signed-off-by: Gustaf Räntilä <g.rantila@gmail.com>
  • Loading branch information
grantila committed Jan 23, 2025
1 parent c107e0f commit 3983e5b
Show file tree
Hide file tree
Showing 162 changed files with 41,641 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ yarn.lock @backstage/community-plugins
/workspaces/keycloak @backstage/community-plugins-maintainers @AndrienkoAleksandr @schultzp2020 @dzemanov
/workspaces/kiali @backstage/community-plugins-maintainers @aljesusg @josunect
/workspaces/linguist @backstage/community-plugins-maintainers @awanlin
/workspaces/manage @backstage/community-plugins-maintainers @grantila
/workspaces/matomo @backstage/community-plugins-maintainers @yashoswalyo @deshmukhmayur @riginoommen
/workspaces/mend @backstage/community-plugins-maintainers @dariuszsobkowicz
/workspaces/mta @backstage/community-plugins-maintainers @ibolton336
Expand Down
8 changes: 8 additions & 0 deletions workspaces/manage/.changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
14 changes: 14 additions & 0 deletions workspaces/manage/.changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"privatePackages": {
"tag": false,
"version": false
}
}
8 changes: 8 additions & 0 deletions workspaces/manage/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.git
.yarn/cache
.yarn/install-state.gz
node_modules
packages/*/src
packages/*/node_modules
plugins
*.local.yaml
10 changes: 10 additions & 0 deletions workspaces/manage/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true

[*.{js,json,yml}]
charset = utf-8
indent_style = space
indent_size = 2
1 change: 1 addition & 0 deletions workspaces/manage/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
playwright.config.ts
1 change: 1 addition & 0 deletions workspaces/manage/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('../../.eslintrc.cjs');
54 changes: 54 additions & 0 deletions workspaces/manage/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# macOS
.DS_Store

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Coverage directory generated when running tests with coverage
coverage

# Dependencies
node_modules/

# Yarn 3 files
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Node version directives
.nvmrc

# dotenv environment variables file
.env
.env.test

# Build output
dist
dist-types

# Temporary change files created by Vim
*.swp

# MkDocs build output
site

# Local configuration files
*.local.yaml

# Sensitive credentials
*-credentials.yaml

# vscode database functionality support files
*.session.sql

# E2E test reports
e2e-test-report/
5 changes: 5 additions & 0 deletions workspaces/manage/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dist
dist-types
coverage
.vscode
.eslintrc.js
20 changes: 20 additions & 0 deletions workspaces/manage/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# tech-insights

The tech insights plugin provides a way to define facts (data points) and checks (rules) that can be used to evaluate the state of an entity in the catalog.

## Plugins

- [tech-insights](./plugins/tech-insights/README.md) - The frontend plugin for tech insights
- [tech-insights-backend](./plugins/tech-insights-backend/README.md) - The backend plugin for tech insights.
- [tech-insights-backend-module-jsonfc](./plugins/tech-insights-backend-module-jsonfc/README.md) - A module that provides a `JsonRulesEngineFactChecker` fact checker for calculating boolean facts from JSON rules.
- [tech-insights-common](./plugins/tech-insights-common/README.md) - A common library containing shared utilities to be used across tech-insights plugins
- [tech-insights-node](./plugins/tech-insights-node/README.md) - A node library providing shared backend functionality for tech-insights plugins

## Local Development

To start the Backstage App, run:

```sh
yarn install
yarn dev
```
84 changes: 84 additions & 0 deletions workspaces/manage/app-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
app:
title: Tech insights Example App
baseUrl: http://localhost:3000

organization:
name: Tech insights Example

backend:
baseUrl: http://localhost:7007
listen:
port: 7007
csp:
connect-src: ["'self'", 'http:', 'https:']
cors:
origin: http://localhost:3000
methods: [GET, HEAD, PATCH, POST, PUT, DELETE]
credentials: true
database:
client: better-sqlite3
connection: ':memory:'

integrations:
github:
- host: github.com
token: ${GITHUB_TOKEN}

techdocs:
builder: 'local'
generator:
runIn: 'local'
publisher:
type: 'local'

auth:
providers:
guest:
userEntityRef: user:default/guest

catalog:
import:
entityFilename: catalog-info.yaml
pullRequestBranchName: backstage-integration
rules:
- allow: [Component, System, API, Resource, Location]
locations:
# Local example data, file locations are relative to the backend process, typically `packages/backend`
- type: file
target: ../../examples/entities.yaml

# Local example organizational data
- type: file
target: ../../examples/org.yaml
rules:
- allow: [User, Group]

techInsights:
factRetrievers:
entityOwnershipFactRetriever:
cadence: '*/1 * * * *'
lifecycle: { timeToLive: { weeks: 2 } }
entityMetadataFactRetriever:
cadence: '*/1 * * * *'
lifecycle: { timeToLive: { weeks: 2 } }
techdocsFactRetriever:
cadence: '*/1 * * * *'
lifecycle: { timeToLive: { weeks: 2 } }
apiDefinitionFactRetriever:
cadence: '*/1 * * * *'
lifecycle: { timeToLive: { weeks: 2 } }
# See packages/backend/src/index.ts for programmatically registration
# factChecker:
# checks:
# groupOwnerCheck:
# type: json-rules-engine
# name: Group Owner Check
# description: Verifies that a group has been set as the spec.owner for this entity
# factIds:
# - entityOwnershipFactRetriever
# rule:
# conditions:
# all:
# - fact: hasGroupOwner
# operator: equal
# value: true
3 changes: 3 additions & 0 deletions workspaces/manage/backstage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"version": "1.35.0"
}
13 changes: 13 additions & 0 deletions workspaces/manage/catalog-info.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: tech-insights
description: An example of a Backstage application.
# Example for optional annotations
# annotations:
# github.com/project-slug: backstage/backstage
# backstage.io/techdocs-ref: dir:.
spec:
type: website
owner: john@example.com
lifecycle: experimental
53 changes: 53 additions & 0 deletions workspaces/manage/examples/entities.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-system
apiVersion: backstage.io/v1alpha1
kind: System
metadata:
name: examples
spec:
owner: guests
---
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-component
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: example-website
spec:
type: website
lifecycle: experimental
owner: guests
system: examples
providesApis: [example-grpc-api]
---
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-api
apiVersion: backstage.io/v1alpha1
kind: API
metadata:
name: example-grpc-api
spec:
type: grpc
lifecycle: experimental
owner: guests
system: examples
definition: |
syntax = "proto3";
service Exampler {
rpc Example (ExampleMessage) returns (ExampleMessage) {};
}
message ExampleMessage {
string example = 1;
};
---
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-api
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: example-service
title: Example service
spec:
type: service
lifecycle: experimental
owner: guests
system: examples
17 changes: 17 additions & 0 deletions workspaces/manage/examples/org.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-user
apiVersion: backstage.io/v1alpha1
kind: User
metadata:
name: guest
spec:
memberOf: [guests]
---
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-group
apiVersion: backstage.io/v1alpha1
kind: Group
metadata:
name: guests
spec:
type: team
children: []
64 changes: 64 additions & 0 deletions workspaces/manage/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"name": "@internal/manage",
"version": "1.0.0",
"private": true,
"engines": {
"node": "18 || 20"
},
"scripts": {
"dev": "yarn workspaces foreach -A --include backend --include app --parallel --jobs unlimited -v -i run start",
"start": "yarn workspace app start",
"start-backend": "yarn workspace backend start",
"build:backend": "yarn workspace backend build",
"tsc": "tsc",
"tsc:full": "tsc --skipLibCheck false --incremental false",
"build:all": "backstage-cli repo build --all",
"clean": "backstage-cli repo clean",
"test": "backstage-cli repo test",
"test:all": "backstage-cli repo test --coverage",
"fix": "backstage-cli repo fix",
"lint": "backstage-cli repo lint --since origin/main",
"lint:all": "backstage-cli repo lint",
"prettier:check": "prettier --check .",
"prettier:write": "prettier --write .",
"new": "backstage-cli new --scope @backstage-community",
"build:api-reports": "yarn build:api-reports:only --tsc",
"build:api-reports:only": "backstage-repo-tools api-reports -o ae-wrong-input-file-type,ae-undocumented --validate-release-tags",
"postinstall": "cd ../../ && yarn install"
},
"workspaces": {
"packages": [
"packages/*",
"plugins/*"
]
},
"repository": {
"type": "git",
"url": "https://github.com/backstage/community-plugins",
"directory": "workspaces/manage"
},
"devDependencies": {
"@backstage/cli": "^0.29.5",
"@backstage/e2e-test-utils": "^0.1.1",
"@backstage/repo-tools": "^0.12.1",
"@changesets/cli": "^2.27.1",
"knip": "^5.27.4",
"node-gyp": "^11.0.0",
"prettier": "^2.3.2",
"typescript": "~5.3.0"
},
"resolutions": {
"@types/react": "^18",
"@types/react-dom": "^18"
},
"prettier": "@backstage/cli/config/prettier",
"lint-staged": {
"*.{js,jsx,ts,tsx,mjs,cjs}": [
"eslint --fix",
"prettier --write"
],
"*.{json,md}": [
"prettier --write"
]
}
}
9 changes: 9 additions & 0 deletions workspaces/manage/packages/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# The Packages Folder

This is where your own applications and centrally managed libraries live, each
in a separate folder of its own.

From the start there's an `app` folder (for the frontend) and a `backend` folder
(for the Node backend), but you can also add more modules in here that house
your core additions and adaptations, such as themes, common React component
libraries, utilities, and similar.
1 change: 1 addition & 0 deletions workspaces/manage/packages/app/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
public
1 change: 1 addition & 0 deletions workspaces/manage/packages/app/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
Loading

0 comments on commit 3983e5b

Please sign in to comment.