Skip to content

Commit 61c52ab

Browse files
Added todo plugin with app v0.2.0
1 parent 6f64999 commit 61c52ab

File tree

9 files changed

+46
-8
lines changed

9 files changed

+46
-8
lines changed

backstage-app/backstage101/app-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ integrations:
4242
- host: github.com
4343
# This is a Personal Access Token or PAT from GitHub. You can find out how to generate this token, and more information
4444
# about setting up the GitHub integration here: https://backstage.io/docs/getting-started/configuration#setting-up-a-github-integration
45-
token: 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
45+
token: ${GITHUB_TOKEN}
4646
### Example for how to add your GitHub Enterprise instance using the API:
4747
# - host: ghe.example.net
4848
# apiBaseUrl: https://ghe.example.net/api/v3

backstage-app/backstage101/packages/app/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"@backstage/plugin-techdocs": "^1.6.4",
4242
"@backstage/plugin-techdocs-module-addons-contrib": "^1.0.14",
4343
"@backstage/plugin-techdocs-react": "^1.1.7",
44+
"@backstage/plugin-todo": "^0.2.22",
4445
"@backstage/plugin-user-settings": "^0.7.4",
4546
"@backstage/theme": "^0.4.0",
4647
"@material-ui/core": "^4.12.2",
@@ -54,10 +55,10 @@
5455
},
5556
"devDependencies": {
5657
"@backstage/test-utils": "^1.4.0",
58+
"@testing-library/dom": "^8.0.0",
5759
"@testing-library/jest-dom": "^5.10.1",
5860
"@testing-library/react": "^12.1.3",
5961
"@testing-library/user-event": "^14.0.0",
60-
"@testing-library/dom": "^8.0.0",
6162
"@types/node": "^16.11.26",
6263
"@types/react-dom": "*",
6364
"cross-env": "^7.0.0",

backstage-app/backstage101/packages/app/src/components/catalog/EntityPage.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import {
5555

5656
import { TechDocsAddons } from '@backstage/plugin-techdocs-react';
5757
import { ReportIssue } from '@backstage/plugin-techdocs-module-addons-contrib';
58+
import { EntityTodoContent } from '@backstage/plugin-todo';
5859

5960
const techdocsContent = (
6061
<EntityTechdocsContent>
@@ -165,6 +166,10 @@ const serviceEntityPage = (
165166
<EntityLayout.Route path="/docs" title="Docs">
166167
{techdocsContent}
167168
</EntityLayout.Route>
169+
170+
<EntityLayout.Route path="/todo" title="Todo">
171+
<EntityTodoContent />
172+
</EntityLayout.Route>
168173
</EntityLayout>
169174
);
170175

backstage-app/backstage101/packages/backend/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"@backstage/plugin-search-backend-module-pg": "^0.5.7",
3434
"@backstage/plugin-search-backend-node": "^1.2.2",
3535
"@backstage/plugin-techdocs-backend": "^1.6.3",
36+
"@backstage/plugin-todo-backend": "^0.1.44",
3637
"app": "link:../app",
3738
"better-sqlite3": "^8.0.0",
3839
"dockerode": "^3.3.1",

backstage-app/backstage101/packages/backend/src/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import search from './plugins/search';
3131
import { PluginEnvironment } from './types';
3232
import { ServerPermissionClient } from '@backstage/plugin-permission-node';
3333
import { DefaultIdentityClient } from '@backstage/plugin-auth-node';
34+
import todo from './plugins/todo';
3435

3536
function makeCreateEnv(config: Config) {
3637
const root = getRootLogger();
@@ -85,6 +86,7 @@ async function main() {
8586
const techdocsEnv = useHotMemoize(module, () => createEnv('techdocs'));
8687
const searchEnv = useHotMemoize(module, () => createEnv('search'));
8788
const appEnv = useHotMemoize(module, () => createEnv('app'));
89+
const todoEnv = useHotMemoize(module, () => createEnv('todo'));
8890

8991
const apiRouter = Router();
9092
apiRouter.use('/catalog', await catalog(catalogEnv));
@@ -93,6 +95,7 @@ async function main() {
9395
apiRouter.use('/techdocs', await techdocs(techdocsEnv));
9496
apiRouter.use('/proxy', await proxy(proxyEnv));
9597
apiRouter.use('/search', await search(searchEnv));
98+
apiRouter.use('/todo', await todo(todoEnv));
9699

97100
// Add backends ABOVE this line; this 404 handler is the catch-all fallback
98101
apiRouter.use(notFoundHandler());
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { Router } from 'express';
2+
import { CatalogClient } from '@backstage/catalog-client';
3+
import {
4+
createRouter,
5+
TodoReaderService,
6+
TodoScmReader,
7+
} from '@backstage/plugin-todo-backend';
8+
import { PluginEnvironment } from '../types';
9+
10+
export default async function createPlugin(
11+
env: PluginEnvironment,
12+
): Promise<Router> {
13+
const todoReader = TodoScmReader.fromConfig(env.config, {
14+
logger: env.logger,
15+
reader: env.reader,
16+
});
17+
18+
const catalogClient = new CatalogClient({
19+
discoveryApi: env.discovery,
20+
});
21+
22+
const todoService = new TodoReaderService({
23+
todoReader,
24+
catalogClient,
25+
});
26+
27+
return await createRouter({ todoService });
28+
}

deployment/kubernetes/backstage/create-backstage.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ yarn build backend --config ../../app-config.yaml
2424
# Build docker image with the latest build backend artefacts
2525
cd $CODESPACE_VSCODE_FOLDER
2626
# docker image build . -f packages/backend/Dockerfile --tag backstage:0.1.0 from backstage101 folder
27-
docker image build backstage-app/backstage101/ -f deployment/kubernetes/backstage/docker/Dockerfile --tag localhost:5001/backstage:0.1.0
27+
docker image build backstage-app/backstage101/ -f deployment/kubernetes/backstage/docker/Dockerfile --tag localhost:5001/backstage:0.2.0
2828

2929
# Push the latest docker image to local image registry
30-
docker push localhost:5001/backstage:0.1.0
30+
docker push localhost:5001/backstage:0.2.0
3131

3232
# Package backstage helm chart and install the same in backstage namespace
3333
helm package deployment/kubernetes/backstage/helm/
34-
helm -n backstage upgrade --install backstage backstage-0.1.0.tgz
34+
helm -n backstage upgrade --install backstage backstage-0.2.0.tgz
3535

3636
# Setup a port-forward from backstage:80 to localhost:8000
3737
kubectl -n backstage port-forward svc/backstage 8000:80

deployment/kubernetes/backstage/helm/Chart.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.1.0
18+
version: 0.2.0
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to
2222
# follow Semantic Versioning. They should reflect the version the application is using.
2323
# It is recommended to use it with quotes.
24-
appVersion: "0.1.0"
24+
appVersion: "0.2.0"

deployment/kubernetes/backstage/helm/templates/deployment.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ spec:
1616
spec:
1717
containers:
1818
- name: backstage
19-
image: localhost:5001/backstage:0.1.0
19+
image: localhost:5001/backstage:0.2.0
2020
imagePullPolicy: IfNotPresent
2121
ports:
2222
- name: http

0 commit comments

Comments
 (0)