gh org + devtools

This commit is contained in:
Med Mouine
2024-04-24 13:20:06 -04:00
parent 43c06ddfc9
commit ac15885e9d
9 changed files with 407 additions and 103 deletions

View File

@@ -28,6 +28,7 @@
"@backstage/plugin-catalog-graph": "^0.4.4",
"@backstage/plugin-catalog-import": "^0.10.10",
"@backstage/plugin-catalog-react": "^1.11.3",
"@backstage/plugin-devtools": "^0.1.13",
"@backstage/plugin-org": "^0.6.24",
"@backstage/plugin-permission-react": "^0.4.22",
"@backstage/plugin-scaffolder": "^1.19.3",
@@ -42,6 +43,7 @@
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@roadiehq/backstage-plugin-argo-cd": "^2.6.4",
"@veecode-platform/backstage-plugin-github-workflows": "^0.2.70",
"history": "^5.0.0",
"react": "^18.0.2",
"react-dom": "^18.0.2",

View File

@@ -38,6 +38,7 @@ import { CatalogGraphPage } from '@backstage/plugin-catalog-graph';
import { RequirePermission } from '@backstage/plugin-permission-react';
import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/alpha';
import { githubAuthApiRef } from '@backstage/core-plugin-api';
import { DevToolsPage } from '@backstage/plugin-devtools';
const app = createApp({
@@ -64,12 +65,14 @@ const app = createApp({
<SignInPage
{...props}
auto
providers={[{
providers={[
'guest',
{
id: 'github-auth-provider',
title: 'GitHub',
message: 'Sign in using GitHub',
apiRef: githubAuthApiRef,
}, 'guest']}
}]}
/>
),
@@ -78,6 +81,7 @@ const app = createApp({
const routes = (
<FlatRoutes>
<Route path="/devtools" element={<DevToolsPage />} />
<Route path="/" element={<Navigate to="catalog" />} />
<Route path="/catalog" element={<CatalogIndexPage />} />
<Route

View File

@@ -26,6 +26,7 @@ import {
} from '@backstage/core-components';
import MenuIcon from '@material-ui/icons/Menu';
import SearchIcon from '@material-ui/icons/Search';
import BuildIcon from '@material-ui/icons/Build';
const useSidebarLogoStyles = makeStyles({
root: {
@@ -83,6 +84,7 @@ export const Root = ({ children }: PropsWithChildren<{}>) => (
to="/settings"
>
<SidebarSettings />
<SidebarItem icon={BuildIcon} to="devtools" text="DevTools" />
</SidebarGroup>
</Sidebar>
{children}

View File

@@ -45,7 +45,6 @@ import {
EntityCatalogGraphCard,
} from '@backstage/plugin-catalog-graph';
import {
Entity,
RELATION_API_CONSUMED_BY,
RELATION_API_PROVIDED_BY,
RELATION_CONSUMES_API,
@@ -58,7 +57,40 @@ import {
import { TechDocsAddons } from '@backstage/plugin-techdocs-react';
import { ReportIssue } from '@backstage/plugin-techdocs-module-addons-contrib';
import { EntityArgoCDOverviewCard, isArgocdAvailable } from '@roadiehq/backstage-plugin-argo-cd';
import {
EntityArgoCDOverviewCard,
isArgocdAvailable,
} from '@roadiehq/backstage-plugin-argo-cd';
import {
GithubWorkflowsCard,
GithubWorkflowsList,
isGithubAvailable,
isGithubWorkflowsAvailable,
} from '@veecode-platform/backstage-plugin-github-workflows';
const WorkflowsContent = (
<EntitySwitch>
<EntitySwitch.Case if={isGithubActionsAvailable}>
<GithubWorkflowsList />
</EntitySwitch.Case>
<EntitySwitch.Case>
<EmptyState
title="No CI/CD available for this entity"
missing="info"
description="You need to add an annotation to your component if you want to enable CI/CD for it. You can read more about annotations in Backstage by clicking the button below."
action={
<Button
variant="contained"
color="primary"
href="https://backstage.io/docs/features/software-catalog/well-known-annotations"
>
Read more
</Button>
}
/>
</EntitySwitch.Case>
</EntitySwitch>
);
const techdocsContent = (
<EntityTechdocsContent>
@@ -73,7 +105,7 @@ const cicdContent = (
// You can for example enforce that all components of type 'service' should use GitHubActions
<EntitySwitch>
<EntitySwitch.Case if={isGithubActionsAvailable}>
<EntityGithubActionsContent view='cards' />
<EntityGithubActionsContent />
</EntitySwitch.Case>
<EntitySwitch.Case>
<EmptyState
@@ -132,6 +164,13 @@ const overviewContent = (
</Grid>
</EntitySwitch.Case>
</EntitySwitch>
<EntitySwitch>
<EntitySwitch.Case if={isGithubWorkflowsAvailable}>
<Grid item lg={8} xs={12}>
<GithubWorkflowsCard />
</Grid>
</EntitySwitch.Case>
</EntitySwitch>
<Grid item md={6}>
<EntityAboutCard variant="gridItem" />
</Grid>
@@ -157,6 +196,13 @@ const serviceEntityPage = (
<EntityLayout.Route path="/ci-cd" title="CI/CD">
{cicdContent}
</EntityLayout.Route>
<EntityLayout.Route
if={isGithubAvailable}
path="/workflows"
title="Workflows"
>
{WorkflowsContent}
</EntityLayout.Route>
<EntityLayout.Route path="/api" title="API">
<Grid container spacing={3} alignItems="stretch">
@@ -195,7 +241,13 @@ const websiteEntityPage = (
<EntityLayout.Route path="/ci-cd" title="CI/CD">
{cicdContent}
</EntityLayout.Route>
<EntityLayout.Route
if={isGithubAvailable}
path="/workflows"
title="Workflows"
>
{WorkflowsContent}
</EntityLayout.Route>
<EntityLayout.Route path="/dependencies" title="Dependencies">
<Grid container spacing={3} alignItems="stretch">
<Grid item md={6}>

View File

@@ -23,7 +23,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && \
apt-get install -y --no-install-recommends libsqlite3-dev
apt-get install -y --no-install-recommends libsqlite3-dev iputils-ping
# From here on we use the least-privileged `node` user to run the backend.
USER node
@@ -34,7 +34,7 @@ USER node
WORKDIR /app
# This switches many Node.js dependencies to production mode.
ENV NODE_ENV production
# ENV NODE_ENV production
# Copy repo skeleton first, to avoid unnecessary docker cache invalidation.
# The skeleton contains the package.json of each package in the monorepo,
@@ -49,4 +49,6 @@ RUN --mount=type=cache,target=/home/node/.cache/yarn,sharing=locked,uid=1000,gid
COPY --chown=node:node packages/backend/dist/bundle.tar.gz app-config*.yaml ./
RUN tar xzf bundle.tar.gz && rm bundle.tar.gz
CMD ["node", "packages/backend", "--config", "app-config.yaml", "--config", "app-config.production.yaml"]
COPY ./examples ./examples
CMD ["node", "packages/backend", "--config", "app-config.yaml"]

View File

@@ -18,8 +18,10 @@
"dependencies": {
"@backstage/backend-common": "^0.21.7",
"@backstage/backend-defaults": "^0.2.17",
"@backstage/backend-plugin-api": "^0.6.17",
"@backstage/backend-tasks": "^0.5.22",
"@backstage/config": "^1.2.0",
"@backstage/integration": "^1.10.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",
@@ -27,13 +29,18 @@
"@backstage/plugin-auth-node": "^0.4.12",
"@backstage/plugin-catalog-backend": "^1.21.1",
"@backstage/plugin-catalog-backend-module-github": "^0.6.0",
"@backstage/plugin-catalog-backend-module-github-org": "^0.1.12",
"@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "^0.1.15",
"@backstage/plugin-catalog-node": "^1.11.1",
"@backstage/plugin-devtools-backend": "^0.3.3",
"@backstage/plugin-events-backend-module-github": "^0.2.3",
"@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-scaffolder-backend-module-github": "^0.2.7",
"@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",

View File

@@ -7,6 +7,8 @@
*/
import { createBackend } from '@backstage/backend-defaults';
import { eventsModuleGithubEventRouter } from '@backstage/plugin-events-backend-module-github/alpha';
import { eventsModuleGithubWebhook } from '@backstage/plugin-events-backend-module-github/alpha';
const backend = createBackend();
@@ -28,6 +30,11 @@ backend.add(
import('@backstage/plugin-catalog-backend-module-scaffolder-entity-model'),
);
backend.add(import('@backstage/plugin-scaffolder-backend-module-github'));
backend.add(import('@backstage/plugin-catalog-backend-module-github/alpha'));
backend.add(import('@backstage/plugin-catalog-backend-module-github-org'));
backend.add(eventsModuleGithubEventRouter());
backend.add(eventsModuleGithubWebhook());
// permission plugin
backend.add(import('@backstage/plugin-permission-backend/alpha'));
@@ -37,7 +44,9 @@ backend.add(
// 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'));
// backend.add(import('@backstage/plugin-search-backend-module-catalog/alpha'));
// backend.add(import('@backstage/plugin-search-backend-module-techdocs/alpha'));
backend.add(import('@backstage/plugin-devtools-backend'));
backend.start();