Skip to content

Commit

Permalink
Merge pull request #21 from johanneswuerbach/main
Browse files Browse the repository at this point in the history
feat: backstage v1.26.3
  • Loading branch information
johanneswuerbach authored Apr 23, 2024
2 parents c75246e + c32587d commit 47b6eff
Show file tree
Hide file tree
Showing 21 changed files with 5,374 additions and 5,368 deletions.
4 changes: 4 additions & 0 deletions app-config.production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ backend:
user: ${POSTGRES_USER}
password: ${POSTGRES_PASSWORD}

auth:
providers:
guest:
dangerouslyAllowOutsideDevelopment: true

catalog:
rules:
Expand Down
3 changes: 2 additions & 1 deletion app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ techdocs:
type: 'local'

auth:
providers: {}
providers:
guest: {}

scaffolder:

Expand Down
2 changes: 1 addition & 1 deletion backstage.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "1.23.3"
"version": "1.26.3"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
]
},
"devDependencies": {
"@backstage/cli": "^0.25.2",
"@backstage/cli": "^0.26.4",
"@backstage/e2e-test-utils": "^0.1.1",
"@playwright/test": "^1.32.3",
"@spotify/prettier-config": "^12.0.0",
Expand Down
6 changes: 6 additions & 0 deletions packages/app/e2e-tests/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { test, expect } from '@playwright/test';

test('App should render the welcome page', async ({ page }) => {
await page.goto('/');

const enterButton = page.getByRole('button', { name: 'Enter' });
await expect(enterButton).toBeVisible();
await enterButton.click();

await expect(page.getByText('My Company Catalog')).toBeVisible();
});
59 changes: 30 additions & 29 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,37 @@
"lint": "backstage-cli package lint"
},
"dependencies": {
"@backstage/app-defaults": "^1.5.0",
"@backstage/catalog-model": "^1.4.4",
"@backstage/cli": "^0.25.2",
"@backstage/core-app-api": "^1.12.0",
"@backstage/core-components": "^0.14.0",
"@backstage/core-plugin-api": "^1.9.0",
"@backstage/integration-react": "^1.1.24",
"@backstage/plugin-api-docs": "^0.11.0",
"@backstage/plugin-catalog": "^1.17.0",
"@backstage/plugin-catalog-common": "^1.0.21",
"@backstage/plugin-catalog-graph": "^0.4.0",
"@backstage/plugin-catalog-import": "^0.10.6",
"@backstage/plugin-catalog-react": "^1.10.0",
"@backstage/plugin-github-actions": "^0.6.11",
"@backstage/plugin-org": "^0.6.20",
"@backstage/plugin-permission-react": "^0.4.20",
"@backstage/plugin-scaffolder": "^1.18.0",
"@backstage/plugin-scaffolder-react": "^1.8.0",
"@backstage/plugin-search": "^1.4.6",
"@backstage/plugin-search-react": "^1.7.6",
"@backstage/plugin-tech-radar": "^0.6.13",
"@backstage/plugin-techdocs": "^1.10.0",
"@backstage/plugin-techdocs-module-addons-contrib": "^1.1.5",
"@backstage/plugin-techdocs-react": "^1.1.16",
"@backstage/plugin-user-settings": "^0.8.1",
"@backstage/theme": "^0.5.1",
"@frontside/backstage-plugin-humanitec": "^0.3.14",
"@backstage-community/plugin-github-actions": "^0.6.15",
"@backstage-community/plugin-tech-radar": "^0.7.4",
"@backstage/app-defaults": "^1.5.4",
"@backstage/catalog-model": "^1.4.5",
"@backstage/cli": "^0.26.3",
"@backstage/core-app-api": "^1.12.4",
"@backstage/core-components": "^0.14.4",
"@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/plugin-permission-react": "^0.4.22",
"@backstage/plugin-scaffolder": "^1.19.3",
"@backstage/plugin-scaffolder-react": "^1.8.4",
"@backstage/plugin-search": "^1.4.10",
"@backstage/plugin-search-react": "^1.7.10",
"@backstage/plugin-tech-radar": "^0.7.3",
"@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",
"@frontside/backstage-plugin-humanitec": "^0.3.15",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@rjsf/utils": "^5.14.2",
"backstage-plugin-techdocs-addon-mermaid": "^0.11.0",
"history": "^5.0.0",
"react": "^18.0.2",
"react-dom": "^18.0.2",
Expand All @@ -52,7 +53,7 @@
"react-use": "^17.2.4"
},
"devDependencies": {
"@backstage/test-utils": "^1.5.0",
"@backstage/test-utils": "^1.5.4",
"@playwright/test": "^1.32.3",
"@testing-library/dom": "^9.0.0",
"@testing-library/jest-dom": "^6.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/app/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Backstage is an open platform for building developer portals"
content="Backstage is an open source framework for building developer portals"
/>
<!--
manifest.json provides metadata used when your web app is installed on a
Expand Down
11 changes: 9 additions & 2 deletions packages/app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { ValidateHumanitecAppIDFieldExtension } from './scaffolder/ValidateHuman
import { ScaffolderFieldExtensions } from '@backstage/plugin-scaffolder-react';
import { orgPlugin } from '@backstage/plugin-org';
import { SearchPage } from '@backstage/plugin-search';
import { TechRadarPage } from '@backstage/plugin-tech-radar';
import { TechRadarPage } from '@backstage-community/plugin-tech-radar';
import {
TechDocsIndexPage,
techdocsPlugin,
Expand All @@ -29,7 +29,11 @@ import { entityPage } from './components/catalog/EntityPage';
import { searchPage } from './components/search/SearchPage';
import { Root } from './components/Root';

import { AlertDisplay, OAuthRequestDialog } from '@backstage/core-components';
import {
AlertDisplay,
OAuthRequestDialog,
SignInPage,
} from '@backstage/core-components';
import { createApp } from '@backstage/app-defaults';
import { AppRouter, FlatRoutes } from '@backstage/core-app-api';
import { CatalogGraphPage } from '@backstage/plugin-catalog-graph';
Expand All @@ -55,6 +59,9 @@ const app = createApp({
catalogIndex: catalogPlugin.routes.catalogIndex,
});
},
components: {
SignInPage: props => <SignInPage {...props} auto providers={['guest']} />,
},
});

