Merge pull request #7877 from timja/patch-1

Add yarn command for installing jenkins-backend plugin
This commit is contained in:
Himanshu Mishra
2021-11-04 13:10:44 +05:30
committed by GitHub
2 changed files with 30 additions and 1 deletions
+29
View File
@@ -12,6 +12,12 @@ This is the backend half of the 2 Jenkins plugins and is responsible for:
This plugin needs to be added to an existing backstage instance.
```bash
# From your Backstage root directory
cd packages/backend
yarn add @backstage/plugin-jenkins-backend
```
Typically, this means creating a `src/plugins/jenkins.ts` file and adding a reference to it to `src/index.ts`
### jenkins.ts
@@ -42,6 +48,29 @@ export default async function createPlugin({
}
```
### src/index.ts
```diff
diff --git a/packages/backend/src/index.ts b/packages/backend/src/index.ts
index f2b14b2..2c64f47 100644
--- a/packages/backend/src/index.ts
+++ b/packages/backend/src/index.ts
@@ -22,6 +22,7 @@ import { Config } from '@backstage/config';
import app from './plugins/app';
+import jenkins from './plugins/jenkins';
import scaffolder from './plugins/scaffolder';
@@ -56,6 +57,7 @@ async function main() {
const authEnv = useHotMemoize(module, () => createEnv('auth'));
+ const jenkinsEnv = useHotMemoize(module, () => createEnv('jenkins'));
const proxyEnv = useHotMemoize(module, () => createEnv('proxy'));
@@ -63,6 +65,7 @@ async function main() {
const apiRouter = Router();
apiRouter.use('/catalog', await catalog(catalogEnv));
+ apiRouter.use('/jenkins', await jenkins(jenkinsEnv));
apiRouter.use('/scaffolder', await scaffolder(scaffolderEnv));
```
This plugin must be provided with a JenkinsInfoProvider, this is a strategy object for finding the Jenkins instance and job for an entity.
There is a standard one provided, but the Integrator is free to build their own.
+1 -1
View File
@@ -16,7 +16,7 @@ cd packages/app
yarn add @backstage/plugin-jenkins
```
2. Add and configure the backend plugin according to it's instructions
2. Add and configure the [jenkins-backend](../jenkins-backend) plugin according to it's instructions
3. Add the `EntityJenkinsContent` extension to the `CI/CD` page and `EntityLatestJenkinsRunCard` to the `overview` page in the app (or wherever you'd prefer):