From 6659a555fc1ff64528e40459a3140dc95bf6bcec Mon Sep 17 00:00:00 2001 From: Marek Libra Date: Mon, 26 Aug 2024 14:51:59 +0200 Subject: [PATCH] DO NOT MERGE: add orchestrator with GH identity provider (1.32, 11/2024) --- app-config.yaml | 31 ++++++++++++----------- packages/app/package.json | 1 + packages/app/src/App.tsx | 20 ++++++++++++++- packages/app/src/components/Root/Root.tsx | 7 +++++ packages/backend/package.json | 2 ++ packages/backend/src/index.ts | 3 +++ plugins/orchestrator-backend/user.yaml | 10 ++++++++ 7 files changed, 58 insertions(+), 16 deletions(-) create mode 100644 plugins/orchestrator-backend/user.yaml diff --git a/app-config.yaml b/app-config.yaml index c595b021c54..0dd3a7288f5 100644 --- a/app-config.yaml +++ b/app-config.yaml @@ -18,7 +18,7 @@ backend: # Uncomment the following host directive to bind to specific interfaces # host: 127.0.0.1 csp: - connect-src: ["'self'", 'http:', 'https:'] + connect-src: ["'self'", "http:", "https:"] # Content-Security-Policy directives follow the Helmet format: https://helmetjs.github.io/#reference # Default Helmet Content-Security-Policy values can be removed by setting the key to false cors: @@ -29,7 +29,7 @@ backend: # The production database configuration is stored in app-config.production.yaml database: client: better-sqlite3 - connection: ':memory:' + connection: ":memory:" cache: store: memory # workingDirectory: /tmp # Use this to configure a working directory for the scaffolder, defaults to the OS temp-dir @@ -37,10 +37,10 @@ backend: integrations: {} proxy: - '/quay/api': - target: 'https://quay.io' + "/quay/api": + target: "https://quay.io" headers: - X-Requested-With: 'XMLHttpRequest' + X-Requested-With: "XMLHttpRequest" # Uncomment the following line to access a private Quay Repository using a token # Authorization: 'Bearer ' changeOrigin: true @@ -48,18 +48,14 @@ proxy: secure: true quay: - uiUrl: 'https://quay.io' + uiUrl: "https://quay.io" techdocs: - builder: 'local' # Alternatives - 'external' + builder: "local" # Alternatives - 'external' generator: - runIn: 'docker' # Alternatives - 'local' + runIn: "docker" # Alternatives - 'local' publisher: - type: 'local' # Alternatives - 'googleGcs' or 'awsS3'. Read documentation for using alternatives. - -auth: - # see https://backstage.io/docs/auth/ to learn about auth providers - providers: { guest: {} } + type: "local" # Alternatives - 'googleGcs' or 'awsS3'. Read documentation for using alternatives. scaffolder: {} @@ -70,13 +66,18 @@ catalog: entityFilename: catalog-info.yaml pullRequestBranchName: backstage-integration rules: - - allow: [Component, System, Group, Resource, Location, Template, API] + - allow: [Component, System, Group, Resource, Location, Template, API, User] locations: - type: url target: https://github.com/janus-idp/backstage-showcase/blob/main/catalog-entities/all.yaml - + - type: url target: https://github.com/redhat-developer/red-hat-developer-hub-software-templates/blob/main/templates.yaml + - type: file + target: /home/mlibra/src/janus-idp-backstage-plugins/plugins/orchestrator-backend/user.yaml + rules: + - allow: [User] + dynamicPlugins: frontend: {} diff --git a/packages/app/package.json b/packages/app/package.json index 0f293bca598..3d3fb89e244 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -49,6 +49,7 @@ "@backstage/plugin-user-settings": "^0.8.14", "@emotion/react": "11.11.4", "@emotion/styled": "^11.13.0", + "@janus-idp/backstage-plugin-orchestrator": "*", "@mui/icons-material": "5.15.16", "@mui/material": "5.15.16", "@mui/styles": "5.15.16", diff --git a/packages/app/src/App.tsx b/packages/app/src/App.tsx index d601a5bdaef..808980000cf 100644 --- a/packages/app/src/App.tsx +++ b/packages/app/src/App.tsx @@ -7,6 +7,7 @@ import { OAuthRequestDialog, SignInPage, } from '@backstage/core-components'; +import { githubAuthApiRef } from '@backstage/core-plugin-api'; import { apiDocsPlugin, ApiExplorerPage } from '@backstage/plugin-api-docs'; import { CatalogEntityPage, @@ -34,6 +35,8 @@ import { UserSettingsPage } from '@backstage/plugin-user-settings'; import { getThemes } from '@redhat-developer/red-hat-developer-hub-theme'; +import { OrchestratorPage } from '@janus-idp/backstage-plugin-orchestrator'; + import { apis } from './apis'; import { entityPage } from './components/catalog/EntityPage'; import { Root } from './components/Root'; @@ -59,7 +62,21 @@ const app = createApp({ }); }, components: { - SignInPage: props => , + SignInPage: props => ( + + ), }, themes: getThemes(), }); @@ -98,6 +115,7 @@ const routes = ( } /> } /> + } /> ); diff --git a/packages/app/src/components/Root/Root.tsx b/packages/app/src/components/Root/Root.tsx index fa83e4d30d4..ff7fb2e5b12 100644 --- a/packages/app/src/components/Root/Root.tsx +++ b/packages/app/src/components/Root/Root.tsx @@ -26,6 +26,8 @@ import GroupIcon from '@mui/icons-material/People'; import SearchIcon from '@mui/icons-material/Search'; import { makeStyles } from 'tss-react/mui'; +import { OrchestratorIcon } from '@janus-idp/backstage-plugin-orchestrator'; + import LogoFull from './LogoFull'; import LogoIcon from './LogoIcon'; @@ -78,6 +80,11 @@ export const Root = ({ + {/* End global nav */} diff --git a/packages/backend/package.json b/packages/backend/package.json index 93a6a4836be..be01b6ec0fd 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -28,6 +28,7 @@ "@backstage/plugin-app-backend": "^0.3.76", "@backstage/plugin-auth-backend": "^0.23.1", "@backstage/plugin-auth-backend-module-guest-provider": "^0.2.1", + "@backstage/plugin-auth-backend-module-github-provider": "^0.2.1", "@backstage/plugin-catalog-backend": "^1.27.1", "@backstage/plugin-catalog-backend-module-logs": "^0.1.3", "@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "^0.2.1", @@ -38,6 +39,7 @@ "@backstage/plugin-search-backend-module-pg": "^0.5.37", "@backstage/plugin-search-backend-module-techdocs": "^0.3.1", "@backstage/plugin-techdocs-backend": "^1.11.1", + "@janus-idp/backstage-plugin-orchestrator-backend": "*", "@janus-idp/backstage-plugin-rbac-backend": "*", "@manypkg/get-packages": "1.1.3", "app": "*", diff --git a/packages/backend/src/index.ts b/packages/backend/src/index.ts index 354f346c5ae..4290cad865b 100644 --- a/packages/backend/src/index.ts +++ b/packages/backend/src/index.ts @@ -45,6 +45,7 @@ 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 +backend.add(import('@backstage/plugin-auth-backend-module-github-provider')); // catalog plugin backend.add(import('@backstage/plugin-catalog-backend/alpha')); @@ -66,4 +67,6 @@ backend.add(import('@backstage/plugin-search-backend-module-pg/alpha')); backend.add(import('@backstage/plugin-search-backend-module-catalog/alpha')); backend.add(import('@backstage/plugin-search-backend-module-techdocs/alpha')); +backend.add(import('@janus-idp/backstage-plugin-orchestrator-backend')); + backend.start(); diff --git a/plugins/orchestrator-backend/user.yaml b/plugins/orchestrator-backend/user.yaml new file mode 100644 index 00000000000..1356501ec9b --- /dev/null +++ b/plugins/orchestrator-backend/user.yaml @@ -0,0 +1,10 @@ +--- +apiVersion: backstage.io/v1alpha1 +kind: User +metadata: + name: mareklibra +spec: + profile: + displayName: Marek Libra + email: marek.libra@gmail.com + memberOf: []