Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[draft] bump-backstage-core-1.31 #295

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backstage.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "1.22.1"
"version": "1.31.2"
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
"jest-environment-jsdom": "30.0.0-alpha.2"
},
"devDependencies": {
"@backstage/cli": "^0.25.1",
"@backstage/e2e-test-utils": "^0.1.0",
"@backstage/repo-tools": "^0.5.2",
"@backstage/cli": "^0.27.1",
"@backstage/e2e-test-utils": "^0.1.1",
"@backstage/repo-tools": "^0.9.7",
"@changesets/cli": "2.27.1",
"@playwright/test": "^1.43.0",
"@spotify/prettier-config": "14.1.6",
Expand Down
48 changes: 24 additions & 24 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@
"lint": "backstage-cli package lint"
},
"dependencies": {
"@backstage/app-defaults": "^1.4.7",
"@backstage/catalog-model": "^1.4.3",
"@backstage/cli": "^0.25.1",
"@backstage/config": "^1.1.1",
"@backstage/core-app-api": "^1.11.3",
"@backstage/core-components": "^0.13.10",
"@backstage/core-plugin-api": "^1.8.2",
"@backstage/integration-react": "^1.1.23",
"@backstage/plugin-api-docs": "^0.10.3",
"@backstage/plugin-catalog": "^1.16.1",
"@backstage/plugin-catalog-common": "^1.0.20",
"@backstage/plugin-catalog-graph": "^0.3.3",
"@backstage/plugin-catalog-import": "^0.10.5",
"@backstage/plugin-catalog-react": "^1.9.3",
"@backstage/plugin-home": "^0.6.1",
"@backstage/plugin-org": "^0.6.19",
"@backstage/plugin-scaffolder": "^1.17.1",
"@backstage/plugin-search": "^1.4.5",
"@backstage/plugin-tech-radar": "^0.6.12",
"@backstage/plugin-user-settings": "^0.8.0",
"@backstage/test-utils": "^1.4.7",
"@backstage/theme": "^0.5.0",
"@backstage/app-defaults": "^1.5.11",
"@backstage/catalog-model": "^1.7.0",
"@backstage/cli": "^0.27.1",
"@backstage/config": "^1.2.0",
"@backstage/core-app-api": "^1.15.0",
"@backstage/core-components": "^0.15.0",
"@backstage/core-plugin-api": "^1.9.4",
"@backstage/integration-react": "^1.1.32",
"@backstage/plugin-api-docs": "^0.11.10",
"@backstage/plugin-catalog": "^1.23.1",
"@backstage/plugin-catalog-common": "^1.1.0",
"@backstage/plugin-catalog-graph": "^0.4.10",
"@backstage/plugin-catalog-import": "^0.12.4",
"@backstage/plugin-catalog-react": "^1.13.1",
"@backstage/plugin-home": "^0.7.11",
"@backstage/plugin-org": "^0.6.30",
"@backstage/plugin-scaffolder": "^1.25.1",
"@backstage/plugin-search": "^1.4.17",
"@backstage/plugin-tech-radar": "^0.7.4",
"@backstage/plugin-user-settings": "^0.8.13",
"@backstage/test-utils": "^1.6.0",
"@backstage/theme": "^0.5.7",
"@material-ui/core": "4.12.4",
"@material-ui/icons": "4.11.3",
"@oriflame/backstage-plugin-score-card": "^0.9.0",
Expand All @@ -49,8 +49,8 @@
"react-use": "17.5.0"
},
"devDependencies": {
"@backstage/e2e-test-utils": "^0.1.0",
"@backstage/test-utils": "^1.4.7",
"@backstage/e2e-test-utils": "^0.1.1",
"@backstage/test-utils": "^1.6.0",
"@playwright/test": "^1.43.0",
"@testing-library/dom": "^9.0.0",
"@testing-library/jest-dom": "^6.0.0",
Expand Down
42 changes: 15 additions & 27 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,27 @@
"lint": "backstage-cli package lint",
"test": "backstage-cli package test",
"clean": "backstage-cli package clean",
"build-image": "docker build ../.. -f Dockerfile --tag backstage",
"migrate:create": "knex migrate:make -x ts"
"build-image": "docker build ../.. -f Dockerfile --tag backstage"
},
"dependencies": {
"@backstage/backend-common": "^0.20.2",
"@backstage/backend-tasks": "^0.5.14",
"@backstage/catalog-client": "^1.5.2",
"@backstage/catalog-model": "^1.4.3",
"@backstage/config": "^1.1.1",
"@backstage/integration": "^1.8.0",
"@backstage/plugin-app-backend": "^0.3.57",
"@backstage/plugin-auth-backend": "^0.20.3",
"@backstage/plugin-catalog-backend": "^1.16.1",
"@backstage/plugin-permission-common": "^0.7.12",
"@backstage/plugin-permission-node": "^0.7.20",
"@backstage/plugin-proxy-backend": "^0.4.7",
"@backstage/plugin-scaffolder-backend": "^1.20.0",
"@gitbeaker/node": "35.8.1",
"@octokit/rest": "18.12.0",
"@backstage/backend-defaults": "^0.5.0",
"@backstage/config": "^1.2.0",
"@backstage/plugin-app-backend": "^0.3.74",
"@backstage/plugin-auth-backend": "^0.23.0",
"@backstage/plugin-auth-backend-module-guest-provider": "^0.2.0",
"@backstage/plugin-catalog-backend": "^1.26.0",
"@backstage/plugin-permission-common": "^0.8.1",
"@backstage/plugin-permission-node": "^0.8.3",
"@backstage/plugin-proxy-backend": "^0.5.6",
"@backstage/plugin-scaffolder-backend": "^1.25.0",
"app": "link:../app",
"better-sqlite3": "9.6.0",
"dockerode": "3.3.5",
"express": "4.19.2",
"express-promise-router": "4.1.1",
"knex": "2.5.1",
"luxon": "3.4.4",
"node-gyp": "^9.0.0",
"serialize-error": "8.1.0",
"winston": "3.13.0"
"node-gyp": "^10.0.0",
"pg": "^8.11.3",
"winston": "^3.2.1"
},
"devDependencies": {
"@backstage/cli": "^0.25.1",
"@types/dockerode": "3.3.28",
"@backstage/cli": "^0.27.1",
"@types/express": "4.17.21",
"@types/express-serve-static-core": "4.19.0",
"@types/luxon": "3.4.2"
Expand Down
9 changes: 0 additions & 9 deletions packages/backend/src/index.test.ts

This file was deleted.

155 changes: 26 additions & 129 deletions packages/backend/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,139 +1,36 @@
/*
* Hi!
* Copyright 2022 The Backstage Authors
*
* Note that this is an EXAMPLE Backstage backend. Please check the README.
* 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
*
* Happy hacking!
* 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.
*/

// eslint-disable-next-line notice/notice
const { version } = require('../package.json');

import Router from 'express-promise-router';
import {
CacheManager,
createServiceBuilder,
getRootLogger,
loadBackendConfig,
notFoundHandler,
DatabaseManager,
SingleHostDiscovery,
UrlReaders,
useHotMemoize,
ServerTokenManager,
} from '@backstage/backend-common';
import { Config } from '@backstage/config';
import healthcheck from './plugins/healthcheck';
import { TaskScheduler } from '@backstage/backend-tasks';
import app from './plugins/app';
import auth from './plugins/auth';
import catalog from './plugins/catalog';
import scaffolder from './plugins/scaffolder';
import proxy from './plugins/proxy';
import { PluginEnvironment } from './types';
import { ServerPermissionClient } from '@backstage/plugin-permission-node';
import {serializeError} from 'serialize-error';

const safeFatalError = async (message: string, error?: Error) => {
try {
// if available, use the root logger (shall send the message to AppInsights too)
const logger = getRootLogger();
logger.error(message);
logger.error(`Full error: ${serializeError(error)}`)
} catch (_e) {
console.error(message);
}
if (process.env.NODE_ENV === 'development') {
console.error(
`DEVELOPMENT server (watcher) ${process.ppid} will be killed now...`,
);
process.kill(process.ppid);
}
console.info(`Process ${process.pid} will exit now...`);
process.exit(1);
};

function makeCreateEnv(config: Config) {
const root = getRootLogger();
const reader = UrlReaders.default({ logger: root, config });
const discovery = SingleHostDiscovery.fromConfig(config);
const tokenManager = ServerTokenManager.fromConfig(config, { logger: root });
const permissions = ServerPermissionClient.fromConfig(config, {
discovery,
tokenManager,
});
const databaseManager = DatabaseManager.fromConfig(config);
const cacheManager = CacheManager.fromConfig(config);
const taskScheduler = TaskScheduler.fromConfig(config);

root.info(`Created UrlReader ${reader}`);

return (plugin: string): PluginEnvironment => {
const logger = root.child({ type: 'plugin', plugin });
const database = databaseManager.forPlugin(plugin);
const cache = cacheManager.forPlugin(plugin);
const scheduler = taskScheduler.forPlugin(plugin);
return {
logger,
cache,
database,
config,
reader,
discovery,
tokenManager,
permissions,
scheduler,
};
};
}

async function main() {
const logger = getRootLogger();

logger.info(`App starting: version [${version}]`);

const config = await loadBackendConfig({
argv: process.argv,
logger,
});
const createEnv = makeCreateEnv(config);

const healthcheckEnv = useHotMemoize(module, () => createEnv('healthcheck'));
const catalogEnv = useHotMemoize(module, () => createEnv('catalog'));
const scaffolderEnv = useHotMemoize(module, () => createEnv('scaffolder'));
const authEnv = useHotMemoize(module, () => createEnv('auth'));
const proxyEnv = useHotMemoize(module, () => createEnv('proxy'));
const appEnv = useHotMemoize(module, () => createEnv('app'));
import { createBackend } from '@backstage/backend-defaults';

const apiRouter = Router();
apiRouter.use('/catalog', await catalog(catalogEnv));
apiRouter.use('/scaffolder', await scaffolder(scaffolderEnv));
apiRouter.use('/auth', await auth(authEnv));
apiRouter.use('/proxy', await proxy(proxyEnv));
apiRouter.use(notFoundHandler());
const backend = createBackend();

try {
logger.info('Creating service...');
const service = createServiceBuilder(module)
.loadConfig(config)
.addRouter('', await healthcheck(healthcheckEnv))
.addRouter('/api', apiRouter)
.addRouter('', await app(appEnv));

logger.info('Starting service...');
await service.start().catch(async err => {
await safeFatalError(`service.start() failed: ${err}`);
});
} catch (error) {
if (typeof error === 'string') {
await safeFatalError(`main() failed: ${error}`);
} else if (error instanceof Error) {
await safeFatalError(`main() failed: ${error.message}`, error as Error);
}
}
}
backend.add(import('@backstage/plugin-auth-backend'));
backend.add(import('@backstage/plugin-auth-backend-module-guest-provider'));
backend.add(
import('@backstage/plugin-catalog-backend-module-scaffolder-entity-model'),
);
backend.add(import('@backstage/plugin-catalog-backend'));
// backend.add(
// import('@backstage/plugin-permission-backend-module-allow-all-policy'),
// );
backend.add(import('@backstage/plugin-proxy-backend'));
backend.add(import('@backstage/plugin-scaffolder-backend'));
backend.add(import('@backstage/plugin-scaffolder-backend-module-github'));

module.hot?.accept();
main().catch(async error => {
await safeFatalError(`Backend failed to start up: ${error}`);
});
backend.start();
15 changes: 0 additions & 15 deletions packages/backend/src/plugins/app.ts

This file was deleted.

20 changes: 0 additions & 20 deletions packages/backend/src/plugins/auth.ts

This file was deleted.

38 changes: 0 additions & 38 deletions packages/backend/src/plugins/catalog.ts

This file was deleted.

Loading
Loading