@backstage/plugin-scaffolder-backend 1.22.6-next.2 → 1.22.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/README.md +16 -14
- package/alpha/package.json +1 -1
- package/dist/alpha.cjs.js +2 -1
- package/dist/alpha.cjs.js.map +1 -1
- package/dist/cjs/{router-DhoUgDz0.cjs.js → router-CM3G1J74.cjs.js} +27 -30
- package/dist/cjs/router-CM3G1J74.cjs.js.map +1 -0
- package/dist/index.cjs.js +3 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/package.json +25 -24
- package/dist/cjs/router-DhoUgDz0.cjs.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-backend
|
|
2
2
|
|
|
3
|
+
## 1.22.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- da155d1: Fixing issue with log meta fields possibly being circular refs
|
|
8
|
+
|
|
9
|
+
## 1.22.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 131e5cb: Fix broken links in README.
|
|
14
|
+
- 025641b: Fix issue with the log format not being respected when logging from actions
|
|
15
|
+
- d229dc4: Move path utilities from `backend-common` to the `backend-plugin-api` package.
|
|
16
|
+
- e4b50ab: Scaffolder workspace serialization
|
|
17
|
+
- 025641b: Redact `meta` fields too with the logger
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
- @backstage/plugin-scaffolder-common@1.5.2
|
|
20
|
+
- @backstage/plugin-catalog-node@1.12.0
|
|
21
|
+
- @backstage/plugin-scaffolder-backend-module-github@0.2.8
|
|
22
|
+
- @backstage/plugin-scaffolder-backend-module-gitea@0.1.8
|
|
23
|
+
- @backstage/plugin-scaffolder-backend-module-gitlab@0.4.0
|
|
24
|
+
- @backstage/catalog-model@1.5.0
|
|
25
|
+
- @backstage/backend-common@0.22.0
|
|
26
|
+
- @backstage/backend-plugin-api@0.6.18
|
|
27
|
+
- @backstage/plugin-scaffolder-node@0.4.4
|
|
28
|
+
- @backstage/backend-tasks@0.5.23
|
|
29
|
+
- @backstage/plugin-scaffolder-backend-module-bitbucket-server@0.1.8
|
|
30
|
+
- @backstage/plugin-auth-node@0.4.13
|
|
31
|
+
- @backstage/integration@1.11.0
|
|
32
|
+
- @backstage/catalog-client@1.6.5
|
|
33
|
+
- @backstage/plugin-catalog-backend-module-scaffolder-entity-model@0.1.16
|
|
34
|
+
- @backstage/plugin-permission-node@0.7.29
|
|
35
|
+
- @backstage/plugin-scaffolder-backend-module-azure@0.1.10
|
|
36
|
+
- @backstage/plugin-scaffolder-backend-module-bitbucket@0.2.8
|
|
37
|
+
- @backstage/plugin-scaffolder-backend-module-bitbucket-cloud@0.1.8
|
|
38
|
+
- @backstage/plugin-scaffolder-backend-module-gerrit@0.1.10
|
|
39
|
+
|
|
3
40
|
## 1.22.6-next.2
|
|
4
41
|
|
|
5
42
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
# Scaffolder Backend
|
|
2
2
|
|
|
3
|
-
This is the backend for the default Backstage [software
|
|
4
|
-
|
|
5
|
-
This provides the API for the frontend [scaffolder
|
|
6
|
-
plugin](https://github.com/backstage/backstage/tree/master/plugins/scaffolder),
|
|
3
|
+
This is the backend for the default Backstage [software templates](https://backstage.io/docs/features/software-templates/).
|
|
4
|
+
This provides the API for the frontend [scaffolder plugin](https://github.com/backstage/backstage/tree/master/plugins/scaffolder),
|
|
7
5
|
as well as the built-in template actions, tasks and stages.
|
|
8
6
|
|
|
9
7
|
## Installation
|
|
@@ -24,12 +22,19 @@ restoring the plugin, if you previously removed it.
|
|
|
24
22
|
yarn --cwd packages/backend add @backstage/plugin-scaffolder-backend
|
|
25
23
|
```
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
Then add the plugin to your backend, typically in `packages/backend/src/index.ts`:
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
```ts
|
|
28
|
+
const backend = createBackend();
|
|
29
|
+
// ...
|
|
30
|
+
backend.add(import('@backstage/plugin-scaffolder-backend/alpha'));
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
#### Old backend system
|
|
34
|
+
|
|
35
|
+
In the old backend system there's a bit more wiring required. You'll need to
|
|
36
|
+
create a file called `packages/backend/src/plugins/scaffolder.ts`
|
|
37
|
+
with contents matching [scaffolder.ts in the create-app template](https://github.com/backstage/backstage/blob/ad9314d3a7e0405719ba93badf96e97adde8ef83/packages/create-app/templates/default-app/packages/backend/src/plugins/scaffolder.ts).
|
|
33
38
|
|
|
34
39
|
With the `scaffolder.ts` router setup in place, add the router to
|
|
35
40
|
`packages/backend/src/index.ts`:
|
|
@@ -54,10 +59,7 @@ async function main() {
|
|
|
54
59
|
### Adding templates
|
|
55
60
|
|
|
56
61
|
At this point the scaffolder backend is installed in your backend package, but
|
|
57
|
-
you will not have any templates available to use. These need to be [added to the
|
|
58
|
-
software
|
|
59
|
-
catalog](https://backstage.io/docs/features/software-templates/adding-templates).
|
|
62
|
+
you will not have any templates available to use. These need to be [added to the software catalog](https://backstage.io/docs/features/software-templates/adding-templates).
|
|
60
63
|
|
|
61
64
|
To get up and running and try out some templates quickly, you can or copy the
|
|
62
|
-
catalog locations from the [create-app
|
|
63
|
-
template](https://github.com/backstage/backstage/blob/master/packages/create-app/templates/default-app/app-config.yaml.hbs).
|
|
65
|
+
catalog locations from the [create-app template](https://github.com/backstage/backstage/blob/master/packages/create-app/templates/default-app/app-config.yaml.hbs).
|
package/alpha/package.json
CHANGED
package/dist/alpha.cjs.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var alpha = require('@backstage/plugin-scaffolder-common/alpha');
|
|
6
6
|
var pluginPermissionNode = require('@backstage/plugin-permission-node');
|
|
7
|
-
var router = require('./cjs/router-
|
|
7
|
+
var router = require('./cjs/router-CM3G1J74.cjs.js');
|
|
8
8
|
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
9
9
|
var backendCommon = require('@backstage/backend-common');
|
|
10
10
|
var integration = require('@backstage/integration');
|
|
@@ -48,6 +48,7 @@ require('nunjucks');
|
|
|
48
48
|
require('prom-client');
|
|
49
49
|
require('@backstage/plugin-permission-common');
|
|
50
50
|
require('winston-transport');
|
|
51
|
+
require('triple-beam');
|
|
51
52
|
require('url');
|
|
52
53
|
require('os');
|
|
53
54
|
|
package/dist/alpha.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.cjs.js","sources":["../src/service/conditionExports.ts","../src/ScaffolderPlugin.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n RESOURCE_TYPE_SCAFFOLDER_TEMPLATE,\n RESOURCE_TYPE_SCAFFOLDER_ACTION,\n} from '@backstage/plugin-scaffolder-common/alpha';\nimport { createConditionExports } from '@backstage/plugin-permission-node';\nimport { scaffolderTemplateRules, scaffolderActionRules } from './rules';\n\nconst templateConditionExports = createConditionExports({\n pluginId: 'scaffolder',\n resourceType: RESOURCE_TYPE_SCAFFOLDER_TEMPLATE,\n rules: scaffolderTemplateRules,\n});\n\nconst actionsConditionExports = createConditionExports({\n pluginId: 'scaffolder',\n resourceType: RESOURCE_TYPE_SCAFFOLDER_ACTION,\n rules: scaffolderActionRules,\n});\n\n/**\n * `createScaffolderTemplateConditionalDecision` can be used when authoring policies to\n * create conditional decisions. It requires a permission of type\n * `ResourcePermission<'scaffolder-template'>` to be passed as the first parameter.\n * It's recommended that you use the provided `isResourcePermission` and\n * `isPermission` helper methods to narrow the type of the permission passed to\n * the handle method as shown below.\n *\n * ```\n * // MyAuthorizationPolicy.ts\n * ...\n * import { createScaffolderPolicyDecision } from '@backstage/plugin-scaffolder-backend';\n * import { RESOURCE_TYPE_SCAFFOLDER_TEMPLATE } from '@backstage/plugin-scaffolder-common';\n *\n * class MyAuthorizationPolicy implements PermissionPolicy {\n * async handle(request, user) {\n * ...\n *\n * if (isResourcePermission(request.permission, RESOURCE_TYPE_SCAFFOLDER_TEMPLATE)) {\n * return createScaffolderConditionalDecision(\n * request.permission,\n * { anyOf: [...insert conditions here...] }\n * );\n * }\n *\n * ...\n * }\n *\n * ```\n *\n * @alpha\n */\nexport const createScaffolderTemplateConditionalDecision =\n templateConditionExports.createConditionalDecision;\n\n/**\n * These conditions are used when creating conditional decisions for scaffolder\n * templates that are returned by authorization policies.\n *\n * @alpha\n */\nexport const scaffolderTemplateConditions = templateConditionExports.conditions;\n\n/**\n * @alpha\n */\nexport const createScaffolderActionConditionalDecision =\n actionsConditionExports.createConditionalDecision;\n\n/**\n *\n * These conditions are used when creating conditional decisions for scaffolder\n * actions that are returned by authorization policies.\n *\n * @alpha\n */\nexport const scaffolderActionConditions = actionsConditionExports.conditions;\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createBackendPlugin,\n coreServices,\n} from '@backstage/backend-plugin-api';\nimport { loggerToWinstonLogger } from '@backstage/backend-common';\nimport { ScmIntegrations } from '@backstage/integration';\nimport { catalogServiceRef } from '@backstage/plugin-catalog-node/alpha';\nimport {\n TaskBroker,\n TemplateAction,\n TemplateFilter,\n TemplateGlobal,\n} from '@backstage/plugin-scaffolder-node';\nimport {\n scaffolderActionsExtensionPoint,\n scaffolderTaskBrokerExtensionPoint,\n scaffolderTemplatingExtensionPoint,\n} from '@backstage/plugin-scaffolder-node/alpha';\nimport {\n createCatalogRegisterAction,\n createCatalogWriteAction,\n createDebugLogAction,\n createFetchCatalogEntityAction,\n createFetchPlainAction,\n createFetchPlainFileAction,\n createFetchTemplateAction,\n createFilesystemDeleteAction,\n createFilesystemRenameAction,\n createWaitAction,\n} from './scaffolder';\nimport { createRouter } from './service/router';\n\n/**\n * Scaffolder plugin\n *\n * @alpha\n */\nexport const scaffolderPlugin = createBackendPlugin({\n pluginId: 'scaffolder',\n register(env) {\n const addedActions = new Array<TemplateAction<any, any>>();\n env.registerExtensionPoint(scaffolderActionsExtensionPoint, {\n addActions(...newActions: TemplateAction<any>[]) {\n addedActions.push(...newActions);\n },\n });\n\n let taskBroker: TaskBroker | undefined;\n env.registerExtensionPoint(scaffolderTaskBrokerExtensionPoint, {\n setTaskBroker(newTaskBroker) {\n if (taskBroker) {\n throw new Error('Task broker may only be set once');\n }\n taskBroker = newTaskBroker;\n },\n });\n\n const additionalTemplateFilters: Record<string, TemplateFilter> = {};\n const additionalTemplateGlobals: Record<string, TemplateGlobal> = {};\n env.registerExtensionPoint(scaffolderTemplatingExtensionPoint, {\n addTemplateFilters(newFilters) {\n Object.assign(additionalTemplateFilters, newFilters);\n },\n addTemplateGlobals(newGlobals) {\n Object.assign(additionalTemplateGlobals, newGlobals);\n },\n });\n\n env.registerInit({\n deps: {\n logger: coreServices.logger,\n config: coreServices.rootConfig,\n lifecycle: coreServices.rootLifecycle,\n reader: coreServices.urlReader,\n permissions: coreServices.permissions,\n database: coreServices.database,\n auth: coreServices.auth,\n discovery: coreServices.discovery,\n httpRouter: coreServices.httpRouter,\n httpAuth: coreServices.httpAuth,\n catalogClient: catalogServiceRef,\n },\n async init({\n logger,\n config,\n lifecycle,\n reader,\n database,\n auth,\n discovery,\n httpRouter,\n httpAuth,\n catalogClient,\n permissions,\n }) {\n const log = loggerToWinstonLogger(logger);\n const integrations = ScmIntegrations.fromConfig(config);\n\n const actions = [\n // actions provided from other modules\n ...addedActions,\n\n // built-in actions for the scaffolder\n createFetchPlainAction({\n reader,\n integrations,\n }),\n createFetchPlainFileAction({\n reader,\n integrations,\n }),\n createFetchTemplateAction({\n integrations,\n reader,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n }),\n createDebugLogAction(),\n createWaitAction(),\n // todo(blam): maybe these should be a -catalog module?\n createCatalogRegisterAction({ catalogClient, integrations, auth }),\n createFetchCatalogEntityAction({ catalogClient, auth }),\n createCatalogWriteAction(),\n createFilesystemDeleteAction(),\n createFilesystemRenameAction(),\n ];\n\n const actionIds = actions.map(action => action.id).join(', ');\n\n log.info(\n `Starting scaffolder with the following actions enabled ${actionIds}`,\n );\n\n const router = await createRouter({\n logger: log,\n config,\n database,\n catalogClient,\n reader,\n lifecycle,\n actions,\n taskBroker,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n auth,\n httpAuth,\n discovery,\n permissions,\n });\n httpRouter.use(router);\n },\n });\n },\n});\n"],"names":["createConditionExports","RESOURCE_TYPE_SCAFFOLDER_TEMPLATE","scaffolderTemplateRules","RESOURCE_TYPE_SCAFFOLDER_ACTION","scaffolderActionRules","createBackendPlugin","scaffolderActionsExtensionPoint","scaffolderTaskBrokerExtensionPoint","scaffolderTemplatingExtensionPoint","coreServices","catalogServiceRef","loggerToWinstonLogger","ScmIntegrations","createFetchPlainAction","createFetchPlainFileAction","createFetchTemplateAction","createDebugLogAction","createWaitAction","createCatalogRegisterAction","createFetchCatalogEntityAction","createCatalogWriteAction","createFilesystemDeleteAction","createFilesystemRenameAction","router","createRouter"],"mappings":";;;;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"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n RESOURCE_TYPE_SCAFFOLDER_TEMPLATE,\n RESOURCE_TYPE_SCAFFOLDER_ACTION,\n} from '@backstage/plugin-scaffolder-common/alpha';\nimport { createConditionExports } from '@backstage/plugin-permission-node';\nimport { scaffolderTemplateRules, scaffolderActionRules } from './rules';\n\nconst templateConditionExports = createConditionExports({\n pluginId: 'scaffolder',\n resourceType: RESOURCE_TYPE_SCAFFOLDER_TEMPLATE,\n rules: scaffolderTemplateRules,\n});\n\nconst actionsConditionExports = createConditionExports({\n pluginId: 'scaffolder',\n resourceType: RESOURCE_TYPE_SCAFFOLDER_ACTION,\n rules: scaffolderActionRules,\n});\n\n/**\n * `createScaffolderTemplateConditionalDecision` can be used when authoring policies to\n * create conditional decisions. It requires a permission of type\n * `ResourcePermission<'scaffolder-template'>` to be passed as the first parameter.\n * It's recommended that you use the provided `isResourcePermission` and\n * `isPermission` helper methods to narrow the type of the permission passed to\n * the handle method as shown below.\n *\n * ```\n * // MyAuthorizationPolicy.ts\n * ...\n * import { createScaffolderPolicyDecision } from '@backstage/plugin-scaffolder-backend';\n * import { RESOURCE_TYPE_SCAFFOLDER_TEMPLATE } from '@backstage/plugin-scaffolder-common';\n *\n * class MyAuthorizationPolicy implements PermissionPolicy {\n * async handle(request, user) {\n * ...\n *\n * if (isResourcePermission(request.permission, RESOURCE_TYPE_SCAFFOLDER_TEMPLATE)) {\n * return createScaffolderConditionalDecision(\n * request.permission,\n * { anyOf: [...insert conditions here...] }\n * );\n * }\n *\n * ...\n * }\n *\n * ```\n *\n * @alpha\n */\nexport const createScaffolderTemplateConditionalDecision =\n templateConditionExports.createConditionalDecision;\n\n/**\n * These conditions are used when creating conditional decisions for scaffolder\n * templates that are returned by authorization policies.\n *\n * @alpha\n */\nexport const scaffolderTemplateConditions = templateConditionExports.conditions;\n\n/**\n * @alpha\n */\nexport const createScaffolderActionConditionalDecision =\n actionsConditionExports.createConditionalDecision;\n\n/**\n *\n * These conditions are used when creating conditional decisions for scaffolder\n * actions that are returned by authorization policies.\n *\n * @alpha\n */\nexport const scaffolderActionConditions = actionsConditionExports.conditions;\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createBackendPlugin,\n coreServices,\n} from '@backstage/backend-plugin-api';\nimport { loggerToWinstonLogger } from '@backstage/backend-common';\nimport { ScmIntegrations } from '@backstage/integration';\nimport { catalogServiceRef } from '@backstage/plugin-catalog-node/alpha';\nimport {\n TaskBroker,\n TemplateAction,\n TemplateFilter,\n TemplateGlobal,\n} from '@backstage/plugin-scaffolder-node';\nimport {\n scaffolderActionsExtensionPoint,\n scaffolderTaskBrokerExtensionPoint,\n scaffolderTemplatingExtensionPoint,\n} from '@backstage/plugin-scaffolder-node/alpha';\nimport {\n createCatalogRegisterAction,\n createCatalogWriteAction,\n createDebugLogAction,\n createFetchCatalogEntityAction,\n createFetchPlainAction,\n createFetchPlainFileAction,\n createFetchTemplateAction,\n createFilesystemDeleteAction,\n createFilesystemRenameAction,\n createWaitAction,\n} from './scaffolder';\nimport { createRouter } from './service/router';\n\n/**\n * Scaffolder plugin\n *\n * @alpha\n */\nexport const scaffolderPlugin = createBackendPlugin({\n pluginId: 'scaffolder',\n register(env) {\n const addedActions = new Array<TemplateAction<any, any>>();\n env.registerExtensionPoint(scaffolderActionsExtensionPoint, {\n addActions(...newActions: TemplateAction<any>[]) {\n addedActions.push(...newActions);\n },\n });\n\n let taskBroker: TaskBroker | undefined;\n env.registerExtensionPoint(scaffolderTaskBrokerExtensionPoint, {\n setTaskBroker(newTaskBroker) {\n if (taskBroker) {\n throw new Error('Task broker may only be set once');\n }\n taskBroker = newTaskBroker;\n },\n });\n\n const additionalTemplateFilters: Record<string, TemplateFilter> = {};\n const additionalTemplateGlobals: Record<string, TemplateGlobal> = {};\n env.registerExtensionPoint(scaffolderTemplatingExtensionPoint, {\n addTemplateFilters(newFilters) {\n Object.assign(additionalTemplateFilters, newFilters);\n },\n addTemplateGlobals(newGlobals) {\n Object.assign(additionalTemplateGlobals, newGlobals);\n },\n });\n\n env.registerInit({\n deps: {\n logger: coreServices.logger,\n config: coreServices.rootConfig,\n lifecycle: coreServices.rootLifecycle,\n reader: coreServices.urlReader,\n permissions: coreServices.permissions,\n database: coreServices.database,\n auth: coreServices.auth,\n discovery: coreServices.discovery,\n httpRouter: coreServices.httpRouter,\n httpAuth: coreServices.httpAuth,\n catalogClient: catalogServiceRef,\n },\n async init({\n logger,\n config,\n lifecycle,\n reader,\n database,\n auth,\n discovery,\n httpRouter,\n httpAuth,\n catalogClient,\n permissions,\n }) {\n const log = loggerToWinstonLogger(logger);\n const integrations = ScmIntegrations.fromConfig(config);\n\n const actions = [\n // actions provided from other modules\n ...addedActions,\n\n // built-in actions for the scaffolder\n createFetchPlainAction({\n reader,\n integrations,\n }),\n createFetchPlainFileAction({\n reader,\n integrations,\n }),\n createFetchTemplateAction({\n integrations,\n reader,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n }),\n createDebugLogAction(),\n createWaitAction(),\n // todo(blam): maybe these should be a -catalog module?\n createCatalogRegisterAction({ catalogClient, integrations, auth }),\n createFetchCatalogEntityAction({ catalogClient, auth }),\n createCatalogWriteAction(),\n createFilesystemDeleteAction(),\n createFilesystemRenameAction(),\n ];\n\n const actionIds = actions.map(action => action.id).join(', ');\n\n log.info(\n `Starting scaffolder with the following actions enabled ${actionIds}`,\n );\n\n const router = await createRouter({\n logger: log,\n config,\n database,\n catalogClient,\n reader,\n lifecycle,\n actions,\n taskBroker,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n auth,\n httpAuth,\n discovery,\n permissions,\n });\n httpRouter.use(router);\n },\n });\n },\n});\n"],"names":["createConditionExports","RESOURCE_TYPE_SCAFFOLDER_TEMPLATE","scaffolderTemplateRules","RESOURCE_TYPE_SCAFFOLDER_ACTION","scaffolderActionRules","createBackendPlugin","scaffolderActionsExtensionPoint","scaffolderTaskBrokerExtensionPoint","scaffolderTemplatingExtensionPoint","coreServices","catalogServiceRef","loggerToWinstonLogger","ScmIntegrations","createFetchPlainAction","createFetchPlainFileAction","createFetchTemplateAction","createDebugLogAction","createWaitAction","createCatalogRegisterAction","createFetchCatalogEntityAction","createCatalogWriteAction","createFilesystemDeleteAction","createFilesystemRenameAction","router","createRouter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,2BAA2BA,2CAAuB,CAAA;AAAA,EACtD,QAAU,EAAA,YAAA;AAAA,EACV,YAAc,EAAAC,uCAAA;AAAA,EACd,KAAO,EAAAC,8BAAA;AACT,CAAC,CAAA,CAAA;AAED,MAAM,0BAA0BF,2CAAuB,CAAA;AAAA,EACrD,QAAU,EAAA,YAAA;AAAA,EACV,YAAc,EAAAG,qCAAA;AAAA,EACd,KAAO,EAAAC,4BAAA;AACT,CAAC,CAAA,CAAA;AAkCM,MAAM,8CACX,wBAAyB,CAAA,0BAAA;AAQpB,MAAM,+BAA+B,wBAAyB,CAAA,WAAA;AAK9D,MAAM,4CACX,uBAAwB,CAAA,0BAAA;AASnB,MAAM,6BAA6B,uBAAwB,CAAA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M,MAAA,SAAA,GAAY,QAAQ,GAAI,CAAA,CAAA,MAAA,KAAU,OAAO,EAAE,CAAA,CAAE,KAAK,IAAI,CAAA,CAAA;AAE5D,QAAI,GAAA,CAAA,IAAA;AAAA,UACF,0DAA0D,SAAS,CAAA,CAAA;AAAA,SACrE,CAAA;AAEA,QAAM,MAAAC,QAAA,GAAS,MAAMC,mBAAa,CAAA;AAAA,UAChC,MAAQ,EAAA,GAAA;AAAA,UACR,MAAA;AAAA,UACA,QAAA;AAAA,UACA,aAAA;AAAA,UACA,MAAA;AAAA,UACA,SAAA;AAAA,UACA,OAAA;AAAA,UACA,UAAA;AAAA,UACA,yBAAA;AAAA,UACA,yBAAA;AAAA,UACA,IAAA;AAAA,UACA,QAAA;AAAA,UACA,SAAA;AAAA,UACA,WAAA;AAAA,SACD,CAAA,CAAA;AACD,QAAA,UAAA,CAAW,IAAID,QAAM,CAAA,CAAA;AAAA,OACvB;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAC;;;;;;;;"}
|
|
@@ -14,6 +14,7 @@ var zod = require('zod');
|
|
|
14
14
|
var pluginScaffolderNode = require('@backstage/plugin-scaffolder-node');
|
|
15
15
|
var yaml = require('yaml');
|
|
16
16
|
var fs = require('fs-extra');
|
|
17
|
+
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
17
18
|
var path = require('path');
|
|
18
19
|
var luxon = require('luxon');
|
|
19
20
|
var globby = require('globby');
|
|
@@ -42,6 +43,7 @@ var pluginPermissionNode = require('@backstage/plugin-permission-node');
|
|
|
42
43
|
var promClient = require('prom-client');
|
|
43
44
|
var pluginPermissionCommon = require('@backstage/plugin-permission-common');
|
|
44
45
|
var Transport = require('winston-transport');
|
|
46
|
+
var tripleBeam = require('triple-beam');
|
|
45
47
|
var url = require('url');
|
|
46
48
|
var os = require('os');
|
|
47
49
|
|
|
@@ -286,7 +288,7 @@ function createCatalogWriteAction() {
|
|
|
286
288
|
const entityRef = (_a = ctx.templateInfo) == null ? void 0 : _a.entityRef;
|
|
287
289
|
const path = filePath != null ? filePath : "catalog-info.yaml";
|
|
288
290
|
await fs__default.default.writeFile(
|
|
289
|
-
|
|
291
|
+
backendPluginApi.resolveSafeChildPath(ctx.workspacePath, path),
|
|
290
292
|
yaml__namespace.stringify({
|
|
291
293
|
...entity,
|
|
292
294
|
metadata: {
|
|
@@ -684,7 +686,7 @@ function createFetchPlainAction(options) {
|
|
|
684
686
|
var _a, _b;
|
|
685
687
|
ctx.logger.info("Fetching plain content from remote URL");
|
|
686
688
|
const targetPath = (_a = ctx.input.targetPath) != null ? _a : "./";
|
|
687
|
-
const outputPath =
|
|
689
|
+
const outputPath = backendPluginApi.resolveSafeChildPath(ctx.workspacePath, targetPath);
|
|
688
690
|
await pluginScaffolderNode.fetchContents({
|
|
689
691
|
reader,
|
|
690
692
|
integrations,
|
|
@@ -749,7 +751,7 @@ function createFetchPlainFileAction(options) {
|
|
|
749
751
|
async handler(ctx) {
|
|
750
752
|
var _a;
|
|
751
753
|
ctx.logger.info("Fetching plain content from remote URL");
|
|
752
|
-
const outputPath =
|
|
754
|
+
const outputPath = backendPluginApi.resolveSafeChildPath(
|
|
753
755
|
ctx.workspacePath,
|
|
754
756
|
ctx.input.targetPath
|
|
755
757
|
);
|
|
@@ -860,7 +862,7 @@ class SecureTemplater {
|
|
|
860
862
|
const context = await isolate.createContext();
|
|
861
863
|
const contextGlobal = context.global;
|
|
862
864
|
const nunjucksSource = await fs__default.default.readFile(
|
|
863
|
-
|
|
865
|
+
backendPluginApi.resolvePackagePath(
|
|
864
866
|
"@backstage/plugin-scaffolder-backend",
|
|
865
867
|
"assets/nunjucks.js.txt"
|
|
866
868
|
),
|
|
@@ -1045,9 +1047,9 @@ function createFetchTemplateAction(options) {
|
|
|
1045
1047
|
var _a, _b;
|
|
1046
1048
|
ctx.logger.info("Fetching template content from remote URL");
|
|
1047
1049
|
const workDir = await ctx.createTemporaryDirectory();
|
|
1048
|
-
const templateDir =
|
|
1050
|
+
const templateDir = backendPluginApi.resolveSafeChildPath(workDir, "template");
|
|
1049
1051
|
const targetPath = (_a = ctx.input.targetPath) != null ? _a : "./";
|
|
1050
|
-
const outputDir =
|
|
1052
|
+
const outputDir = backendPluginApi.resolveSafeChildPath(ctx.workspacePath, targetPath);
|
|
1051
1053
|
if (ctx.input.copyWithoutRender && ctx.input.copyWithoutTemplating) {
|
|
1052
1054
|
throw new errors.InputError(
|
|
1053
1055
|
"Fetch action input copyWithoutRender and copyWithoutTemplating can not be used at the same time"
|
|
@@ -1147,7 +1149,7 @@ function createFetchTemplateAction(options) {
|
|
|
1147
1149
|
if (containsSkippedContent(localOutputPath)) {
|
|
1148
1150
|
continue;
|
|
1149
1151
|
}
|
|
1150
|
-
const outputPath =
|
|
1152
|
+
const outputPath = backendPluginApi.resolveSafeChildPath(outputDir, localOutputPath);
|
|
1151
1153
|
if (fs__default.default.existsSync(outputPath) && !ctx.input.replace) {
|
|
1152
1154
|
continue;
|
|
1153
1155
|
}
|
|
@@ -1162,7 +1164,7 @@ function createFetchTemplateAction(options) {
|
|
|
1162
1164
|
);
|
|
1163
1165
|
await fs__default.default.ensureDir(outputPath);
|
|
1164
1166
|
} else {
|
|
1165
|
-
const inputFilePath =
|
|
1167
|
+
const inputFilePath = backendPluginApi.resolveSafeChildPath(templateDir, location);
|
|
1166
1168
|
const stats = await fs__default.default.promises.lstat(inputFilePath);
|
|
1167
1169
|
if (stats.isSymbolicLink() || await isbinaryfile.isBinaryFile(inputFilePath)) {
|
|
1168
1170
|
ctx.logger.info(
|
|
@@ -1237,7 +1239,7 @@ const createFilesystemDeleteAction = () => {
|
|
|
1237
1239
|
throw new errors.InputError("files must be an Array");
|
|
1238
1240
|
}
|
|
1239
1241
|
for (const file of ctx.input.files) {
|
|
1240
|
-
const filepath =
|
|
1242
|
+
const filepath = backendPluginApi.resolveSafeChildPath(ctx.workspacePath, file);
|
|
1241
1243
|
try {
|
|
1242
1244
|
await fs__default.default.remove(filepath);
|
|
1243
1245
|
ctx.logger.info(`File ${filepath} deleted successfully`);
|
|
@@ -1318,11 +1320,11 @@ const createFilesystemRenameAction = () => {
|
|
|
1318
1320
|
if (!file.from || !file.to) {
|
|
1319
1321
|
throw new errors.InputError("each file must have a from and to property");
|
|
1320
1322
|
}
|
|
1321
|
-
const sourceFilepath =
|
|
1323
|
+
const sourceFilepath = backendPluginApi.resolveSafeChildPath(
|
|
1322
1324
|
ctx.workspacePath,
|
|
1323
1325
|
file.from
|
|
1324
1326
|
);
|
|
1325
|
-
const destFilepath =
|
|
1327
|
+
const destFilepath = backendPluginApi.resolveSafeChildPath(ctx.workspacePath, file.to);
|
|
1326
1328
|
try {
|
|
1327
1329
|
await fs__default.default.move(sourceFilepath, destFilepath, {
|
|
1328
1330
|
overwrite: (_b = file.overwrite) != null ? _b : false
|
|
@@ -1387,7 +1389,8 @@ const createBuiltinActions = (options) => {
|
|
|
1387
1389
|
}),
|
|
1388
1390
|
github.createPublishGithubPullRequestAction({
|
|
1389
1391
|
integrations,
|
|
1390
|
-
githubCredentialsProvider
|
|
1392
|
+
githubCredentialsProvider,
|
|
1393
|
+
config
|
|
1391
1394
|
}),
|
|
1392
1395
|
gitlab.createPublishGitlabAction({
|
|
1393
1396
|
integrations,
|
|
@@ -1549,7 +1552,7 @@ var __publicField$3 = (obj, key, value) => {
|
|
|
1549
1552
|
__defNormalProp$3(obj, key + "" , value);
|
|
1550
1553
|
return value;
|
|
1551
1554
|
};
|
|
1552
|
-
const migrationsDir =
|
|
1555
|
+
const migrationsDir = backendPluginApi.resolvePackagePath(
|
|
1553
1556
|
"@backstage/plugin-scaffolder-backend",
|
|
1554
1557
|
"migrations"
|
|
1555
1558
|
);
|
|
@@ -2452,21 +2455,15 @@ const _WinstonLogger = class _WinstonLogger {
|
|
|
2452
2455
|
static redacter() {
|
|
2453
2456
|
const redactionSet = /* @__PURE__ */ new Set();
|
|
2454
2457
|
let redactionPattern = void 0;
|
|
2455
|
-
const replace = (obj) => {
|
|
2456
|
-
var _a;
|
|
2457
|
-
for (const key in obj) {
|
|
2458
|
-
if (obj.hasOwnProperty(key)) {
|
|
2459
|
-
if (typeof obj[key] === "object") {
|
|
2460
|
-
obj[key] = replace(obj[key]);
|
|
2461
|
-
} else if (typeof obj[key] === "string") {
|
|
2462
|
-
obj[key] = (_a = obj[key]) == null ? void 0 : _a.replace(redactionPattern, "[REDACTED]");
|
|
2463
|
-
}
|
|
2464
|
-
}
|
|
2465
|
-
}
|
|
2466
|
-
return obj;
|
|
2467
|
-
};
|
|
2468
2458
|
return {
|
|
2469
|
-
format: winston.format(
|
|
2459
|
+
format: winston.format((obj) => {
|
|
2460
|
+
var _a, _b;
|
|
2461
|
+
if (!redactionPattern || !obj) {
|
|
2462
|
+
return obj;
|
|
2463
|
+
}
|
|
2464
|
+
obj[tripleBeam.MESSAGE] = (_b = (_a = obj[tripleBeam.MESSAGE]) == null ? void 0 : _a.replace) == null ? void 0 : _b.call(_a, redactionPattern, "[REDACTED]");
|
|
2465
|
+
return obj;
|
|
2466
|
+
})(),
|
|
2470
2467
|
add(newRedactions) {
|
|
2471
2468
|
let added = 0;
|
|
2472
2469
|
for (const redactionToTrim of newRedactions) {
|
|
@@ -3154,7 +3151,7 @@ function createDryRunner(options) {
|
|
|
3154
3151
|
});
|
|
3155
3152
|
const dryRunId = uuid.v4();
|
|
3156
3153
|
const log = new Array();
|
|
3157
|
-
const contentsPath =
|
|
3154
|
+
const contentsPath = backendPluginApi.resolveSafeChildPath(
|
|
3158
3155
|
options.workingDirectory,
|
|
3159
3156
|
`dry-run-content-${dryRunId}`
|
|
3160
3157
|
);
|
|
@@ -3175,7 +3172,7 @@ function createDryRunner(options) {
|
|
|
3175
3172
|
templateInfo: {
|
|
3176
3173
|
entityRef: "template:default/dry-run",
|
|
3177
3174
|
baseUrl: url.pathToFileURL(
|
|
3178
|
-
|
|
3175
|
+
backendPluginApi.resolveSafeChildPath(contentsPath, "template.yaml")
|
|
3179
3176
|
).toString()
|
|
3180
3177
|
}
|
|
3181
3178
|
},
|
|
@@ -3780,4 +3777,4 @@ exports.createRouter = createRouter;
|
|
|
3780
3777
|
exports.createWaitAction = createWaitAction;
|
|
3781
3778
|
exports.scaffolderActionRules = scaffolderActionRules;
|
|
3782
3779
|
exports.scaffolderTemplateRules = scaffolderTemplateRules;
|
|
3783
|
-
//# sourceMappingURL=router-
|
|
3780
|
+
//# sourceMappingURL=router-CM3G1J74.cjs.js.map
|