Merge pull request #16417 from backstage/blam/hotfix

Fixes for v1.11
This commit is contained in:
Ben Lambert
2023-02-17 13:19:10 +01:00
committed by GitHub
24 changed files with 129 additions and 40 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend-module-msgraph': patch
---
Revert using `baseUrl` for MS Graph provider as it breaks token retrieval
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/eslint-plugin': patch
---
Fixing a bug that we should check internal dependencies too
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-vault-backend': patch
---
Ignore the `eslint` error
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/plugin-catalog-backend-module-incremental-ingestion': patch
'@backstage/plugin-catalog-backend-module-aws': patch
---
Fix missing `dependencies` in `package.json`
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/plugin-sonarqube-react': patch
'@backstage/plugin-sonarqube': patch
---
Moved imports from `/alpha` to main public exports.
+1
View File
@@ -28,6 +28,7 @@
"bin": "bin/e2e-test",
"dependencies": {
"@backstage/cli-common": "workspace:^",
"@backstage/create-app": "workspace:^",
"@backstage/errors": "workspace:^",
"chalk": "^4.0.0",
"commander": "^9.1.0",
@@ -34,6 +34,7 @@ const getPackages = require('./getPackages');
* @property {'value' | 'type'} kind
* @property {string} path
* @property {import('./getPackages').ExtendedPackage} package
* @property {string} packageName
*/
/**
@@ -160,6 +161,7 @@ module.exports = function visitImports(context, visitor) {
kind: info.kind,
path: subPath,
package: pkg,
packageName,
});
}
@@ -151,11 +151,18 @@ module.exports = {
}
return visitImports(context, (node, imp) => {
if (imp.type !== 'external') {
// We leave checking of type imports to the repo-tools check,
// and we skip builtins and local imports
if (
imp.kind === 'type' ||
imp.type === 'builtin' ||
imp.type === 'local'
) {
return;
}
// We leave checking of type imports to the repo-tools check
if (imp.kind === 'type') {
// We skip imports for the package itself
if (imp.packageName === localPkg.packageJson.name) {
return;
}
@@ -0,0 +1,17 @@
{
"name": "@internal/foo",
"main": "index.js",
"dependencies": {
"@internal/bar": "1.0.0"
},
"devDependencies": {
"lodash": "*"
},
"peerDependencies": {
"react": "*"
},
"files": [
"dist",
"type-utils"
]
}
@@ -236,5 +236,16 @@ ruleTester.run(RULE, rule, {
),
],
},
{
code: `import '@internal/foo'`,
filename: joinPath(FIXTURE, 'packages/bar/src/index.ts'),
errors: [
ERR_UNDECLARED(
'@internal/foo',
'dependencies',
joinPath('packages', 'bar'),
),
],
},
],
});
+1
View File
@@ -78,6 +78,7 @@
"devDependencies": {
"@backstage/backend-test-utils": "workspace:^",
"@backstage/cli": "workspace:^",
"@backstage/test-utils": "workspace:^",
"@types/body-parser": "^1.19.0",
"@types/cookie-parser": "^1.4.2",
"@types/express-session": "^1.17.2",
@@ -41,7 +41,9 @@
"@backstage/errors": "workspace:^",
"@backstage/integration": "workspace:^",
"@backstage/plugin-catalog-backend": "workspace:^",
"@backstage/plugin-catalog-common": "workspace:^",
"@backstage/plugin-catalog-node": "workspace:^",
"@backstage/plugin-kubernetes-common": "workspace:^",
"@backstage/types": "workspace:^",
"aws-sdk": "^2.840.0",
"lodash": "^4.17.21",
@@ -34,6 +34,7 @@
},
"dependencies": {
"@backstage/backend-common": "workspace:^",
"@backstage/backend-defaults": "workspace:^",
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/backend-tasks": "workspace:^",
"@backstage/catalog-model": "workspace:^",
@@ -13,8 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { coreServices } from '@backstage/backend-plugin-api';
import { startTestBackend } from '@backstage/backend-test-utils';
import { createBackend } from '@backstage/backend-defaults';
import {
coreServices,
createServiceFactory,
} from '@backstage/backend-plugin-api';
import { ConfigReader } from '@backstage/config';
import { catalogPlugin } from '@backstage/plugin-catalog-backend';
import {
@@ -46,25 +49,33 @@ async function main() {
},
};
await startTestBackend({
services: [[coreServices.config, new ConfigReader(config)]],
extensionPoints: [],
features: [
catalogPlugin(),
incrementalIngestionEntityProviderCatalogModule({
providers: [
{
provider: provider,
options: {
burstInterval: { seconds: 1 },
burstLength: { seconds: 10 },
restLength: { seconds: 10 },
},
},
],
const backend = createBackend({
services: [
createServiceFactory({
service: coreServices.config,
deps: {},
factory: () => new ConfigReader(config),
}),
],
});
backend.add(catalogPlugin());
backend.add(
incrementalIngestionEntityProviderCatalogModule({
providers: [
{
provider: provider,
options: {
burstInterval: { seconds: 1 },
burstLength: { seconds: 10 },
restLength: { seconds: 10 },
},
},
],
}),
);
await backend.start();
}
main().catch(error => {
@@ -53,7 +53,7 @@ describe('MicrosoftGraphClient', () => {
expect(await response.json()).toEqual({ value: 'example' });
expect(tokenCredential.getToken).toHaveBeenCalledTimes(1);
expect(tokenCredential.getToken).toHaveBeenCalledWith(
'https://example.com/.default',
'https://graph.microsoft.com/.default',
);
});
@@ -219,7 +219,7 @@ export class MicrosoftGraphClient {
): Promise<Response> {
// Make sure that we always have a valid access token (might be cached)
const token = await this.tokenCredential.getToken(
`${this.baseUrl}/.default`,
'https://graph.microsoft.com/.default',
);
if (!token) {
+7 -7
View File
@@ -6,7 +6,7 @@
import { ApiRef } from '@backstage/core-plugin-api';
import { Entity } from '@backstage/catalog-model';
// @alpha (undocumented)
// @public (undocumented)
export interface FindingSummary {
// (undocumented)
getComponentMeasuresUrl: SonarUrlProcessorFunc;
@@ -25,7 +25,7 @@ export interface FindingSummary {
// @public (undocumented)
export const isSonarQubeAvailable: (entity: Entity) => boolean;
// @alpha (undocumented)
// @public (undocumented)
export type MetricKey =
| 'alert_status'
| 'bugs'
@@ -39,7 +39,7 @@ export type MetricKey =
| 'coverage'
| 'duplicated_lines_density';
// @alpha
// @public
export type Metrics = {
[key in MetricKey]: string | undefined;
};
@@ -47,7 +47,7 @@ export type Metrics = {
// @public (undocumented)
export const SONARQUBE_PROJECT_KEY_ANNOTATION = 'sonarqube.org/project-key';
// @alpha (undocumented)
// @public (undocumented)
export type SonarQubeApi = {
getFindingSummary(options: {
componentKey?: string;
@@ -55,13 +55,13 @@ export type SonarQubeApi = {
}): Promise<FindingSummary | undefined>;
};
// @alpha (undocumented)
// @public (undocumented)
export const sonarQubeApiRef: ApiRef<SonarQubeApi>;
// @alpha (undocumented)
// @public (undocumented)
export type SonarUrlProcessorFunc = (identifier: string) => string;
// @alpha
// @public
export const useProjectInfo: (entity: Entity) => {
projectInstance: string | undefined;
projectKey: string | undefined;
@@ -16,7 +16,7 @@
import { createApiRef } from '@backstage/core-plugin-api';
/** @alpha */
/** @public */
export type MetricKey =
// alert status
| 'alert_status'
@@ -43,11 +43,11 @@ export type MetricKey =
// duplicated lines
| 'duplicated_lines_density';
/** @alpha */
/** @public */
export type SonarUrlProcessorFunc = (identifier: string) => string;
/**
* @alpha
* @public
*
* Define a type to make sure that all metrics are used
*/
@@ -55,7 +55,7 @@ export type Metrics = {
[key in MetricKey]: string | undefined;
};
/** @alpha */
/** @public */
export interface FindingSummary {
lastAnalysis: string;
metrics: Metrics;
@@ -65,12 +65,12 @@ export interface FindingSummary {
getSecurityHotspotsUrl: () => string;
}
/** @alpha */
/** @public */
export const sonarQubeApiRef = createApiRef<SonarQubeApi>({
id: 'plugin.sonarqube.service',
});
/** @alpha */
/** @public */
export type SonarQubeApi = {
getFindingSummary(options: {
componentKey?: string;
@@ -25,7 +25,7 @@ export const SONARQUBE_PROJECT_INSTANCE_SEPARATOR = '/';
*
* If part or all info are not found, they will default to undefined
*
* @alpha
* @public
* @param entity - entity to find the sonarqube information from.
* @returns a ProjectInfo properly populated.
*/
+1 -1
View File
@@ -42,7 +42,7 @@ export const SonarQubeCard: (props: {
duplicationRatings?: DuplicationRating[];
}) => JSX.Element;
// @alpha (undocumented)
// @public (undocumented)
export class SonarQubeClient implements SonarQubeApi {
constructor({
discoveryApi,
+1 -1
View File
@@ -23,7 +23,7 @@ import {
import { InstanceUrlWrapper, FindingsWrapper } from './types';
import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';
/** @alpha */
/** @public */
export class SonarQubeClient implements SonarQubeApi {
discoveryApi: DiscoveryApi;
identityApi: IdentityApi;
@@ -28,6 +28,10 @@ import helmet from 'helmet';
import { Logger } from 'winston';
import { createRouter } from './router';
import { ConfigReader } from '@backstage/config';
// Think this file will probably go away once we move to backend system
// And restructure into the /dev folder
// eslint-disable-next-line @backstage/no-undeclared-imports
import { TestDatabases } from '@backstage/backend-test-utils';
import { TaskScheduler } from '@backstage/backend-tasks';
+6 -1
View File
@@ -3964,7 +3964,7 @@ __metadata:
languageName: unknown
linkType: soft
"@backstage/create-app@workspace:*, @backstage/create-app@workspace:packages/create-app":
"@backstage/create-app@workspace:*, @backstage/create-app@workspace:^, @backstage/create-app@workspace:packages/create-app":
version: 0.0.0-use.local
resolution: "@backstage/create-app@workspace:packages/create-app"
dependencies:
@@ -4438,6 +4438,7 @@ __metadata:
"@backstage/config": "workspace:^"
"@backstage/errors": "workspace:^"
"@backstage/plugin-auth-node": "workspace:^"
"@backstage/test-utils": "workspace:^"
"@backstage/types": "workspace:^"
"@davidzemon/passport-okta-oauth": ^0.0.5
"@google-cloud/firestore": ^6.0.0
@@ -4795,7 +4796,9 @@ __metadata:
"@backstage/errors": "workspace:^"
"@backstage/integration": "workspace:^"
"@backstage/plugin-catalog-backend": "workspace:^"
"@backstage/plugin-catalog-common": "workspace:^"
"@backstage/plugin-catalog-node": "workspace:^"
"@backstage/plugin-kubernetes-common": "workspace:^"
"@backstage/types": "workspace:^"
"@types/lodash": ^4.14.151
aws-sdk: ^2.840.0
@@ -4997,6 +5000,7 @@ __metadata:
dependencies:
"@backstage/backend-app-api": "workspace:^"
"@backstage/backend-common": "workspace:^"
"@backstage/backend-defaults": "workspace:^"
"@backstage/backend-plugin-api": "workspace:^"
"@backstage/backend-tasks": "workspace:^"
"@backstage/backend-test-utils": "workspace:^"
@@ -21023,6 +21027,7 @@ __metadata:
dependencies:
"@backstage/cli": "workspace:^"
"@backstage/cli-common": "workspace:^"
"@backstage/create-app": "workspace:^"
"@backstage/errors": "workspace:^"
"@types/fs-extra": ^9.0.1
"@types/node": ^16.11.26