File tree Expand file tree Collapse file tree 4 files changed +54
-32
lines changed Expand file tree Collapse file tree 4 files changed +54
-32
lines changed Original file line number Diff line number Diff line change @@ -35,40 +35,16 @@ yarn add --cwd packages/backend @parfuemerie-douglas/scaffolder-backend-module-a
35
35
```
36
36
37
37
Configure the actions (you can check the
38
- [ docs] ( https://backstage.io/docs/features/software-templates/writing-custom-actions#registering-custom-actions )
38
+ [ docs] ( https://backstage.io/docs/features/software-templates/writing-custom-actions#register-action-with-new-backend-system )
39
39
to see all options):
40
40
41
41
``` typescript
42
- // packages/backend/src/plugins/scaffolder.ts
43
-
44
- import {
45
- createAzurePipelineAction ,
46
- permitAzurePipelineAction ,
47
- runAzurePipelineAction ,
48
- } from " @parfuemerie-douglas/scaffolder-backend-module-azure-pipelines" ;
49
-
50
- const actions = [
51
- createAzurePipelineAction ({ integrations }),
52
- permitAzurePipelineAction ({ integrations }),
53
- runAzurePipelineAction ({ integrations }),
54
- ... createBuiltInActions ({
55
- containerRunner ,
56
- catalogClient ,
57
- integrations ,
58
- config: env .config ,
59
- reader: env .reader ,
60
- }),
61
- ];
62
-
63
- return await createRouter ({
64
- containerRunner ,
65
- catalogClient ,
66
- actions ,
67
- logger: env .logger ,
68
- config: env .config ,
69
- database: env .database ,
70
- reader: env .reader ,
71
- });
42
+ // packages/backend/src/index.ts
43
+ const backend = createBackend ();
44
+
45
+ // ...
46
+
47
+ backend .add (import (' @parfuemerie-douglas/scaffolder-backend-module-azure-pipelines' ))
72
48
```
73
49
74
50
The Azure pipeline actions use an [ Azure PAT (personal access
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @parfuemerie-douglas/scaffolder-backend-module-azure-pipelines" ,
3
- "version" : " 1.2 .0" ,
3
+ "version" : " 1.3 .0" ,
4
4
"description" : " A collection of Backstage scaffolder backend modules for Azure pipelines." ,
5
5
"main" : " dist/index.cjs.js" ,
6
6
"types" : " dist/index.d.ts" ,
42
42
"homepage" : " https://github.com/Parfuemerie-Douglas/scaffolder-backend-module-azure-pipelines#readme" ,
43
43
"dependencies" : {
44
44
"@backstage/backend-common" : " ^0.23.3" ,
45
+ "@backstage/backend-plugin-api" : " ^0.7.0" ,
45
46
"@backstage/errors" : " ^1.2.4" ,
46
47
"@backstage/integration" : " ^1.13.0" ,
47
48
"@backstage/plugin-scaffolder-backend" : " ^1.23.0" ,
Original file line number Diff line number Diff line change 14
14
* limitations under the License.
15
15
*/
16
16
17
+ export { scaffolderModuleAzurePipelines as default } from './module' ;
17
18
export * from "./actions" ;
Original file line number Diff line number Diff line change
1
+ import { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha' ;
2
+ import {
3
+ createBackendModule ,
4
+ coreServices
5
+ } from '@backstage/backend-plugin-api' ;
6
+ import { ScmIntegrations } from '@backstage/integration' ;
7
+
8
+ import {
9
+ createAzurePipelineAction ,
10
+ permitAzurePipelineAction ,
11
+ runAzurePipelineAction
12
+ } from './actions' ;
13
+
14
+ export const scaffolderModuleAzurePipelines = createBackendModule ( {
15
+ pluginId : 'scaffolder' ,
16
+ moduleId : 'azure-pipelines' ,
17
+ register ( env ) {
18
+ env . registerInit ( {
19
+ deps : {
20
+ scaffolder : scaffolderActionsExtensionPoint ,
21
+ logger : coreServices . logger ,
22
+ config : coreServices . rootConfig ,
23
+ discovery : coreServices . discovery ,
24
+ reader : coreServices . urlReader ,
25
+ } ,
26
+ async init ( { scaffolder, config} ) {
27
+
28
+ const integrations = ScmIntegrations . fromConfig ( config ) ;
29
+
30
+ scaffolder . addActions (
31
+ createAzurePipelineAction ( {
32
+ integrations,
33
+ } ) ,
34
+ permitAzurePipelineAction ( {
35
+ integrations,
36
+ } ) ,
37
+ runAzurePipelineAction ( {
38
+ integrations,
39
+ } )
40
+ ) ;
41
+ } ,
42
+ } ) ;
43
+ } ,
44
+ } ) ;
You can’t perform that action at this time.
0 commit comments