@@ -255,12 +255,6 @@ catalog:
|
||||
# Backstage example entities
|
||||
- type: file
|
||||
target: ../catalog-model/examples/all.yaml
|
||||
|
||||
- type: file
|
||||
target: ./test-template.yaml
|
||||
rules:
|
||||
- allow: [Template]
|
||||
|
||||
# Backstage example groups and users
|
||||
- type: file
|
||||
target: ../catalog-model/examples/acme-corp.yaml
|
||||
|
||||
@@ -15,12 +15,7 @@
|
||||
*/
|
||||
|
||||
import { CatalogClient } from '@backstage/catalog-client';
|
||||
import { ScmIntegrations } from '@backstage/integration';
|
||||
import {
|
||||
createRouter,
|
||||
createTemplateAction,
|
||||
createBuiltinActions,
|
||||
} from '@backstage/plugin-scaffolder-backend';
|
||||
import { createRouter } from '@backstage/plugin-scaffolder-backend';
|
||||
import { Router } from 'express';
|
||||
import type { PluginEnvironment } from '../types';
|
||||
|
||||
@@ -31,26 +26,6 @@ export default async function createPlugin(
|
||||
discoveryApi: env.discovery,
|
||||
});
|
||||
|
||||
const defaultActions = createBuiltinActions({
|
||||
catalogClient,
|
||||
reader: env.reader,
|
||||
config: env.config,
|
||||
integrations: ScmIntegrations.fromConfig(env.config),
|
||||
});
|
||||
|
||||
const delayAction = createTemplateAction({
|
||||
id: 'mock:delay',
|
||||
async handler(ctx) {
|
||||
const interval = setInterval(
|
||||
() => ctx.logger.info('Writing something', new Date().toISOString()),
|
||||
1000,
|
||||
);
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 5000));
|
||||
clearTimeout(interval);
|
||||
},
|
||||
});
|
||||
|
||||
return await createRouter({
|
||||
logger: env.logger,
|
||||
config: env.config,
|
||||
@@ -59,6 +34,5 @@ export default async function createPlugin(
|
||||
reader: env.reader,
|
||||
identity: env.identity,
|
||||
scheduler: env.scheduler,
|
||||
actions: [...defaultActions, delayAction],
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
apiVersion: scaffolder.backstage.io/v1beta3
|
||||
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-template
|
||||
kind: Template
|
||||
metadata:
|
||||
name: example-delay-tempalte
|
||||
title: Delay template
|
||||
description: An example template for the scaffolder that creates a simple Node.js service
|
||||
spec:
|
||||
type: service
|
||||
|
||||
parameters: []
|
||||
|
||||
steps:
|
||||
- id: delay1
|
||||
name: Delay 1
|
||||
action: mock:delay
|
||||
|
||||
- id: delay2
|
||||
name: Delay 2
|
||||
action: mock:delay
|
||||
|
||||
- id: delay3
|
||||
name: Delay 3
|
||||
action: mock:delay
|
||||
|
||||
- id: delay4
|
||||
name: Delay 4
|
||||
action: mock:delay
|
||||
|
||||
- id: delay5
|
||||
if: true
|
||||
name: Delay 5
|
||||
action: mock:delay
|
||||
|
||||
- id: delay6
|
||||
name: Delay 6
|
||||
action: mock:delay
|
||||
@@ -1,5 +1 @@
|
||||
# Backstage override configuration for your local development environment
|
||||
catalog:
|
||||
locations:
|
||||
- type: file
|
||||
target: ./test-template.yaml
|
||||
|
||||
Reference in New Issue
Block a user