const routes = (
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/components/catalog/EntityPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
import {
isGithubActionsAvailable,
EntityGithubActionsContent,
} from '@backstage/plugin-github-actions';
} from '@backstage-community/plugin-github-actions';
import {
EntityUserProfileCard,
EntityGroupProfileCard,
Expand Down
49 changes: 25 additions & 24 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,39 @@
"build-image": "docker build ../.. -f Dockerfile --tag backstage"
},
"dependencies": {
"@backstage/backend-common": "^0.21.2",
"@backstage/backend-tasks": "^0.5.17",
"@backstage/catalog-client": "^1.6.0",
"@backstage/catalog-model": "^1.4.4",
"@backstage/config": "^1.1.1",
"@backstage/integration": "^1.9.0",
"@backstage/plugin-app-backend": "^0.3.60",
"@backstage/plugin-auth-backend": "^0.21.2",
"@backstage/plugin-auth-node": "^0.4.7",
"@backstage/plugin-catalog-backend": "^1.17.2",
"@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "^0.1.9",
"@backstage/plugin-permission-common": "^0.7.12",
"@backstage/plugin-permission-node": "^0.7.23",
"@backstage/plugin-proxy-backend": "^0.4.10",
"@backstage/plugin-scaffolder-backend": "^1.21.2",
"@backstage/plugin-search-backend": "^1.5.2",
"@backstage/plugin-search-backend-module-pg": "^0.5.21",
"@backstage/plugin-search-backend-node": "^1.2.16",
"@backstage/plugin-techdocs-backend": "^1.9.5",
"@frontside/backstage-plugin-humanitec-backend": "^0.3.16",
"@roadiehq/scaffolder-backend-module-aws": "^2.4.17",
"@backstage/backend-common": "^0.21.7",
"@backstage/backend-defaults": "^0.2.17",
"@backstage/backend-tasks": "^0.5.22",
"@backstage/config": "^1.2.0",
"@backstage/plugin-app-backend": "^0.3.65",
"@backstage/plugin-auth-backend": "^0.22.4",
"@backstage/plugin-auth-backend-module-github-provider": "^0.1.14",
"@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-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.22",
"@backstage/plugin-search-backend-module-techdocs": "^0.1.22",
"@backstage/plugin-search-backend-node": "^1.2.21",
"@backstage/plugin-techdocs-backend": "^1.10.4",
"@frontside/backstage-plugin-humanitec-backend": "^0.3.17",
"@roadiehq/scaffolder-backend-module-aws": "^2.4.23",
"app": "link:../app",
"better-sqlite3": "^9.0.0",
"dockerode": "^3.3.1",
"express": "^4.17.1",
"express-promise-router": "^4.1.0",
"node-gyp": "^9.0.0",
"pg": "^8.11.3",
"winston": "^3.2.1"
},
"devDependencies": {
"@backstage/cli": "^0.25.2",
"@backstage/cli": "^0.26.3",
"@types/dockerode": "^3.3.0",
"@types/express": "^4.17.6",
"@types/express-serve-static-core": "^4.17.5",
Expand Down
147 changes: 37 additions & 110 deletions packages/backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,113 +6,40 @@
* Happy hacking!
*/

import Router from 'express-promise-router';
import {
createServiceBuilder,
loadBackendConfig,
getRootLogger,
useHotMemoize,
notFoundHandler,
CacheManager,
DatabaseManager,
HostDiscovery,
UrlReaders,
ServerTokenManager,
} from '@backstage/backend-common';
import { TaskScheduler } from '@backstage/backend-tasks';
import { Config } from '@backstage/config';
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 techdocs from './plugins/techdocs';
import search from './plugins/search';
import humanitec from './plugins/humanitec';
import { PluginEnvironment } from './types';
import { ServerPermissionClient } from '@backstage/plugin-permission-node';
import { DefaultIdentityClient } from '@backstage/plugin-auth-node';

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

const identity = DefaultIdentityClient.create({
discovery,
});
const permissions = ServerPermissionClient.fromConfig(config, {
discovery,
tokenManager,
});

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,
database,
cache,
config,
reader,
discovery,
tokenManager,
scheduler,
permissions,
identity,
};
};
}

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

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 techdocsEnv = useHotMemoize(module, () => createEnv('techdocs'));
const searchEnv = useHotMemoize(module, () => createEnv('search'));
const appEnv = useHotMemoize(module, () => createEnv('app'));
const humanitecEnv = useHotMemoize(module, () => createEnv('humanitec'));

