Merge branch 'backstage:master' into master

This commit is contained in:
Gaurav Pandey
2023-07-13 20:41:52 +02:00
committed by GitHub
22 changed files with 182 additions and 35 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-lighthouse-backend': patch
---
Added support for the [new backend system](https://backstage.io/docs/backend-system/)
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core-components': patch
---
Parse unicode characters in name for avatar component
+8
View File
@@ -0,0 +1,8 @@
---
'@backstage/plugin-catalog-unprocessed-entities': patch
'@backstage/plugin-devtools': patch
'@backstage/plugin-puppetdb': patch
'@backstage/plugin-nomad': patch
---
update some peer dependencies to silence yarn install
+1
View File
@@ -402,6 +402,7 @@ Uffizzi
ui
unbreak
Unconference
unicode
unmanaged
unregister
unregistering
+1 -1
View File
@@ -1,7 +1,7 @@
---
title: k8sgpt
author: suxess-it
authorUrl: github.com/suxess-it
authorUrl: https://github.com/suxess-it
category: Monitoring
description: show all k8sgpt results of the k8sgpt operator related to your entity
documentation: https://github.com/suxess-it/backstage-plugin-k8sgpt/blob/main/README.md
+48 -22
View File
@@ -31,7 +31,7 @@ const HomePage = () => {
<BannerSection diagonalBottomBorder greyBackground>
<BannerSectionGrid
header={
!hiddenNewsletterBanner && (
<>
<div
className={clsx(
'card',
@@ -40,31 +40,57 @@ const HomePage = () => {
)}
>
<div className="text--left bannerContent">
🗞 Want to stay up to date with Backstage? Sign up for our{' '}
<Link
to="https://info.backstage.spotify.com/newsletter_subscribe"
className="text--secondary"
>
Newsletter
</Link>
!
CFP is now open for BackstageCon 2023 🚀
</div>
<div
className={clsx('button button--link', 'bannerCloseButton')}
onClick={() => hideNewsletterBanner(true)}
>
<svg
className="text--secondary"
width="24"
height="24"
viewBox="0 0 24 24"
<div>
<a
className="button button--outline button--secondary"
href="https://bit.ly/BackstageConCFP"
rel="noopener noreferrer"
target="_blank"
>
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" />
</svg>
Submit a talk
</a>
</div>
</div>
)
{!hiddenNewsletterBanner && (
<div
className={clsx(
'card',
'padding--md',
homeStyles.newsletterBanner,
)}
>
<div className="text--left bannerContent">
🗞 Want to stay up to date with Backstage? Sign up for our{' '}
<Link
to="https://info.backstage.spotify.com/newsletter_subscribe"
className="text--secondary"
>
Newsletter
</Link>
!
</div>
<div
className={clsx(
'button button--link',
'bannerCloseButton',
)}
onClick={() => hideNewsletterBanner(true)}
>
<svg
className="text--secondary"
width="24"
height="24"
viewBox="0 0 24 24"
>
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" />
</svg>
</div>
</div>
)}
</>
}
>
<ContentBlock
@@ -22,6 +22,9 @@
flex-direction: row;
color: var(--ifm-button-color);
background-color: var(--ifm-color-primary);
margin-bottom: 1rem;
display: flex;
align-items: center;
:global(.bannerContent) {
flex: 1;
+1
View File
@@ -37,6 +37,7 @@
"@backstage/plugin-devtools-backend": "workspace:^",
"@backstage/plugin-entity-feedback-backend": "workspace:^",
"@backstage/plugin-kubernetes-backend": "workspace:^",
"@backstage/plugin-lighthouse-backend": "workspace:^",
"@backstage/plugin-linguist-backend": "workspace:^",
"@backstage/plugin-permission-backend": "workspace:^",
"@backstage/plugin-permission-common": "workspace:^",
+4
View File
@@ -38,6 +38,7 @@ import { linguistPlugin } from '@backstage/plugin-linguist-backend';
import { devtoolsPlugin } from '@backstage/plugin-devtools-backend';
import { TaskScheduleDefinition } from '@backstage/backend-tasks';
import { adrPlugin } from '@backstage/plugin-adr-backend';
import { lighthousePlugin } from '@backstage/plugin-lighthouse-backend';
const backend = createBackend();
@@ -94,6 +95,9 @@ backend.add(searchModuleExploreCollator());
// Kubernetes
backend.add(kubernetesPlugin());
// Lighthouse
backend.add(lighthousePlugin());
// Permissions
backend.add(permissionPlugin());
backend.add(permissionModuleAllowAllPolicy());
@@ -27,6 +27,10 @@ describe('extractInitials', () => {
expect(extractInitials('Jenny Doe')).toEqual('JD');
});
it('extract unicode initials', async () => {
expect(extractInitials('Petr Čech')).toEqual('PČ');
});
it('extract single letter for short name', async () => {
expect(extractInitials('Doe')).toEqual('D');
});
@@ -28,5 +28,8 @@ export function stringToColor(str: string) {
}
export function extractInitials(value: string) {
return value.match(/\b\w/g)?.join('').slice(0, 2);
return value
.match(/(?<!\p{L})\p{L}/gu)
?.join('')
.slice(0, 2);
}
@@ -39,7 +39,9 @@
"react-use": "^17.2.4"
},
"peerDependencies": {
"react": "^16.13.1 || ^17.0.0"
"react": "^16.13.1 || ^17.0.0",
"react-dom": "^16.13.1 || ^17.0.0",
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
},
"devDependencies": {
"@backstage/cli": "workspace:^",
+1
View File
@@ -44,6 +44,7 @@
"peerDependencies": {
"@types/react": "^16.13.1 || ^17.0.0",
"react": "^16.13.1 || ^17.0.0",
"react-dom": "^16.13.1 || ^17.0.0",
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
},
"devDependencies": {
+15
View File
@@ -58,6 +58,21 @@ export default async function createPlugin(env: PluginEnvironment) {
+ await lighthouse(lighthouseEnv)
```
#### New Backend System
The Lighthouse backend plugin has support for the [new backend system](https://backstage.io/docs/backend-system/), here's how you can set that up:
In your `packages/backend/src/index.ts` make the following changes:
```diff
import { createBackend } from '@backstage/backend-defaults';
+ import { lighthousePlugin } from '@backstage/plugin-lighthouse-backend';
const backend = createBackend();
// ... other feature additions
+ backend.add(lighthousePlugin());
backend.start();
```
## Configuration
You can define how often and when the scheduler should run the audits:
+6 -2
View File
@@ -3,7 +3,8 @@
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { CatalogClient } from '@backstage/catalog-client';
import { BackendFeature } from '@backstage/backend-plugin-api';
import { CatalogApi } from '@backstage/catalog-client';
import { Config } from '@backstage/config';
import { Logger } from 'winston';
import { PluginTaskScheduler } from '@backstage/backend-tasks';
@@ -12,7 +13,7 @@ import { TokenManager } from '@backstage/backend-common';
// @public (undocumented)
export interface CreateLighthouseSchedulerOptions {
// (undocumented)
catalogClient: CatalogClient;
catalogClient: CatalogApi;
// (undocumented)
config: Config;
// (undocumented)
@@ -28,5 +29,8 @@ export function createScheduler(
options: CreateLighthouseSchedulerOptions,
): Promise<void>;
// @public
export const lighthousePlugin: () => BackendFeature;
// (No @packageDocumentation comment for this package)
```
+2
View File
@@ -39,10 +39,12 @@
},
"dependencies": {
"@backstage/backend-common": "workspace:^",
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/backend-tasks": "workspace:^",
"@backstage/catalog-client": "workspace:^",
"@backstage/catalog-model": "workspace:^",
"@backstage/config": "workspace:^",
"@backstage/plugin-catalog-node": "workspace:^",
"@backstage/plugin-lighthouse-common": "workspace:^",
"@backstage/types": "workspace:^",
"winston": "^3.2.1"
+2 -1
View File
@@ -14,4 +14,5 @@
* limitations under the License.
*/
export * from './service/plugin';
export * from './service/createScheduler';
export { lighthousePlugin } from './plugin';
+55
View File
@@ -0,0 +1,55 @@
/*
* Copyright 2023 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { loggerToWinstonLogger } from '@backstage/backend-common';
import {
createBackendPlugin,
coreServices,
} from '@backstage/backend-plugin-api';
import { catalogServiceRef } from '@backstage/plugin-catalog-node/alpha';
import { createScheduler } from './service/createScheduler';
/**
* Lighthouse backend plugin
*
* @public
*/
export const lighthousePlugin = createBackendPlugin({
pluginId: 'lighthouse',
register(env) {
env.registerInit({
deps: {
catalogClient: catalogServiceRef,
config: coreServices.config,
logger: coreServices.logger,
scheduler: coreServices.scheduler,
tokenManager: coreServices.tokenManager,
},
async init({ catalogClient, config, logger, scheduler, tokenManager }) {
const winstonLogger = loggerToWinstonLogger(logger);
await createScheduler({
catalogClient,
config,
logger: winstonLogger,
scheduler,
tokenManager,
});
},
});
},
});
@@ -16,10 +16,7 @@
import { Logger } from 'winston';
import { PluginTaskScheduler } from '@backstage/backend-tasks';
import {
CATALOG_FILTER_EXISTS,
CatalogClient,
} from '@backstage/catalog-client';
import { CATALOG_FILTER_EXISTS, CatalogApi } from '@backstage/catalog-client';
import { Config } from '@backstage/config';
import { LighthouseRestApi } from '@backstage/plugin-lighthouse-common';
import { stringifyEntityRef } from '@backstage/catalog-model';
@@ -31,7 +28,7 @@ export interface CreateLighthouseSchedulerOptions {
logger: Logger;
config: Config;
scheduler?: PluginTaskScheduler;
catalogClient: CatalogClient;
catalogClient: CatalogApi;
tokenManager: TokenManager;
}
+2 -1
View File
@@ -36,7 +36,8 @@
},
"peerDependencies": {
"react": "^16.13.1 || ^17.0.0",
"react-router-dom": "*"
"react-dom": "^16.13.1 || ^17.0.0",
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
},
"devDependencies": {
"@backstage/cli": "workspace:^",
+1
View File
@@ -47,6 +47,7 @@
},
"peerDependencies": {
"react": "^16.13.1 || ^17.0.0",
"react-dom": "^16.13.1 || ^17.0.0",
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
},
"devDependencies": {
+9 -1
View File
@@ -5983,6 +5983,8 @@ __metadata:
react-use: ^17.2.4
peerDependencies:
react: ^16.13.1 || ^17.0.0
react-dom: ^16.13.1 || ^17.0.0
react-router-dom: 6.0.0-beta.0 || ^6.3.0
languageName: unknown
linkType: soft
@@ -6448,6 +6450,7 @@ __metadata:
peerDependencies:
"@types/react": ^16.13.1 || ^17.0.0
react: ^16.13.1 || ^17.0.0
react-dom: ^16.13.1 || ^17.0.0
react-router-dom: 6.0.0-beta.0 || ^6.3.0
languageName: unknown
linkType: soft
@@ -7688,11 +7691,13 @@ __metadata:
resolution: "@backstage/plugin-lighthouse-backend@workspace:plugins/lighthouse-backend"
dependencies:
"@backstage/backend-common": "workspace:^"
"@backstage/backend-plugin-api": "workspace:^"
"@backstage/backend-tasks": "workspace:^"
"@backstage/catalog-client": "workspace:^"
"@backstage/catalog-model": "workspace:^"
"@backstage/cli": "workspace:^"
"@backstage/config": "workspace:^"
"@backstage/plugin-catalog-node": "workspace:^"
"@backstage/plugin-lighthouse-common": "workspace:^"
"@backstage/types": "workspace:^"
winston: ^3.2.1
@@ -7955,7 +7960,8 @@ __metadata:
react-use: ^17.2.4
peerDependencies:
react: ^16.13.1 || ^17.0.0
react-router-dom: "*"
react-dom: ^16.13.1 || ^17.0.0
react-router-dom: 6.0.0-beta.0 || ^6.3.0
languageName: unknown
linkType: soft
@@ -8405,6 +8411,7 @@ __metadata:
react-use: ^17.2.4
peerDependencies:
react: ^16.13.1 || ^17.0.0
react-dom: ^16.13.1 || ^17.0.0
react-router-dom: 6.0.0-beta.0 || ^6.3.0
languageName: unknown
linkType: soft
@@ -24977,6 +24984,7 @@ __metadata:
"@backstage/plugin-devtools-backend": "workspace:^"
"@backstage/plugin-entity-feedback-backend": "workspace:^"
"@backstage/plugin-kubernetes-backend": "workspace:^"
"@backstage/plugin-lighthouse-backend": "workspace:^"
"@backstage/plugin-linguist-backend": "workspace:^"
"@backstage/plugin-permission-backend": "workspace:^"
"@backstage/plugin-permission-common": "workspace:^"