Merge pull request #529 from awanlin/topic/azure-devops-1.27-version-bump

Azure DevOps - 1.27.6 version bump
This commit is contained in:
Andre Wanlin 2024-06-11 06:55:32 -05:00 committed by GitHub
commit afda7535a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 1443 additions and 1007 deletions

View File

@ -0,0 +1,7 @@
---
'@backstage-community/plugin-azure-devops-backend': patch
'@backstage-community/plugin-azure-devops-common': patch
'@backstage-community/plugin-azure-devops': patch
---
Backstage `1.27.6` version bump

View File

@ -1,3 +1,3 @@
{
"version": "1.26.4"
"version": "1.27.6"
}

View File

@ -36,9 +36,9 @@
"directory": "workspaces/azure-devops"
},
"devDependencies": {
"@backstage/cli": "^0.26.4",
"@backstage/cli": "^0.26.6",
"@backstage/e2e-test-utils": "^0.1.1",
"@backstage/repo-tools": "^0.8.0",
"@backstage/repo-tools": "^0.9.0",
"@changesets/cli": "^2.27.1",
"@spotify/prettier-config": "^15.0.0",
"concurrently": "^8.0.0",

View File

@ -20,29 +20,29 @@
},
"dependencies": {
"@backstage-community/plugin-azure-devops": "workspace:^",
"@backstage/app-defaults": "^1.5.4",
"@backstage/catalog-model": "^1.4.5",
"@backstage/cli": "^0.26.4",
"@backstage/core-app-api": "^1.12.4",
"@backstage/core-components": "^0.14.5",
"@backstage/app-defaults": "^1.5.5",
"@backstage/catalog-model": "^1.5.0",
"@backstage/cli": "^0.26.6",
"@backstage/core-app-api": "^1.12.5",
"@backstage/core-components": "^0.14.7",
"@backstage/core-plugin-api": "^1.9.2",
"@backstage/integration-react": "^1.1.26",
"@backstage/plugin-api-docs": "^0.11.4",
"@backstage/plugin-catalog": "^1.19.0",
"@backstage/plugin-catalog-common": "^1.0.22",
"@backstage/plugin-catalog-graph": "^0.4.4",
"@backstage/plugin-catalog-import": "^0.10.10",
"@backstage/plugin-catalog-react": "^1.11.3",
"@backstage/plugin-org": "^0.6.24",
"@backstage/integration-react": "^1.1.27",
"@backstage/plugin-api-docs": "^0.11.5",
"@backstage/plugin-catalog": "^1.20.0",
"@backstage/plugin-catalog-common": "^1.0.23",
"@backstage/plugin-catalog-graph": "^0.4.5",
"@backstage/plugin-catalog-import": "^0.11.0",
"@backstage/plugin-catalog-react": "^1.12.0",
"@backstage/plugin-org": "^0.6.25",
"@backstage/plugin-permission-react": "^0.4.22",
"@backstage/plugin-scaffolder": "^1.19.3",
"@backstage/plugin-search": "^1.4.10",
"@backstage/plugin-search-react": "^1.7.10",
"@backstage/plugin-techdocs": "^1.10.4",
"@backstage/plugin-techdocs-module-addons-contrib": "^1.1.9",
"@backstage/plugin-techdocs-react": "^1.2.3",
"@backstage/plugin-user-settings": "^0.8.5",
"@backstage/theme": "^0.5.3",
"@backstage/plugin-scaffolder": "^1.20.1",
"@backstage/plugin-search": "^1.4.11",
"@backstage/plugin-search-react": "^1.7.11",
"@backstage/plugin-techdocs": "^1.10.5",
"@backstage/plugin-techdocs-module-addons-contrib": "^1.1.10",
"@backstage/plugin-techdocs-react": "^1.2.4",
"@backstage/plugin-user-settings": "^0.8.6",
"@backstage/theme": "^0.5.5",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"history": "^5.0.0",
@ -53,7 +53,7 @@
"react-use": "^17.2.4"
},
"devDependencies": {
"@backstage/test-utils": "^1.5.4",
"@backstage/test-utils": "^1.5.5",
"@playwright/test": "^1.32.3",
"@testing-library/dom": "^9.0.0",
"@testing-library/jest-dom": "^6.0.0",

View File

@ -22,27 +22,27 @@
},
"dependencies": {
"@backstage-community/plugin-azure-devops-backend": "workspace:^",
"@backstage/backend-common": "^0.21.7",
"@backstage/backend-defaults": "^0.2.17",
"@backstage/backend-tasks": "^0.5.22",
"@backstage/backend-common": "^0.22.0",
"@backstage/backend-defaults": "^0.2.18",
"@backstage/backend-tasks": "^0.5.23",
"@backstage/config": "^1.2.0",
"@backstage/plugin-app-backend": "^0.3.65",
"@backstage/plugin-auth-backend": "^0.22.4",
"@backstage/plugin-auth-backend-module-guest-provider": "^0.1.3",
"@backstage/plugin-auth-node": "^0.4.12",
"@backstage/plugin-catalog-backend": "^1.21.1",
"@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "^0.1.15",
"@backstage/plugin-permission-backend": "^0.5.41",
"@backstage/plugin-permission-backend-module-allow-all-policy": "^0.1.14",
"@backstage/plugin-app-backend": "^0.3.67",
"@backstage/plugin-auth-backend": "^0.22.5",
"@backstage/plugin-auth-backend-module-guest-provider": "^0.1.4",
"@backstage/plugin-auth-node": "^0.4.13",
"@backstage/plugin-catalog-backend": "^1.22.0",
"@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "^0.1.16",
"@backstage/plugin-permission-backend": "^0.5.42",
"@backstage/plugin-permission-backend-module-allow-all-policy": "^0.1.15",
"@backstage/plugin-permission-common": "^0.7.13",
"@backstage/plugin-permission-node": "^0.7.28",
"@backstage/plugin-proxy-backend": "^0.4.15",
"@backstage/plugin-scaffolder-backend": "^1.22.4",
"@backstage/plugin-search-backend": "^1.5.7",
"@backstage/plugin-search-backend-module-catalog": "^0.1.23",
"@backstage/plugin-search-backend-module-techdocs": "^0.1.22",
"@backstage/plugin-search-backend-node": "^1.2.21",
"@backstage/plugin-techdocs-backend": "^1.10.4",
"@backstage/plugin-permission-node": "^0.7.29",
"@backstage/plugin-proxy-backend": "^0.4.16",
"@backstage/plugin-scaffolder-backend": "^1.22.7",
"@backstage/plugin-search-backend": "^1.5.9",
"@backstage/plugin-search-backend-module-catalog": "^0.1.24",
"@backstage/plugin-search-backend-module-techdocs": "^0.1.23",
"@backstage/plugin-search-backend-node": "^1.2.23",
"@backstage/plugin-techdocs-backend": "^1.10.5",
"app": "link:../app",
"better-sqlite3": "^9.0.0",
"dockerode": "^3.3.1",
@ -51,7 +51,7 @@
"winston": "^3.2.1"
},
"devDependencies": {
"@backstage/cli": "^0.26.4",
"@backstage/cli": "^0.26.6",
"@types/dockerode": "^3.3.0",
"@types/express": "^4.17.6",
"@types/express-serve-static-core": "^4.17.5",

View File

@ -10,13 +10,15 @@ import { BuildRun } from '@backstage-community/plugin-azure-devops-common';
import { CatalogProcessor } from '@backstage/plugin-catalog-node';
import { Config } from '@backstage/config';
import { DashboardPullRequest } from '@backstage-community/plugin-azure-devops-common';
import { DiscoveryService } from '@backstage/backend-plugin-api';
import { Entity } from '@backstage/catalog-model';
import express from 'express';
import { GitRepository } from 'azure-devops-node-api/interfaces/GitInterfaces';
import { GitTag } from '@backstage-community/plugin-azure-devops-common';
import { HttpAuthService } from '@backstage/backend-plugin-api';
import { LocationSpec } from '@backstage/plugin-catalog-common';
import { LoggerService } from '@backstage/backend-plugin-api';
import { PermissionEvaluator } from '@backstage/plugin-permission-common';
import { PermissionsService } from '@backstage/backend-plugin-api';
import { Project } from '@backstage-community/plugin-azure-devops-common';
import { PullRequest } from '@backstage-community/plugin-azure-devops-common';
import { PullRequestOptions } from '@backstage-community/plugin-azure-devops-common';
@ -159,9 +161,13 @@ export interface RouterOptions {
// (undocumented)
config: Config;
// (undocumented)
discovery: DiscoveryService;
// (undocumented)
httpAuth?: HttpAuthService;
// (undocumented)
logger: LoggerService;
// (undocumented)
permissions: PermissionEvaluator;
permissions: PermissionsService;
// (undocumented)
reader: UrlReader;
}

View File

@ -29,17 +29,17 @@
},
"dependencies": {
"@backstage-community/plugin-azure-devops-common": "workspace:^",
"@backstage/backend-common": "^0.21.7",
"@backstage/backend-plugin-api": "^0.6.17",
"@backstage/catalog-model": "^1.4.5",
"@backstage/backend-common": "^0.22.0",
"@backstage/backend-plugin-api": "^0.6.18",
"@backstage/catalog-model": "^1.5.0",
"@backstage/config": "^1.2.0",
"@backstage/errors": "^1.2.4",
"@backstage/integration": "^1.10.0",
"@backstage/plugin-auth-node": "^0.4.12",
"@backstage/plugin-catalog-common": "^1.0.22",
"@backstage/plugin-catalog-node": "^1.11.1",
"@backstage/integration": "^1.11.0",
"@backstage/plugin-auth-node": "^0.4.13",
"@backstage/plugin-catalog-common": "^1.0.23",
"@backstage/plugin-catalog-node": "^1.12.0",
"@backstage/plugin-permission-common": "^0.7.13",
"@backstage/plugin-permission-node": "^0.7.28",
"@backstage/plugin-permission-node": "^0.7.29",
"@types/express": "^4.17.6",
"azure-devops-node-api": "^13.0.0",
"express": "^4.17.1",
@ -50,7 +50,8 @@
"yn": "^4.0.0"
},
"devDependencies": {
"@backstage/cli": "^0.26.4",
"@backstage/backend-test-utils": "^0.3.8",
"@backstage/cli": "^0.26.6",
"@types/lodash": "^4.14.151",
"@types/mime-types": "^2.1.0",
"@types/supertest": "^2.0.8",

View File

@ -35,14 +35,26 @@ export const azureDevOpsPlugin = createBackendPlugin({
reader: coreServices.urlReader,
permissions: coreServices.permissions,
httpRouter: coreServices.httpRouter,
discovery: coreServices.discovery,
httpAuth: coreServices.httpAuth,
},
async init({ config, logger, reader, permissions, httpRouter }) {
async init({
config,
logger,
reader,
permissions,
httpRouter,
discovery,
httpAuth,
}) {
httpRouter.use(
await createRouter({
config,
logger,
reader,
permissions,
discovery,
httpAuth,
}),
);
httpRouter.addAuthPolicy({

View File

@ -1,33 +0,0 @@
/*
* Copyright 2021 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 { getRootLogger } from '@backstage/backend-common';
import yn from 'yn';
import { startStandaloneServer } from './service/standaloneServer';
const port = process.env.PLUGIN_PORT ? Number(process.env.PLUGIN_PORT) : 7007;
const enableCors = yn(process.env.PLUGIN_CORS, { default: false });
const logger = getRootLogger();
startStandaloneServer({ port, enableCors, logger }).catch(err => {
logger.error(err);
process.exit(1);
});
process.on('SIGINT', () => {
logger.info('CTRL+C pressed; exiting.');
process.exit(0);
});

View File

@ -36,6 +36,7 @@ import express from 'express';
import { getVoidLogger, UrlReaders } from '@backstage/backend-common';
import request from 'supertest';
import { AuthorizeResult } from '@backstage/plugin-permission-common';
import { mockServices } from '@backstage/backend-test-utils';
describe('createRouter', () => {
let azureDevOpsApi: jest.Mocked<AzureDevOpsApi>;
@ -92,6 +93,7 @@ describe('createRouter', () => {
logger,
}),
permissions: mockPermissionEvaluator,
discovery: mockServices.discovery(),
});
app = express().use(router);

View File

@ -32,16 +32,21 @@ import {
PullRequestsDashboardProvider,
} from '../api/PullRequestsDashboardProvider';
import Router from 'express-promise-router';
import { errorHandler, UrlReader } from '@backstage/backend-common';
import {
createLegacyAuthAdapters,
errorHandler,
UrlReader,
} from '@backstage/backend-common';
import express from 'express';
import { InputError, NotAllowedError } from '@backstage/errors';
import { getBearerTokenFromAuthorizationHeader } from '@backstage/plugin-auth-node';
import {
AuthorizeResult,
PermissionEvaluator,
} from '@backstage/plugin-permission-common';
import { AuthorizeResult } from '@backstage/plugin-permission-common';
import { createPermissionIntegrationRouter } from '@backstage/plugin-permission-node';
import { LoggerService } from '@backstage/backend-plugin-api';
import {
DiscoveryService,
HttpAuthService,
LoggerService,
PermissionsService,
} from '@backstage/backend-plugin-api';
const DEFAULT_TOP = 10;
@ -51,7 +56,9 @@ export interface RouterOptions {
logger: LoggerService;
config: Config;
reader: UrlReader;
permissions: PermissionEvaluator;
permissions: PermissionsService;
discovery: DiscoveryService;
httpAuth?: HttpAuthService;
}
/** @public */
@ -60,6 +67,8 @@ export async function createRouter(
): Promise<express.Router> {
const { logger, reader, config, permissions } = options;
const { httpAuth } = createLegacyAuthAdapters(options);
if (config.getOptionalString('azureDevOps.token')) {
logger.warn(
"The 'azureDevOps.token' has been deprecated, use 'integrations.azure' instead, for more details see: https://backstage.io/docs/integrations/azure/locations",
@ -142,9 +151,6 @@ export async function createRouter(
throw new InputError('Invalid entityRef, not a string');
}
const token = getBearerTokenFromAuthorizationHeader(
req.header('authorization'),
);
const decision = (
await permissions.authorize(
[
@ -153,9 +159,7 @@ export async function createRouter(
resourceRef: entityRef,
},
],
{
token,
},
{ credentials: await httpAuth.credentials(req) },
)
)[0];
@ -196,9 +200,6 @@ export async function createRouter(
throw new InputError('Invalid entityRef, not a string');
}
const token = getBearerTokenFromAuthorizationHeader(
req.header('authorization'),
);
const decision = (
await permissions.authorize(
[
@ -207,9 +208,7 @@ export async function createRouter(
resourceRef: entityRef,
},
],
{
token,
},
{ credentials: await httpAuth.credentials(req) },
)
)[0];
@ -246,9 +245,6 @@ export async function createRouter(
teamsLimit: teamsLimit,
};
const token = getBearerTokenFromAuthorizationHeader(
req.header('authorization'),
);
const decision = (
await permissions.authorize(
[
@ -256,9 +252,7 @@ export async function createRouter(
permission: azureDevOpsPullRequestDashboardReadPermission,
},
],
{
token,
},
{ credentials: await httpAuth.credentials(req) },
)
)[0];
@ -310,9 +304,6 @@ export async function createRouter(
throw new InputError('Invalid entityRef, not a string');
}
const token = getBearerTokenFromAuthorizationHeader(
req.header('authorization'),
);
const decision = (
await permissions.authorize(
[
@ -321,9 +312,7 @@ export async function createRouter(
resourceRef: entityRef,
},
],
{
token,
},
{ credentials: await httpAuth.credentials(req) },
)
)[0];
@ -375,9 +364,6 @@ export async function createRouter(
throw new InputError('Invalid entityRef, not a string');
}
const token = getBearerTokenFromAuthorizationHeader(
req.header('authorization'),
);
const decision = (
await permissions.authorize(
[
@ -386,9 +372,7 @@ export async function createRouter(
resourceRef: entityRef,
},
],
{
token,
},
{ credentials: await httpAuth.credentials(req) },
)
)[0];

View File

@ -1,72 +0,0 @@
/*
* Copyright 2021 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 {
createServiceBuilder,
HostDiscovery,
loadBackendConfig,
ServerTokenManager,
UrlReaders,
} from '@backstage/backend-common';
import { Server } from 'http';
import { createRouter } from './router';
import { ServerPermissionClient } from '@backstage/plugin-permission-node';
import { LoggerService } from '@backstage/backend-plugin-api';
export interface ServerOptions {
port: number;
enableCors: boolean;
logger: LoggerService;
}
export async function startStandaloneServer(
options: ServerOptions,
): Promise<Server> {
const logger = options.logger.child({ service: 'azure-devops-backend' });
const config = await loadBackendConfig({ logger, argv: process.argv });
const discovery = HostDiscovery.fromConfig(config);
logger.debug('Starting application server...');
const tokenManager = ServerTokenManager.fromConfig(config, {
logger,
});
const permissions = ServerPermissionClient.fromConfig(config, {
discovery,
tokenManager,
});
const router = await createRouter({
logger,
config,
reader: UrlReaders.default({ logger, config }),
permissions,
});
let service = createServiceBuilder(module)
.setPort(options.port)
.addRouter('/azure-devops', router);
if (options.enableCors) {
service = service.enableCors({ origin: 'http://localhost:3000' });
}
return await service.start().catch(err => {
logger.error(err);
process.exit(1);
});
}
module.hot?.accept();

View File

@ -35,10 +35,10 @@
"test": "backstage-cli package test"
},
"dependencies": {
"@backstage/plugin-catalog-common": "^1.0.22",
"@backstage/plugin-catalog-common": "^1.0.23",
"@backstage/plugin-permission-common": "^0.7.13"
},
"devDependencies": {
"@backstage/cli": "^0.26.4"
"@backstage/cli": "^0.26.6"
}
}

View File

@ -46,13 +46,13 @@
},
"dependencies": {
"@backstage-community/plugin-azure-devops-common": "workspace:^",
"@backstage/catalog-model": "^1.4.5",
"@backstage/core-compat-api": "^0.2.4",
"@backstage/core-components": "^0.14.5",
"@backstage/catalog-model": "^1.5.0",
"@backstage/core-compat-api": "^0.2.5",
"@backstage/core-components": "^0.14.7",
"@backstage/core-plugin-api": "^1.9.2",
"@backstage/errors": "^1.2.4",
"@backstage/frontend-plugin-api": "^0.6.4",
"@backstage/plugin-catalog-react": "^1.11.3",
"@backstage/frontend-plugin-api": "^0.6.5",
"@backstage/plugin-catalog-react": "^1.12.0",
"@backstage/plugin-permission-react": "^0.4.22",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
@ -62,9 +62,9 @@
"react-use": "^17.2.4"
},
"devDependencies": {
"@backstage/cli": "^0.26.4",
"@backstage/dev-utils": "^1.0.31",
"@backstage/test-utils": "^1.5.4",
"@backstage/cli": "^0.26.6",
"@backstage/dev-utils": "^1.0.32",
"@backstage/test-utils": "^1.5.5",
"@testing-library/dom": "^10.0.0",
"@testing-library/jest-dom": "^6.0.0",
"@testing-library/react": "^15.0.0",

View File

@ -54,7 +54,7 @@ const PolicyInProgressIcon = withStyles(
{ name: 'PolicyInProgressIcon' },
)(GroupWorkIcon);
function getPolicyIcon(policy: Policy): JSX.Element | null {
function getPolicyIcon(policy: Policy): React.JSX.Element | null {
switch (policy.type) {
case PolicyType.Build:
switch (policy.status) {

File diff suppressed because it is too large Load Diff