const apiRouter = Router();
apiRouter.use('/catalog', await catalog(catalogEnv));
apiRouter.use('/scaffolder', await scaffolder(scaffolderEnv));
apiRouter.use('/auth', await auth(authEnv));
apiRouter.use('/techdocs', await techdocs(techdocsEnv));
apiRouter.use('/proxy', await proxy(proxyEnv));
apiRouter.use('/search', await search(searchEnv));
apiRouter.use('/humanitec', await humanitec(humanitecEnv))

// Add backends ABOVE this line; this 404 handler is the catch-all fallback
apiRouter.use(notFoundHandler());

const service = createServiceBuilder(module)
.loadConfig(config)
.addRouter('/api', apiRouter)
.addRouter('', await app(appEnv));

await service.start().catch(err => {
console.log(err);
process.exit(1);
});
}

module.hot?.accept();
main().catch(error => {
console.error('Backend failed to start up', error);
process.exit(1);
});
import { createBackend } from '@backstage/backend-defaults';
import { legacyPlugin } from '@backstage/backend-common';

const backend = createBackend();

backend.add(import('@backstage/plugin-app-backend/alpha'));
backend.add(import('@backstage/plugin-proxy-backend/alpha'));
backend.add(import('@backstage/plugin-scaffolder-backend/alpha'));
backend.add(import('@backstage/plugin-techdocs-backend/alpha'));

// auth plugin
backend.add(import('@backstage/plugin-auth-backend'));
// See https://backstage.io/docs/backend-system/building-backends/migrating#the-auth-plugin
backend.add(import('@backstage/plugin-auth-backend-module-guest-provider'));
// See https://backstage.io/docs/auth/guest/provider

// catalog plugin
backend.add(import('@backstage/plugin-catalog-backend/alpha'));
backend.add(
import('@backstage/plugin-catalog-backend-module-scaffolder-entity-model'),
);

// permission plugin
backend.add(import('@backstage/plugin-permission-backend/alpha'));
backend.add(
import('@backstage/plugin-permission-backend-module-allow-all-policy'),
);

// search plugin
backend.add(import('@backstage/plugin-search-backend/alpha'));
backend.add(import('@backstage/plugin-search-backend-module-catalog/alpha'));
backend.add(import('@backstage/plugin-search-backend-module-techdocs/alpha'));

// humanitec
backend.add(legacyPlugin('humanitec', import('./plugins/humanitec')));

backend.start();
Loading

0 comments on commit 47b6eff

Please sign in to comment.