@backstage/plugin-scaffolder-backend 1.30.0-next.1 → 1.30.0-next.3
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 +79 -0
- package/config.d.ts +5 -0
- package/dist/ScaffolderPlugin.cjs.js +16 -2
- package/dist/ScaffolderPlugin.cjs.js.map +1 -1
- package/dist/index.d.ts +32 -29
- package/dist/lib/templating/SecureTemplater.cjs.js +2 -1
- package/dist/lib/templating/SecureTemplater.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/createBuiltinActions.cjs.js +29 -29
- package/dist/scaffolder/actions/builtin/createBuiltinActions.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/filesystem/delete.cjs.js +15 -7
- package/dist/scaffolder/actions/builtin/filesystem/delete.cjs.js.map +1 -1
- package/dist/scaffolder/actions/builtin/filesystem/delete.examples.cjs.js +15 -0
- package/dist/scaffolder/actions/builtin/filesystem/delete.examples.cjs.js.map +1 -1
- package/dist/scaffolder/actions/deprecated.cjs.js +25 -51
- package/dist/scaffolder/actions/deprecated.cjs.js.map +1 -1
- package/dist/scaffolder/tasks/TaskWorker.cjs.js +12 -4
- package/dist/scaffolder/tasks/TaskWorker.cjs.js.map +1 -1
- package/dist/service/router.cjs.js +26 -11
- package/dist/service/router.cjs.js.map +1 -1
- package/package.json +27 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,84 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-backend
|
|
2
2
|
|
|
3
|
+
## 1.30.0-next.3
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- dc8dd4b: Added new `createTemplateFilter`, `createTemplateGlobalFunction`, `createTemplateGlobalValue` for template extensions.
|
|
8
|
+
- 3d6ef79: Support file globbing in fs:delete
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- 1e935f0: Added conditional rendering of `oneOf` output schemas on the Installed Actions page for scaffolder actions
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
- @backstage/plugin-scaffolder-backend-module-github@0.6.0-next.2
|
|
15
|
+
- @backstage/plugin-catalog-node@1.16.0-next.3
|
|
16
|
+
- @backstage/plugin-permission-node@0.8.8-next.2
|
|
17
|
+
- @backstage/plugin-scaffolder-node@0.7.0-next.2
|
|
18
|
+
- @backstage/backend-defaults@0.8.0-next.3
|
|
19
|
+
- @backstage/backend-plugin-api@1.2.0-next.2
|
|
20
|
+
- @backstage/plugin-catalog-backend-module-scaffolder-entity-model@0.2.5-next.3
|
|
21
|
+
- @backstage/plugin-auth-node@0.6.0-next.2
|
|
22
|
+
- @backstage/plugin-events-node@0.4.8-next.2
|
|
23
|
+
- @backstage/plugin-scaffolder-backend-module-bitbucket@0.3.7-next.2
|
|
24
|
+
- @backstage/plugin-scaffolder-backend-module-bitbucket-cloud@0.2.6-next.2
|
|
25
|
+
- @backstage/plugin-scaffolder-backend-module-bitbucket-server@0.2.6-next.2
|
|
26
|
+
- @backstage/plugin-scaffolder-backend-module-gerrit@0.2.6-next.2
|
|
27
|
+
- @backstage/plugin-scaffolder-backend-module-gitea@0.2.6-next.2
|
|
28
|
+
- @backstage/plugin-scaffolder-backend-module-gitlab@0.8.0-next.3
|
|
29
|
+
- @backstage/plugin-scaffolder-backend-module-azure@0.2.6-next.2
|
|
30
|
+
- @backstage/catalog-client@1.9.1
|
|
31
|
+
- @backstage/catalog-model@1.7.3
|
|
32
|
+
- @backstage/config@1.3.2
|
|
33
|
+
- @backstage/errors@1.2.7
|
|
34
|
+
- @backstage/integration@1.16.1
|
|
35
|
+
- @backstage/types@1.2.1
|
|
36
|
+
- @backstage/plugin-bitbucket-cloud-common@0.2.27
|
|
37
|
+
- @backstage/plugin-permission-common@0.8.4
|
|
38
|
+
- @backstage/plugin-scaffolder-common@1.5.9
|
|
39
|
+
|
|
40
|
+
## 1.30.0-next.2
|
|
41
|
+
|
|
42
|
+
### Minor Changes
|
|
43
|
+
|
|
44
|
+
- 91f3313: Added experimental flag for scaffolder to wait for running tasks to complete on shutdown
|
|
45
|
+
|
|
46
|
+
Enabling the `EXPERIMENTAL_gracefulShutdown` flag in the scaffolder config will make the
|
|
47
|
+
scaffolder block the shutdown process until all running tasks have completed. This is useful
|
|
48
|
+
when there is a need to ensure that all tasks have completed before the scaffolder is shut down.
|
|
49
|
+
|
|
50
|
+
Please note, that the `TaskWorker` `stop` method is now asynchronous and awaited for the
|
|
51
|
+
tasks to complete when the experimental flag is enabled.
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- Updated dependencies
|
|
56
|
+
- @backstage/plugin-scaffolder-backend-module-gitlab@0.8.0-next.2
|
|
57
|
+
- @backstage/backend-plugin-api@1.2.0-next.1
|
|
58
|
+
- @backstage/plugin-auth-node@0.6.0-next.1
|
|
59
|
+
- @backstage/backend-defaults@0.8.0-next.2
|
|
60
|
+
- @backstage/catalog-client@1.9.1
|
|
61
|
+
- @backstage/catalog-model@1.7.3
|
|
62
|
+
- @backstage/config@1.3.2
|
|
63
|
+
- @backstage/errors@1.2.7
|
|
64
|
+
- @backstage/integration@1.16.1
|
|
65
|
+
- @backstage/types@1.2.1
|
|
66
|
+
- @backstage/plugin-bitbucket-cloud-common@0.2.27
|
|
67
|
+
- @backstage/plugin-catalog-backend-module-scaffolder-entity-model@0.2.5-next.2
|
|
68
|
+
- @backstage/plugin-catalog-node@1.16.0-next.2
|
|
69
|
+
- @backstage/plugin-events-node@0.4.8-next.1
|
|
70
|
+
- @backstage/plugin-permission-common@0.8.4
|
|
71
|
+
- @backstage/plugin-permission-node@0.8.8-next.1
|
|
72
|
+
- @backstage/plugin-scaffolder-backend-module-azure@0.2.6-next.1
|
|
73
|
+
- @backstage/plugin-scaffolder-backend-module-bitbucket@0.3.7-next.1
|
|
74
|
+
- @backstage/plugin-scaffolder-backend-module-bitbucket-cloud@0.2.6-next.1
|
|
75
|
+
- @backstage/plugin-scaffolder-backend-module-bitbucket-server@0.2.6-next.1
|
|
76
|
+
- @backstage/plugin-scaffolder-backend-module-gerrit@0.2.6-next.1
|
|
77
|
+
- @backstage/plugin-scaffolder-backend-module-gitea@0.2.6-next.1
|
|
78
|
+
- @backstage/plugin-scaffolder-backend-module-github@0.5.6-next.1
|
|
79
|
+
- @backstage/plugin-scaffolder-common@1.5.9
|
|
80
|
+
- @backstage/plugin-scaffolder-node@0.7.0-next.1
|
|
81
|
+
|
|
3
82
|
## 1.30.0-next.1
|
|
4
83
|
|
|
5
84
|
### Patch Changes
|
package/config.d.ts
CHANGED
|
@@ -41,6 +41,11 @@ export interface Config {
|
|
|
41
41
|
*/
|
|
42
42
|
concurrentTasksLimit?: number;
|
|
43
43
|
|
|
44
|
+
/**
|
|
45
|
+
* Tries to wait for tasks to finish during SIGTERM before shutting down the TaskWorker.
|
|
46
|
+
*/
|
|
47
|
+
EXPERIMENTAL_gracefulShutdown?: boolean;
|
|
48
|
+
|
|
44
49
|
/**
|
|
45
50
|
* Sets the tasks recoverability on system start up.
|
|
46
51
|
*
|
|
@@ -35,6 +35,7 @@ require('@backstage/config');
|
|
|
35
35
|
require('lodash');
|
|
36
36
|
require('p-queue');
|
|
37
37
|
require('./scaffolder/tasks/NunjucksWorkflowRunner.cjs.js');
|
|
38
|
+
require('timers/promises');
|
|
38
39
|
var router = require('./service/router.cjs.js');
|
|
39
40
|
|
|
40
41
|
const scaffolderPlugin = backendPluginApi.createBackendPlugin({
|
|
@@ -59,10 +60,23 @@ const scaffolderPlugin = backendPluginApi.createBackendPlugin({
|
|
|
59
60
|
const additionalTemplateGlobals = {};
|
|
60
61
|
env.registerExtensionPoint(alpha.scaffolderTemplatingExtensionPoint, {
|
|
61
62
|
addTemplateFilters(newFilters) {
|
|
62
|
-
Object.assign(
|
|
63
|
+
Object.assign(
|
|
64
|
+
additionalTemplateFilters,
|
|
65
|
+
Array.isArray(newFilters) ? Object.fromEntries(
|
|
66
|
+
newFilters.map((tf) => [tf.id, tf.filter])
|
|
67
|
+
) : newFilters
|
|
68
|
+
);
|
|
63
69
|
},
|
|
64
70
|
addTemplateGlobals(newGlobals) {
|
|
65
|
-
Object.assign(
|
|
71
|
+
Object.assign(
|
|
72
|
+
additionalTemplateGlobals,
|
|
73
|
+
Array.isArray(newGlobals) ? Object.fromEntries(
|
|
74
|
+
newGlobals.map((g) => [
|
|
75
|
+
g.id,
|
|
76
|
+
"value" in g ? g.value : g.fn
|
|
77
|
+
])
|
|
78
|
+
) : newGlobals
|
|
79
|
+
);
|
|
66
80
|
}
|
|
67
81
|
});
|
|
68
82
|
const autocompleteHandlers = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScaffolderPlugin.cjs.js","sources":["../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 { loggerToWinstonLogger } from '@backstage/backend-common';\nimport {\n coreServices,\n createBackendPlugin,\n} from '@backstage/backend-plugin-api';\nimport { ScmIntegrations } from '@backstage/integration';\nimport { catalogServiceRef } from '@backstage/plugin-catalog-node/alpha';\nimport { eventsServiceRef } from '@backstage/plugin-events-node';\nimport {\n TaskBroker,\n TemplateAction,\n TemplateFilter,\n TemplateGlobal,\n} from '@backstage/plugin-scaffolder-node';\nimport {\n AutocompleteHandler,\n scaffolderActionsExtensionPoint,\n scaffolderAutocompleteExtensionPoint,\n scaffolderTaskBrokerExtensionPoint,\n scaffolderTemplatingExtensionPoint,\n scaffolderWorkspaceProviderExtensionPoint,\n WorkspaceProvider,\n} from '@backstage/plugin-scaffolder-node/alpha';\nimport {\n createCatalogRegisterAction,\n createCatalogWriteAction,\n createDebugLogAction,\n createFetchCatalogEntityAction,\n createFetchPlainAction,\n createFetchPlainFileAction,\n createFetchTemplateAction,\n createFetchTemplateFileAction,\n createFilesystemDeleteAction,\n createFilesystemReadDirAction,\n createFilesystemRenameAction,\n createWaitAction,\n} from './scaffolder';\nimport { createRouter } from './service/router';\n\n/**\n * Scaffolder plugin\n *\n * @public\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 const autocompleteHandlers: Record<string, AutocompleteHandler> = {};\n env.registerExtensionPoint(scaffolderAutocompleteExtensionPoint, {\n addAutocompleteProvider(provider) {\n autocompleteHandlers[provider.id] = provider.handler;\n },\n });\n\n const additionalWorkspaceProviders: Record<string, WorkspaceProvider> = {};\n env.registerExtensionPoint(scaffolderWorkspaceProviderExtensionPoint, {\n addProviders(provider) {\n Object.assign(additionalWorkspaceProviders, provider);\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 auditor: coreServices.auditor,\n catalogClient: catalogServiceRef,\n events: eventsServiceRef,\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 events,\n auditor,\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 createFetchTemplateFileAction({\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 createFilesystemReadDirAction(),\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 autocompleteHandlers,\n additionalWorkspaceProviders,\n events,\n auditor,\n });\n httpRouter.use(router);\n },\n });\n },\n});\n"],"names":["createBackendPlugin","scaffolderActionsExtensionPoint","scaffolderTaskBrokerExtensionPoint","scaffolderTemplatingExtensionPoint","scaffolderAutocompleteExtensionPoint","scaffolderWorkspaceProviderExtensionPoint","coreServices","catalogServiceRef","eventsServiceRef","log","loggerToWinstonLogger","ScmIntegrations","createFetchPlainAction","createFetchPlainFileAction","createFetchTemplateAction","createFetchTemplateFileAction","createDebugLogAction","createWaitAction","createCatalogRegisterAction","createFetchCatalogEntityAction","createCatalogWriteAction","createFilesystemDeleteAction","createFilesystemRenameAction","createFilesystemReadDirAction","router","createRouter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DO,MAAM,mBAAmBA,oCAAoB,CAAA;AAAA,EAClD,QAAU,EAAA,YAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAM,MAAA,YAAA,GAAe,IAAI,KAAgC,EAAA;AACzD,IAAA,GAAA,CAAI,uBAAuBC,qCAAiC,EAAA;AAAA,MAC1D,cAAc,UAAmC,EAAA;AAC/C,QAAa,YAAA,CAAA,IAAA,CAAK,GAAG,UAAU,CAAA;AAAA;AACjC,KACD,CAAA;AAED,IAAI,IAAA,UAAA;AACJ,IAAA,GAAA,CAAI,uBAAuBC,wCAAoC,EAAA;AAAA,MAC7D,cAAc,aAAe,EAAA;AAC3B,QAAA,IAAI,UAAY,EAAA;AACd,UAAM,MAAA,IAAI,MAAM,kCAAkC,CAAA;AAAA;AAEpD,QAAa,UAAA,GAAA,aAAA;AAAA;AACf,KACD,CAAA;AAED,IAAA,MAAM,4BAA4D,EAAC;AACnE,IAAA,MAAM,4BAA4D,EAAC;AACnE,IAAA,GAAA,CAAI,uBAAuBC,wCAAoC,EAAA;AAAA,MAC7D,mBAAmB,UAAY,EAAA;AAC7B,QAAO,MAAA,CAAA,MAAA,CAAO,2BAA2B,UAAU,CAAA;AAAA,OACrD;AAAA,MACA,mBAAmB,UAAY,EAAA;AAC7B,QAAO,MAAA,CAAA,MAAA,CAAO,2BAA2B,UAAU,CAAA;AAAA;AACrD,KACD,CAAA;AAED,IAAA,MAAM,uBAA4D,EAAC;AACnE,IAAA,GAAA,CAAI,uBAAuBC,0CAAsC,EAAA;AAAA,MAC/D,wBAAwB,QAAU,EAAA;AAChC,QAAq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,UACA,4BAAA;AAAA,UACA,MAAA;AAAA,UACA;AAAA,SACD,CAAA;AACD,QAAA,UAAA,CAAW,IAAIe,QAAM,CAAA;AAAA;AACvB,KACD,CAAA;AAAA;AAEL,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"ScaffolderPlugin.cjs.js","sources":["../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 { loggerToWinstonLogger } from '@backstage/backend-common';\nimport {\n coreServices,\n createBackendPlugin,\n} from '@backstage/backend-plugin-api';\nimport { ScmIntegrations } from '@backstage/integration';\nimport { catalogServiceRef } from '@backstage/plugin-catalog-node/alpha';\nimport { eventsServiceRef } from '@backstage/plugin-events-node';\nimport {\n TaskBroker,\n TemplateAction,\n TemplateFilter,\n TemplateGlobal,\n} from '@backstage/plugin-scaffolder-node';\nimport {\n AutocompleteHandler,\n scaffolderActionsExtensionPoint,\n scaffolderAutocompleteExtensionPoint,\n scaffolderTaskBrokerExtensionPoint,\n scaffolderTemplatingExtensionPoint,\n scaffolderWorkspaceProviderExtensionPoint,\n WorkspaceProvider,\n} from '@backstage/plugin-scaffolder-node/alpha';\nimport {\n createCatalogRegisterAction,\n createCatalogWriteAction,\n createDebugLogAction,\n createFetchCatalogEntityAction,\n createFetchPlainAction,\n createFetchPlainFileAction,\n createFetchTemplateAction,\n createFetchTemplateFileAction,\n createFilesystemDeleteAction,\n createFilesystemReadDirAction,\n createFilesystemRenameAction,\n createWaitAction,\n} from './scaffolder';\nimport { createRouter } from './service/router';\n\n/**\n * Scaffolder plugin\n *\n * @public\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(\n additionalTemplateFilters,\n Array.isArray(newFilters)\n ? Object.fromEntries(\n newFilters.map(tf => [tf.id, tf.filter as TemplateFilter]),\n )\n : newFilters,\n );\n },\n addTemplateGlobals(newGlobals) {\n Object.assign(\n additionalTemplateGlobals,\n Array.isArray(newGlobals)\n ? Object.fromEntries(\n newGlobals.map(g => [\n g.id,\n ('value' in g ? g.value : g.fn) as TemplateGlobal,\n ]),\n )\n : newGlobals,\n );\n },\n });\n\n const autocompleteHandlers: Record<string, AutocompleteHandler> = {};\n env.registerExtensionPoint(scaffolderAutocompleteExtensionPoint, {\n addAutocompleteProvider(provider) {\n autocompleteHandlers[provider.id] = provider.handler;\n },\n });\n\n const additionalWorkspaceProviders: Record<string, WorkspaceProvider> = {};\n env.registerExtensionPoint(scaffolderWorkspaceProviderExtensionPoint, {\n addProviders(provider) {\n Object.assign(additionalWorkspaceProviders, provider);\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 auditor: coreServices.auditor,\n catalogClient: catalogServiceRef,\n events: eventsServiceRef,\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 events,\n auditor,\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 createFetchTemplateFileAction({\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 createFilesystemReadDirAction(),\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 autocompleteHandlers,\n additionalWorkspaceProviders,\n events,\n auditor,\n });\n httpRouter.use(router);\n },\n });\n },\n});\n"],"names":["createBackendPlugin","scaffolderActionsExtensionPoint","scaffolderTaskBrokerExtensionPoint","scaffolderTemplatingExtensionPoint","scaffolderAutocompleteExtensionPoint","scaffolderWorkspaceProviderExtensionPoint","coreServices","catalogServiceRef","eventsServiceRef","log","loggerToWinstonLogger","ScmIntegrations","createFetchPlainAction","createFetchPlainFileAction","createFetchTemplateAction","createFetchTemplateFileAction","createDebugLogAction","createWaitAction","createCatalogRegisterAction","createFetchCatalogEntityAction","createCatalogWriteAction","createFilesystemDeleteAction","createFilesystemRenameAction","createFilesystemReadDirAction","router","createRouter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DO,MAAM,mBAAmBA,oCAAoB,CAAA;AAAA,EAClD,QAAU,EAAA,YAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAM,MAAA,YAAA,GAAe,IAAI,KAAgC,EAAA;AACzD,IAAA,GAAA,CAAI,uBAAuBC,qCAAiC,EAAA;AAAA,MAC1D,cAAc,UAAmC,EAAA;AAC/C,QAAa,YAAA,CAAA,IAAA,CAAK,GAAG,UAAU,CAAA;AAAA;AACjC,KACD,CAAA;AAED,IAAI,IAAA,UAAA;AACJ,IAAA,GAAA,CAAI,uBAAuBC,wCAAoC,EAAA;AAAA,MAC7D,cAAc,aAAe,EAAA;AAC3B,QAAA,IAAI,UAAY,EAAA;AACd,UAAM,MAAA,IAAI,MAAM,kCAAkC,CAAA;AAAA;AAEpD,QAAa,UAAA,GAAA,aAAA;AAAA;AACf,KACD,CAAA;AAED,IAAA,MAAM,4BAA4D,EAAC;AACnE,IAAA,MAAM,4BAA4D,EAAC;AACnE,IAAA,GAAA,CAAI,uBAAuBC,wCAAoC,EAAA;AAAA,MAC7D,mBAAmB,UAAY,EAAA;AAC7B,QAAO,MAAA,CAAA,MAAA;AAAA,UACL,yBAAA;AAAA,UACA,KAAM,CAAA,OAAA,CAAQ,UAAU,CAAA,GACpB,MAAO,CAAA,WAAA;AAAA,YACL,UAAA,CAAW,IAAI,CAAM,EAAA,KAAA,CAAC,GAAG,EAAI,EAAA,EAAA,CAAG,MAAwB,CAAC;AAAA,WAE3D,GAAA;AAAA,SACN;AAAA,OACF;AAAA,MACA,mBAAmB,UAAY,EAAA;AAC7B,QAAO,MAAA,CAAA,MAAA;AAAA,UACL,yBAAA;AAAA,UACA,KAAM,CAAA,OAAA,CAA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AA;AAAA,UACF,0DAA0D,SAAS,CAAA;AAAA,SACrE;AAEA,QAAM,MAAAe,QAAA,GAAS,MAAMC,mBAAa,CAAA;AAAA,UAChC,MAAQ,EAAAhB,KAAA;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,UACA,oBAAA;AAAA,UACA,4BAAA;AAAA,UACA,MAAA;AAAA,UACA;AAAA,SACD,CAAA;AACD,QAAA,UAAA,CAAW,IAAIe,QAAM,CAAA;AAAA;AACvB,KACD,CAAA;AAAA;AAEL,CAAC;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,18 +10,18 @@ import { ScmIntegrations } from '@backstage/integration';
|
|
|
10
10
|
import { CatalogApi } from '@backstage/catalog-client';
|
|
11
11
|
import { Config } from '@backstage/config';
|
|
12
12
|
import { Duration } from 'luxon';
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
13
|
+
import { createGithubActionsDispatchAction as createGithubActionsDispatchAction$1, createGithubDeployKeyAction as createGithubDeployKeyAction$1, createGithubEnvironmentAction as createGithubEnvironmentAction$1, createGithubIssuesLabelAction as createGithubIssuesLabelAction$1, CreateGithubPullRequestActionOptions as CreateGithubPullRequestActionOptions$1, createGithubRepoCreateAction as createGithubRepoCreateAction$1, createGithubRepoPushAction as createGithubRepoPushAction$1, createGithubWebhookAction as createGithubWebhookAction$1, createPublishGithubAction as createPublishGithubAction$1 } from '@backstage/plugin-scaffolder-backend-module-github';
|
|
14
|
+
import { createPublishGitlabAction as createPublishGitlabAction$1 } from '@backstage/plugin-scaffolder-backend-module-gitlab';
|
|
15
|
+
import { createPublishAzureAction as createPublishAzureAction$1 } from '@backstage/plugin-scaffolder-backend-module-azure';
|
|
16
|
+
import { createPublishBitbucketAction as createPublishBitbucketAction$1 } from '@backstage/plugin-scaffolder-backend-module-bitbucket';
|
|
17
|
+
import { createPublishBitbucketCloudAction as createPublishBitbucketCloudAction$1 } from '@backstage/plugin-scaffolder-backend-module-bitbucket-cloud';
|
|
18
|
+
import { createPublishBitbucketServerAction as createPublishBitbucketServerAction$1, createPublishBitbucketServerPullRequestAction as createPublishBitbucketServerPullRequestAction$1 } from '@backstage/plugin-scaffolder-backend-module-bitbucket-server';
|
|
19
|
+
import { createPublishGerritAction as createPublishGerritAction$1, createPublishGerritReviewAction as createPublishGerritReviewAction$1 } from '@backstage/plugin-scaffolder-backend-module-gerrit';
|
|
20
20
|
import { Knex } from 'knex';
|
|
21
21
|
import * as _backstage_plugin_scaffolder_common from '@backstage/plugin-scaffolder-common';
|
|
22
22
|
import { TaskSpec, TaskRecovery, TemplateEntityStepV1beta3, TemplateParametersV1beta3 } from '@backstage/plugin-scaffolder-common';
|
|
23
23
|
import { EventsService } from '@backstage/plugin-events-node';
|
|
24
|
-
import { WorkspaceProvider, AutocompleteHandler } from '@backstage/plugin-scaffolder-node/alpha';
|
|
24
|
+
import { WorkspaceProvider, CreatedTemplateFilter, CreatedTemplateGlobal, AutocompleteHandler } from '@backstage/plugin-scaffolder-node/alpha';
|
|
25
25
|
import { Logger } from 'winston';
|
|
26
26
|
import { PermissionEvaluator, PermissionRuleParams } from '@backstage/plugin-permission-common';
|
|
27
27
|
import { IdentityApi } from '@backstage/plugin-auth-node';
|
|
@@ -280,52 +280,52 @@ declare const createFilesystemReadDirAction: () => _backstage_plugin_scaffolder_
|
|
|
280
280
|
* @public
|
|
281
281
|
* @deprecated use import from `@backstage/plugin-scaffolder-backend-module-github` instead
|
|
282
282
|
*/
|
|
283
|
-
declare const createGithubActionsDispatchAction: typeof
|
|
283
|
+
declare const createGithubActionsDispatchAction: typeof createGithubActionsDispatchAction$1;
|
|
284
284
|
/**
|
|
285
285
|
* @public
|
|
286
286
|
* @deprecated use import from `@backstage/plugin-scaffolder-backend-module-github` instead
|
|
287
287
|
*/
|
|
288
|
-
declare const createGithubDeployKeyAction: typeof
|
|
288
|
+
declare const createGithubDeployKeyAction: typeof createGithubDeployKeyAction$1;
|
|
289
289
|
/**
|
|
290
290
|
* @public
|
|
291
291
|
* @deprecated use import from `@backstage/plugin-scaffolder-backend-module-github` instead
|
|
292
292
|
*/
|
|
293
|
-
declare const createGithubEnvironmentAction: typeof
|
|
293
|
+
declare const createGithubEnvironmentAction: typeof createGithubEnvironmentAction$1;
|
|
294
294
|
/**
|
|
295
295
|
* @public
|
|
296
296
|
* @deprecated use import from `@backstage/plugin-scaffolder-backend-module-github` instead
|
|
297
297
|
*/
|
|
298
|
-
declare const createGithubIssuesLabelAction: typeof
|
|
298
|
+
declare const createGithubIssuesLabelAction: typeof createGithubIssuesLabelAction$1;
|
|
299
299
|
/**
|
|
300
300
|
* @public
|
|
301
301
|
* @deprecated use import from `@backstage/plugin-scaffolder-backend-module-github` instead
|
|
302
302
|
*/
|
|
303
|
-
type CreateGithubPullRequestActionOptions =
|
|
303
|
+
type CreateGithubPullRequestActionOptions = CreateGithubPullRequestActionOptions$1;
|
|
304
304
|
/**
|
|
305
305
|
* @public
|
|
306
306
|
* @deprecated use import from `@backstage/plugin-scaffolder-backend-module-github` instead
|
|
307
307
|
*/
|
|
308
|
-
declare const createGithubRepoCreateAction: typeof
|
|
308
|
+
declare const createGithubRepoCreateAction: typeof createGithubRepoCreateAction$1;
|
|
309
309
|
/**
|
|
310
310
|
* @public
|
|
311
311
|
* @deprecated use import from `@backstage/plugin-scaffolder-backend-module-github` instead
|
|
312
312
|
*/
|
|
313
|
-
declare const createGithubRepoPushAction: typeof
|
|
313
|
+
declare const createGithubRepoPushAction: typeof createGithubRepoPushAction$1;
|
|
314
314
|
/**
|
|
315
315
|
* @public
|
|
316
316
|
* @deprecated use import from `@backstage/plugin-scaffolder-backend-module-github` instead
|
|
317
317
|
*/
|
|
318
|
-
declare const createGithubWebhookAction: typeof
|
|
318
|
+
declare const createGithubWebhookAction: typeof createGithubWebhookAction$1;
|
|
319
319
|
/**
|
|
320
320
|
* @public
|
|
321
321
|
* @deprecated use import from `@backstage/plugin-scaffolder-backend-module-github` instead
|
|
322
322
|
*/
|
|
323
|
-
declare const createPublishGithubAction: typeof
|
|
323
|
+
declare const createPublishGithubAction: typeof createPublishGithubAction$1;
|
|
324
324
|
/**
|
|
325
325
|
* @public
|
|
326
326
|
* @deprecated use import from `@backstage/plugin-scaffolder-backend-module-github` instead
|
|
327
327
|
*/
|
|
328
|
-
declare const createPublishGithubPullRequestAction: (options:
|
|
328
|
+
declare const createPublishGithubPullRequestAction: (options: CreateGithubPullRequestActionOptions$1) => _backstage_plugin_scaffolder_node.TemplateAction<{
|
|
329
329
|
title: string;
|
|
330
330
|
branchName: string;
|
|
331
331
|
targetBranchName?: string | undefined;
|
|
@@ -343,46 +343,47 @@ declare const createPublishGithubPullRequestAction: (options: github.CreateGithu
|
|
|
343
343
|
gitAuthorName?: string | undefined;
|
|
344
344
|
gitAuthorEmail?: string | undefined;
|
|
345
345
|
forceEmptyGitAuthor?: boolean | undefined;
|
|
346
|
+
createWhenEmpty?: boolean | undefined;
|
|
346
347
|
}, _backstage_types.JsonObject>;
|
|
347
348
|
/**
|
|
348
349
|
* @public @deprecated use "createPublishBitbucketCloudAction" from \@backstage/plugin-scaffolder-backend-module-bitbucket-cloud or "createPublishBitbucketServerAction" from \@backstage/plugin-scaffolder-backend-module-bitbucket-server instead
|
|
349
350
|
*/
|
|
350
|
-
declare const createPublishBitbucketAction: typeof
|
|
351
|
+
declare const createPublishBitbucketAction: typeof createPublishBitbucketAction$1;
|
|
351
352
|
/**
|
|
352
353
|
* @public
|
|
353
354
|
* @deprecated use import from `@backstage/plugin-scaffolder-backend-module-bitbucket-cloud` instead
|
|
354
355
|
*/
|
|
355
|
-
declare const createPublishBitbucketCloudAction: typeof
|
|
356
|
+
declare const createPublishBitbucketCloudAction: typeof createPublishBitbucketCloudAction$1;
|
|
356
357
|
/**
|
|
357
358
|
* @public
|
|
358
359
|
* @deprecated use import from `@backstage/plugin-scaffolder-backend-module-bitbucket-server` instead
|
|
359
360
|
*/
|
|
360
|
-
declare const createPublishBitbucketServerAction: typeof
|
|
361
|
+
declare const createPublishBitbucketServerAction: typeof createPublishBitbucketServerAction$1;
|
|
361
362
|
/**
|
|
362
363
|
* @public
|
|
363
364
|
* @deprecated use import from `@backstage/plugin-scaffolder-backend-module-bitbucket-server` instead
|
|
364
365
|
*/
|
|
365
|
-
declare const createPublishBitbucketServerPullRequestAction: typeof
|
|
366
|
+
declare const createPublishBitbucketServerPullRequestAction: typeof createPublishBitbucketServerPullRequestAction$1;
|
|
366
367
|
/**
|
|
367
368
|
* @public
|
|
368
369
|
* @deprecated use import from `@backstage/plugin-scaffolder-backend-module-azure` instead
|
|
369
370
|
*/
|
|
370
|
-
declare const createPublishAzureAction: typeof
|
|
371
|
+
declare const createPublishAzureAction: typeof createPublishAzureAction$1;
|
|
371
372
|
/**
|
|
372
373
|
* @public
|
|
373
374
|
* @deprecated use import from `@backstage/plugin-scaffolder-backend-module-gerrit` instead
|
|
374
375
|
*/
|
|
375
|
-
declare const createPublishGerritAction: typeof
|
|
376
|
+
declare const createPublishGerritAction: typeof createPublishGerritAction$1;
|
|
376
377
|
/**
|
|
377
378
|
* @public
|
|
378
379
|
* @deprecated use import from `@backstage/plugin-scaffolder-backend-module-gerrit` instead
|
|
379
380
|
*/
|
|
380
|
-
declare const createPublishGerritReviewAction: typeof
|
|
381
|
+
declare const createPublishGerritReviewAction: typeof createPublishGerritReviewAction$1;
|
|
381
382
|
/**
|
|
382
383
|
* @public
|
|
383
384
|
* @deprecated use import from `@backstage/plugin-scaffolder-backend-module-gitlab` instead
|
|
384
385
|
*/
|
|
385
|
-
declare const createPublishGitlabAction: typeof
|
|
386
|
+
declare const createPublishGitlabAction: typeof createPublishGitlabAction$1;
|
|
386
387
|
/**
|
|
387
388
|
* @public
|
|
388
389
|
* @deprecated use import from `@backstage/plugin-scaffolder-backend-module-gitlab` instead
|
|
@@ -403,6 +404,7 @@ declare const createPublishGitlabMergeRequestAction: (options: {
|
|
|
403
404
|
removeSourceBranch?: boolean | undefined;
|
|
404
405
|
assignee?: string | undefined;
|
|
405
406
|
reviewers?: string[] | undefined;
|
|
407
|
+
assignReviewersFromApprovalRules?: boolean | undefined;
|
|
406
408
|
}, _backstage_types.JsonObject>;
|
|
407
409
|
|
|
408
410
|
/**
|
|
@@ -831,6 +833,7 @@ type CreateWorkerOptions = {
|
|
|
831
833
|
concurrentTasksLimit?: number;
|
|
832
834
|
additionalTemplateGlobals?: Record<string, TemplateGlobal$1>;
|
|
833
835
|
permissions?: PermissionEvaluator;
|
|
836
|
+
gracefulShutdown?: boolean;
|
|
834
837
|
};
|
|
835
838
|
/**
|
|
836
839
|
* TaskWorker
|
|
@@ -847,7 +850,7 @@ declare class TaskWorker {
|
|
|
847
850
|
static create(options: CreateWorkerOptions): Promise<TaskWorker>;
|
|
848
851
|
recoverTasks(): Promise<void>;
|
|
849
852
|
start(): void;
|
|
850
|
-
stop(): void
|
|
853
|
+
stop(): Promise<void>;
|
|
851
854
|
protected onReadyToClaimTask(): Promise<void>;
|
|
852
855
|
runOneTask(task: TaskContext$1): Promise<void>;
|
|
853
856
|
}
|
|
@@ -888,8 +891,8 @@ interface RouterOptions {
|
|
|
888
891
|
*/
|
|
889
892
|
concurrentTasksLimit?: number;
|
|
890
893
|
taskBroker?: TaskBroker$1;
|
|
891
|
-
additionalTemplateFilters?: Record<string, TemplateFilter$1
|
|
892
|
-
additionalTemplateGlobals?: Record<string, TemplateGlobal$1
|
|
894
|
+
additionalTemplateFilters?: Record<string, TemplateFilter$1> | CreatedTemplateFilter[];
|
|
895
|
+
additionalTemplateGlobals?: Record<string, TemplateGlobal$1> | CreatedTemplateGlobal[];
|
|
893
896
|
additionalWorkspaceProviders?: Record<string, WorkspaceProvider>;
|
|
894
897
|
permissions?: PermissionsService;
|
|
895
898
|
permissionRules?: Array<TemplatePermissionRuleInput | ActionPermissionRuleInput>;
|
|
@@ -136,7 +136,8 @@ class SecureTemplater {
|
|
|
136
136
|
if (!Object.hasOwn(templateFilters, filterName)) {
|
|
137
137
|
return "";
|
|
138
138
|
}
|
|
139
|
-
const
|
|
139
|
+
const [input, ...rest] = args;
|
|
140
|
+
const rz = templateFilters[filterName](input, ...rest);
|
|
140
141
|
return rz === void 0 ? "" : JSON.stringify(rz);
|
|
141
142
|
}
|
|
142
143
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecureTemplater.cjs.js","sources":["../../../src/lib/templating/SecureTemplater.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { Isolate } from 'isolated-vm';\nimport { resolvePackagePath } from '@backstage/backend-plugin-api';\nimport {\n TemplateFilter as _TemplateFilter,\n TemplateGlobal as _TemplateGlobal,\n} from '@backstage/plugin-scaffolder-node';\nimport fs from 'fs-extra';\nimport { JsonValue } from '@backstage/types';\nimport { getMajorNodeVersion, isNoNodeSnapshotOptionProvided } from './helpers';\n\n// language=JavaScript\nconst mkScript = (nunjucksSource: string) => `\nconst { render, renderCompat } = (() => {\n const module = {};\n const process = { env: {} };\n const require = (pkg) => { if (pkg === 'events') { return function (){}; }};\n\n ${nunjucksSource}\n\n const env = module.exports.configure({\n autoescape: false,\n ...JSON.parse(nunjucksConfigs),\n tags: {\n variableStart: '\\${{',\n variableEnd: '}}',\n },\n });\n\n const compatEnv = module.exports.configure({\n autoescape: false,\n ...JSON.parse(nunjucksConfigs),\n tags: {\n variableStart: '{{',\n variableEnd: '}}',\n },\n });\n compatEnv.addFilter('jsonify', compatEnv.getFilter('dump'));\n\n const handleFunctionResult = (value) => {\n return value === '' ? undefined : JSON.parse(value);\n };\n for (const name of JSON.parse(availableTemplateFilters)) {\n env.addFilter(name, (...args) => handleFunctionResult(callFilter(name, args)));\n }\n for (const [name, value] of Object.entries(JSON.parse(availableTemplateGlobals))) {\n env.addGlobal(name, value);\n }\n for (const name of JSON.parse(availableTemplateCallbacks)) {\n env.addGlobal(name, (...args) => handleFunctionResult(callGlobal(name, args)));\n }\n\n let uninstallCompat = undefined;\n\n function render(str, values) {\n try {\n if (uninstallCompat) {\n uninstallCompat();\n uninstallCompat = undefined;\n }\n return env.renderString(str, JSON.parse(values));\n } catch (error) {\n // Make sure errors don't leak anything\n throw new Error(String(error.message));\n }\n }\n\n function renderCompat(str, values) {\n try {\n if (!uninstallCompat) {\n uninstallCompat = module.exports.installJinjaCompat();\n }\n return compatEnv.renderString(str, JSON.parse(values));\n } catch (error) {\n // Make sure errors don't leak anything\n throw new Error(String(error.message));\n }\n }\n\n return { render, renderCompat };\n})();\n`;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-scaffolder-node` instead.\n */\nexport type TemplateFilter = _TemplateFilter;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-scaffolder-node` instead.\n */\nexport type TemplateGlobal = _TemplateGlobal;\n\ninterface SecureTemplaterOptions {\n /* Enables jinja compatibility and the \"jsonify\" filter */\n cookiecutterCompat?: boolean;\n /* Extra user-provided nunjucks filters */\n templateFilters?: Record<string, TemplateFilter>;\n /* Extra user-provided nunjucks globals */\n templateGlobals?: Record<string, TemplateGlobal>;\n nunjucksConfigs?: { trimBlocks?: boolean; lstripBlocks?: boolean };\n}\n\nexport type SecureTemplateRenderer = (\n template: string,\n values: unknown,\n) => string;\n\nexport class SecureTemplater {\n static async loadRenderer(options: SecureTemplaterOptions = {}) {\n const {\n cookiecutterCompat,\n templateFilters = {},\n templateGlobals = {},\n nunjucksConfigs = {},\n } = options;\n\n const nodeVersion = getMajorNodeVersion();\n if (nodeVersion >= 20 && !isNoNodeSnapshotOptionProvided()) {\n throw new Error(\n `When using Node.js version 20 or newer, the scaffolder backend plugin requires that it be started with the --no-node-snapshot option. \n Please make sure that you have NODE_OPTIONS=--no-node-snapshot in your environment.`,\n );\n }\n\n const isolate = new Isolate({ memoryLimit: 128 });\n const context = await isolate.createContext();\n const contextGlobal = context.global;\n\n const nunjucksSource = await fs.readFile(\n resolvePackagePath(\n '@backstage/plugin-scaffolder-backend',\n 'assets/nunjucks.js.txt',\n ),\n 'utf-8',\n );\n\n const nunjucksScript = await isolate.compileScript(\n mkScript(nunjucksSource),\n );\n\n await contextGlobal.set('nunjucksConfigs', JSON.stringify(nunjucksConfigs));\n\n const availableFilters = Object.keys(templateFilters);\n\n await contextGlobal.set(\n 'availableTemplateFilters',\n JSON.stringify(availableFilters),\n );\n\n const globalCallbacks = [];\n const globalValues: Record<string, unknown> = {};\n for (const [name, value] of Object.entries(templateGlobals)) {\n if (typeof value === 'function') {\n globalCallbacks.push(name);\n } else {\n globalValues[name] = value;\n }\n }\n\n await contextGlobal.set(\n 'availableTemplateGlobals',\n JSON.stringify(globalValues),\n );\n await contextGlobal.set(\n 'availableTemplateCallbacks',\n JSON.stringify(globalCallbacks),\n );\n\n await contextGlobal.set(\n 'callFilter',\n (filterName: string, args: JsonValue[]) => {\n if (!Object.hasOwn(templateFilters, filterName)) {\n return '';\n }\n const rz = templateFilters[filterName](...args);\n return rz === undefined ? '' : JSON.stringify(rz);\n },\n );\n\n await contextGlobal.set(\n 'callGlobal',\n (globalName: string, args: JsonValue[]) => {\n if (!Object.hasOwn(templateGlobals, globalName)) {\n return '';\n }\n const global = templateGlobals[globalName];\n if (typeof global !== 'function') {\n return '';\n }\n const rz = global(...args);\n return rz === undefined ? '' : JSON.stringify(rz);\n },\n );\n\n await nunjucksScript.run(context);\n\n const render: SecureTemplateRenderer = (template, values) => {\n if (!context) {\n throw new Error('SecureTemplater has not been initialized');\n }\n\n contextGlobal.setSync('templateStr', String(template));\n contextGlobal.setSync('templateValues', JSON.stringify(values));\n\n if (cookiecutterCompat) {\n return context.evalSync(`renderCompat(templateStr, templateValues)`);\n }\n\n return context.evalSync(`render(templateStr, templateValues)`);\n };\n return render;\n }\n}\n"],"names":["getMajorNodeVersion","isNoNodeSnapshotOptionProvided","Isolate","fs","resolvePackagePath"],"mappings":";;;;;;;;;;;AA2BA,MAAM,QAAA,GAAW,CAAC,cAA2B,KAAA;AAAA;AAAA;AAAA;AAAA;;AAAA,EAAA,EAMzC,cAAc;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA,CAAA;AA4FX,MAAM,eAAgB,CAAA;AAAA,EAC3B,aAAa,YAAA,CAAa,OAAkC,GAAA,EAAI,EAAA;AAC9D,IAAM,MAAA;AAAA,MACJ,kBAAA;AAAA,MACA,kBAAkB,EAAC;AAAA,MACnB,kBAAkB,EAAC;AAAA,MACnB,kBAAkB;AAAC,KACjB,GAAA,OAAA;AAEJ,IAAA,MAAM,cAAcA,2BAAoB,EAAA;AACxC,IAAA,IAAI,WAAe,IAAA,EAAA,IAAM,CAACC,sCAAA,EAAkC,EAAA;AAC1D,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA;AAAA,2FAAA;AAAA,OAEF;AAAA;AAGF,IAAA,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D,MAAA,IAAI,kBAAoB,EAAA;AACtB,QAAO,OAAA,OAAA,CAAQ,SAAS,CAA2C,yCAAA,CAAA,CAAA;AAAA;AAGrE,MAAO,OAAA,OAAA,CAAQ,SAAS,CAAqC,mCAAA,CAAA,CAAA;AAAA,KAC/D;AACA,IAAO,OAAA,MAAA;AAAA;AAEX;;;;"}
|
|
1
|
+
{"version":3,"file":"SecureTemplater.cjs.js","sources":["../../../src/lib/templating/SecureTemplater.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { Isolate } from 'isolated-vm';\nimport { resolvePackagePath } from '@backstage/backend-plugin-api';\nimport {\n TemplateFilter as _TemplateFilter,\n TemplateGlobal as _TemplateGlobal,\n} from '@backstage/plugin-scaffolder-node';\nimport fs from 'fs-extra';\nimport { JsonValue } from '@backstage/types';\nimport { getMajorNodeVersion, isNoNodeSnapshotOptionProvided } from './helpers';\n\n// language=JavaScript\nconst mkScript = (nunjucksSource: string) => `\nconst { render, renderCompat } = (() => {\n const module = {};\n const process = { env: {} };\n const require = (pkg) => { if (pkg === 'events') { return function (){}; }};\n\n ${nunjucksSource}\n\n const env = module.exports.configure({\n autoescape: false,\n ...JSON.parse(nunjucksConfigs),\n tags: {\n variableStart: '\\${{',\n variableEnd: '}}',\n },\n });\n\n const compatEnv = module.exports.configure({\n autoescape: false,\n ...JSON.parse(nunjucksConfigs),\n tags: {\n variableStart: '{{',\n variableEnd: '}}',\n },\n });\n compatEnv.addFilter('jsonify', compatEnv.getFilter('dump'));\n\n const handleFunctionResult = (value) => {\n return value === '' ? undefined : JSON.parse(value);\n };\n for (const name of JSON.parse(availableTemplateFilters)) {\n env.addFilter(name, (...args) => handleFunctionResult(callFilter(name, args)));\n }\n for (const [name, value] of Object.entries(JSON.parse(availableTemplateGlobals))) {\n env.addGlobal(name, value);\n }\n for (const name of JSON.parse(availableTemplateCallbacks)) {\n env.addGlobal(name, (...args) => handleFunctionResult(callGlobal(name, args)));\n }\n\n let uninstallCompat = undefined;\n\n function render(str, values) {\n try {\n if (uninstallCompat) {\n uninstallCompat();\n uninstallCompat = undefined;\n }\n return env.renderString(str, JSON.parse(values));\n } catch (error) {\n // Make sure errors don't leak anything\n throw new Error(String(error.message));\n }\n }\n\n function renderCompat(str, values) {\n try {\n if (!uninstallCompat) {\n uninstallCompat = module.exports.installJinjaCompat();\n }\n return compatEnv.renderString(str, JSON.parse(values));\n } catch (error) {\n // Make sure errors don't leak anything\n throw new Error(String(error.message));\n }\n }\n\n return { render, renderCompat };\n})();\n`;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-scaffolder-node` instead.\n */\nexport type TemplateFilter = _TemplateFilter;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-scaffolder-node` instead.\n */\nexport type TemplateGlobal = _TemplateGlobal;\n\ninterface SecureTemplaterOptions {\n /* Enables jinja compatibility and the \"jsonify\" filter */\n cookiecutterCompat?: boolean;\n /* Extra user-provided nunjucks filters */\n templateFilters?: Record<string, TemplateFilter>;\n /* Extra user-provided nunjucks globals */\n templateGlobals?: Record<string, TemplateGlobal>;\n nunjucksConfigs?: { trimBlocks?: boolean; lstripBlocks?: boolean };\n}\n\nexport type SecureTemplateRenderer = (\n template: string,\n values: unknown,\n) => string;\n\nexport class SecureTemplater {\n static async loadRenderer(options: SecureTemplaterOptions = {}) {\n const {\n cookiecutterCompat,\n templateFilters = {},\n templateGlobals = {},\n nunjucksConfigs = {},\n } = options;\n\n const nodeVersion = getMajorNodeVersion();\n if (nodeVersion >= 20 && !isNoNodeSnapshotOptionProvided()) {\n throw new Error(\n `When using Node.js version 20 or newer, the scaffolder backend plugin requires that it be started with the --no-node-snapshot option. \n Please make sure that you have NODE_OPTIONS=--no-node-snapshot in your environment.`,\n );\n }\n\n const isolate = new Isolate({ memoryLimit: 128 });\n const context = await isolate.createContext();\n const contextGlobal = context.global;\n\n const nunjucksSource = await fs.readFile(\n resolvePackagePath(\n '@backstage/plugin-scaffolder-backend',\n 'assets/nunjucks.js.txt',\n ),\n 'utf-8',\n );\n\n const nunjucksScript = await isolate.compileScript(\n mkScript(nunjucksSource),\n );\n\n await contextGlobal.set('nunjucksConfigs', JSON.stringify(nunjucksConfigs));\n\n const availableFilters = Object.keys(templateFilters);\n\n await contextGlobal.set(\n 'availableTemplateFilters',\n JSON.stringify(availableFilters),\n );\n\n const globalCallbacks = [];\n const globalValues: Record<string, unknown> = {};\n for (const [name, value] of Object.entries(templateGlobals)) {\n if (typeof value === 'function') {\n globalCallbacks.push(name);\n } else {\n globalValues[name] = value;\n }\n }\n\n await contextGlobal.set(\n 'availableTemplateGlobals',\n JSON.stringify(globalValues),\n );\n await contextGlobal.set(\n 'availableTemplateCallbacks',\n JSON.stringify(globalCallbacks),\n );\n\n await contextGlobal.set(\n 'callFilter',\n (filterName: string, args: JsonValue[]) => {\n if (!Object.hasOwn(templateFilters, filterName)) {\n return '';\n }\n const [input, ...rest] = args;\n const rz = templateFilters[filterName](input, ...rest);\n return rz === undefined ? '' : JSON.stringify(rz);\n },\n );\n\n await contextGlobal.set(\n 'callGlobal',\n (globalName: string, args: JsonValue[]) => {\n if (!Object.hasOwn(templateGlobals, globalName)) {\n return '';\n }\n const global = templateGlobals[globalName];\n if (typeof global !== 'function') {\n return '';\n }\n const rz = global(...args);\n return rz === undefined ? '' : JSON.stringify(rz);\n },\n );\n\n await nunjucksScript.run(context);\n\n const render: SecureTemplateRenderer = (template, values) => {\n if (!context) {\n throw new Error('SecureTemplater has not been initialized');\n }\n\n contextGlobal.setSync('templateStr', String(template));\n contextGlobal.setSync('templateValues', JSON.stringify(values));\n\n if (cookiecutterCompat) {\n return context.evalSync(`renderCompat(templateStr, templateValues)`);\n }\n\n return context.evalSync(`render(templateStr, templateValues)`);\n };\n return render;\n }\n}\n"],"names":["getMajorNodeVersion","isNoNodeSnapshotOptionProvided","Isolate","fs","resolvePackagePath"],"mappings":";;;;;;;;;;;AA2BA,MAAM,QAAA,GAAW,CAAC,cAA2B,KAAA;AAAA;AAAA;AAAA;AAAA;;AAAA,EAAA,EAMzC,cAAc;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA,CAAA;AA4FX,MAAM,eAAgB,CAAA;AAAA,EAC3B,aAAa,YAAA,CAAa,OAAkC,GAAA,EAAI,EAAA;AAC9D,IAAM,MAAA;AAAA,MACJ,kBAAA;AAAA,MACA,kBAAkB,EAAC;AAAA,MACnB,kBAAkB,EAAC;AAAA,MACnB,kBAAkB;AAAC,KACjB,GAAA,OAAA;AAEJ,IAAA,MAAM,cAAcA,2BAAoB,EAAA;AACxC,IAAA,IAAI,WAAe,IAAA,EAAA,IAAM,CAACC,sCAAA,EAAkC,EAAA;AAC1D,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA;AAAA,2FAAA;AAAA,OAEF;AAAA;AAGF,IAAA,MAAM,UAAU,IAAIC,kBAAA,CAAQ,EAAE,WAAA,EAAa,KAAK,CAAA;AAChD,IAAM,MAAA,OAAA,GAAU,MAAM,OAAA,CAAQ,aAAc,EAAA;AAC5C,IAAA,MAAM,gBAAgB,OAAQ,CAA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AAAA;AAGrE,MAAO,OAAA,OAAA,CAAQ,SAAS,CAAqC,mCAAA,CAAA,CAAA;AAAA,KAC/D;AACA,IAAO,OAAA,MAAA;AAAA;AAEX;;;;"}
|
|
@@ -13,13 +13,13 @@ var templateFile = require('./fetch/templateFile.cjs.js');
|
|
|
13
13
|
var _delete = require('./filesystem/delete.cjs.js');
|
|
14
14
|
var rename = require('./filesystem/rename.cjs.js');
|
|
15
15
|
var read = require('./filesystem/read.cjs.js');
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
16
|
+
var pluginScaffolderBackendModuleGithub = require('@backstage/plugin-scaffolder-backend-module-github');
|
|
17
|
+
var pluginScaffolderBackendModuleAzure = require('@backstage/plugin-scaffolder-backend-module-azure');
|
|
18
|
+
var pluginScaffolderBackendModuleBitbucket = require('@backstage/plugin-scaffolder-backend-module-bitbucket');
|
|
19
|
+
var pluginScaffolderBackendModuleBitbucketCloud = require('@backstage/plugin-scaffolder-backend-module-bitbucket-cloud');
|
|
20
|
+
var pluginScaffolderBackendModuleBitbucketServer = require('@backstage/plugin-scaffolder-backend-module-bitbucket-server');
|
|
21
|
+
var pluginScaffolderBackendModuleGerrit = require('@backstage/plugin-scaffolder-backend-module-gerrit');
|
|
22
|
+
var pluginScaffolderBackendModuleGitlab = require('@backstage/plugin-scaffolder-backend-module-gitlab');
|
|
23
23
|
var pluginScaffolderBackendModuleGitea = require('@backstage/plugin-scaffolder-backend-module-gitea');
|
|
24
24
|
|
|
25
25
|
const createBuiltinActions = (options) => {
|
|
@@ -54,11 +54,11 @@ const createBuiltinActions = (options) => {
|
|
|
54
54
|
additionalTemplateFilters,
|
|
55
55
|
additionalTemplateGlobals
|
|
56
56
|
}),
|
|
57
|
-
|
|
57
|
+
pluginScaffolderBackendModuleGerrit.createPublishGerritAction({
|
|
58
58
|
integrations,
|
|
59
59
|
config
|
|
60
60
|
}),
|
|
61
|
-
|
|
61
|
+
pluginScaffolderBackendModuleGerrit.createPublishGerritReviewAction({
|
|
62
62
|
integrations,
|
|
63
63
|
config
|
|
64
64
|
}),
|
|
@@ -66,44 +66,44 @@ const createBuiltinActions = (options) => {
|
|
|
66
66
|
integrations,
|
|
67
67
|
config
|
|
68
68
|
}),
|
|
69
|
-
|
|
69
|
+
pluginScaffolderBackendModuleGithub.createPublishGithubAction({
|
|
70
70
|
integrations,
|
|
71
71
|
config,
|
|
72
72
|
githubCredentialsProvider
|
|
73
73
|
}),
|
|
74
|
-
|
|
74
|
+
pluginScaffolderBackendModuleGithub.createPublishGithubPullRequestAction({
|
|
75
75
|
integrations,
|
|
76
76
|
githubCredentialsProvider,
|
|
77
77
|
config
|
|
78
78
|
}),
|
|
79
|
-
|
|
79
|
+
pluginScaffolderBackendModuleGitlab.createPublishGitlabAction({
|
|
80
80
|
integrations,
|
|
81
81
|
config
|
|
82
82
|
}),
|
|
83
|
-
|
|
83
|
+
pluginScaffolderBackendModuleGitlab.createPublishGitlabMergeRequestAction({
|
|
84
84
|
integrations
|
|
85
85
|
}),
|
|
86
|
-
|
|
86
|
+
pluginScaffolderBackendModuleGitlab.createGitlabRepoPushAction({
|
|
87
87
|
integrations
|
|
88
88
|
}),
|
|
89
|
-
|
|
89
|
+
pluginScaffolderBackendModuleBitbucket.createPublishBitbucketAction({
|
|
90
90
|
integrations,
|
|
91
91
|
config
|
|
92
92
|
}),
|
|
93
|
-
|
|
93
|
+
pluginScaffolderBackendModuleBitbucketCloud.createPublishBitbucketCloudAction({
|
|
94
94
|
integrations,
|
|
95
95
|
config
|
|
96
96
|
}),
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
pluginScaffolderBackendModuleBitbucketCloud.createPublishBitbucketCloudPullRequestAction({ integrations, config }),
|
|
98
|
+
pluginScaffolderBackendModuleBitbucketServer.createPublishBitbucketServerAction({
|
|
99
99
|
integrations,
|
|
100
100
|
config
|
|
101
101
|
}),
|
|
102
|
-
|
|
102
|
+
pluginScaffolderBackendModuleBitbucketServer.createPublishBitbucketServerPullRequestAction({
|
|
103
103
|
integrations,
|
|
104
104
|
config
|
|
105
105
|
}),
|
|
106
|
-
|
|
106
|
+
pluginScaffolderBackendModuleAzure.createPublishAzureAction({
|
|
107
107
|
integrations,
|
|
108
108
|
config
|
|
109
109
|
}),
|
|
@@ -115,39 +115,39 @@ const createBuiltinActions = (options) => {
|
|
|
115
115
|
_delete.createFilesystemDeleteAction(),
|
|
116
116
|
read.createFilesystemReadDirAction(),
|
|
117
117
|
rename.createFilesystemRenameAction(),
|
|
118
|
-
|
|
118
|
+
pluginScaffolderBackendModuleGithub.createGithubActionsDispatchAction({
|
|
119
119
|
integrations,
|
|
120
120
|
githubCredentialsProvider
|
|
121
121
|
}),
|
|
122
|
-
|
|
122
|
+
pluginScaffolderBackendModuleGithub.createGithubWebhookAction({
|
|
123
123
|
integrations,
|
|
124
124
|
githubCredentialsProvider
|
|
125
125
|
}),
|
|
126
|
-
|
|
126
|
+
pluginScaffolderBackendModuleGithub.createGithubIssuesLabelAction({
|
|
127
127
|
integrations,
|
|
128
128
|
githubCredentialsProvider
|
|
129
129
|
}),
|
|
130
|
-
|
|
130
|
+
pluginScaffolderBackendModuleGithub.createGithubRepoCreateAction({
|
|
131
131
|
integrations,
|
|
132
132
|
githubCredentialsProvider
|
|
133
133
|
}),
|
|
134
|
-
|
|
134
|
+
pluginScaffolderBackendModuleGithub.createGithubRepoPushAction({
|
|
135
135
|
integrations,
|
|
136
136
|
config,
|
|
137
137
|
githubCredentialsProvider
|
|
138
138
|
}),
|
|
139
|
-
|
|
139
|
+
pluginScaffolderBackendModuleGithub.createGithubEnvironmentAction({
|
|
140
140
|
integrations,
|
|
141
141
|
catalogClient
|
|
142
142
|
}),
|
|
143
|
-
|
|
143
|
+
pluginScaffolderBackendModuleGithub.createGithubDeployKeyAction({
|
|
144
144
|
integrations
|
|
145
145
|
}),
|
|
146
|
-
|
|
146
|
+
pluginScaffolderBackendModuleGithub.createGithubAutolinksAction({
|
|
147
147
|
integrations,
|
|
148
148
|
githubCredentialsProvider
|
|
149
149
|
}),
|
|
150
|
-
|
|
150
|
+
pluginScaffolderBackendModuleBitbucketCloud.createBitbucketPipelinesRunAction({
|
|
151
151
|
integrations
|
|
152
152
|
})
|
|
153
153
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createBuiltinActions.cjs.js","sources":["../../../../src/scaffolder/actions/builtin/createBuiltinActions.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { CatalogApi } from '@backstage/catalog-client';\nimport { Config } from '@backstage/config';\nimport {\n DefaultGithubCredentialsProvider,\n GithubCredentialsProvider,\n ScmIntegrations,\n} from '@backstage/integration';\nimport {\n TemplateAction,\n TemplateFilter,\n TemplateGlobal,\n} from '@backstage/plugin-scaffolder-node';\nimport {\n createCatalogRegisterAction,\n createCatalogWriteAction,\n createFetchCatalogEntityAction,\n} from './catalog';\n\nimport { createDebugLogAction, createWaitAction } from './debug';\nimport {\n createFetchPlainAction,\n createFetchPlainFileAction,\n createFetchTemplateAction,\n createFetchTemplateFileAction,\n} from './fetch';\nimport {\n createFilesystemDeleteAction,\n createFilesystemReadDirAction,\n createFilesystemRenameAction,\n} from './filesystem';\nimport {\n createGithubActionsDispatchAction,\n createGithubAutolinksAction,\n createGithubDeployKeyAction,\n createGithubEnvironmentAction,\n createGithubIssuesLabelAction,\n createGithubRepoCreateAction,\n createGithubRepoPushAction,\n createGithubWebhookAction,\n createPublishGithubAction,\n createPublishGithubPullRequestAction,\n} from '@backstage/plugin-scaffolder-backend-module-github';\n\nimport { createPublishAzureAction } from '@backstage/plugin-scaffolder-backend-module-azure';\n\nimport { createPublishBitbucketAction } from '@backstage/plugin-scaffolder-backend-module-bitbucket';\n\nimport {\n createPublishBitbucketCloudAction,\n createBitbucketPipelinesRunAction,\n createPublishBitbucketCloudPullRequestAction,\n} from '@backstage/plugin-scaffolder-backend-module-bitbucket-cloud';\n\nimport {\n createPublishBitbucketServerAction,\n createPublishBitbucketServerPullRequestAction,\n} from '@backstage/plugin-scaffolder-backend-module-bitbucket-server';\n\nimport {\n createPublishGerritAction,\n createPublishGerritReviewAction,\n} from '@backstage/plugin-scaffolder-backend-module-gerrit';\n\nimport {\n createPublishGitlabAction,\n createGitlabRepoPushAction,\n createPublishGitlabMergeRequestAction,\n} from '@backstage/plugin-scaffolder-backend-module-gitlab';\n\nimport { createPublishGiteaAction } from '@backstage/plugin-scaffolder-backend-module-gitea';\nimport { AuthService, UrlReaderService } from '@backstage/backend-plugin-api';\n\n/**\n * The options passed to {@link createBuiltinActions}\n * @public\n */\nexport interface CreateBuiltInActionsOptions {\n /**\n * The {@link @backstage/backend-plugin-api#UrlReaderService} interface that will be used in the default actions.\n */\n reader: UrlReaderService;\n /**\n * The {@link @backstage/integrations#ScmIntegrations} that will be used in the default actions.\n */\n integrations: ScmIntegrations;\n /**\n * The {@link @backstage/catalog-client#CatalogApi} that will be used in the default actions.\n */\n catalogClient: CatalogApi;\n /**\n * The {@link @backstage/backend-plugin-api#AuthService} that will be used in the default actions.\n */\n auth?: AuthService;\n /**\n * The {@link @backstage/config#Config} that will be used in the default actions.\n */\n config: Config;\n /**\n * Additional custom filters that will be passed to the nunjucks template engine for use in\n * Template Manifests and also template skeleton files when using `fetch:template`.\n */\n additionalTemplateFilters?: Record<string, TemplateFilter>;\n additionalTemplateGlobals?: Record<string, TemplateGlobal>;\n}\n\n/**\n * A function to generate create a list of default actions that the scaffolder provides.\n * Is called internally in the default setup, but can be used when adding your own actions or overriding the default ones\n *\n * TODO(blam): version 2 of the scaffolder shouldn't ship with the additional modules. We should ship the basics, and let people install\n * modules for the providers they want to use.\n * @public\n * @returns A list of actions that can be used in the scaffolder\n *\n */\nexport const createBuiltinActions = (\n options: CreateBuiltInActionsOptions,\n): TemplateAction[] => {\n const {\n reader,\n integrations,\n catalogClient,\n auth,\n config,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n } = options;\n\n const githubCredentialsProvider: GithubCredentialsProvider =\n DefaultGithubCredentialsProvider.fromIntegrations(integrations);\n\n const actions = [\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 createFetchTemplateFileAction({\n integrations,\n reader,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n }),\n createPublishGerritAction({\n integrations,\n config,\n }),\n createPublishGerritReviewAction({\n integrations,\n config,\n }),\n createPublishGiteaAction({\n integrations,\n config,\n }),\n createPublishGithubAction({\n integrations,\n config,\n githubCredentialsProvider,\n }),\n createPublishGithubPullRequestAction({\n integrations,\n githubCredentialsProvider,\n config,\n }),\n createPublishGitlabAction({\n integrations,\n config,\n }),\n createPublishGitlabMergeRequestAction({\n integrations,\n }),\n createGitlabRepoPushAction({\n integrations,\n }),\n createPublishBitbucketAction({\n integrations,\n config,\n }),\n createPublishBitbucketCloudAction({\n integrations,\n config,\n }),\n createPublishBitbucketCloudPullRequestAction({ integrations, config }),\n createPublishBitbucketServerAction({\n integrations,\n config,\n }),\n createPublishBitbucketServerPullRequestAction({\n integrations,\n config,\n }),\n createPublishAzureAction({\n integrations,\n config,\n }),\n createDebugLogAction(),\n createWaitAction(),\n createCatalogRegisterAction({ catalogClient, integrations, auth }),\n createFetchCatalogEntityAction({ catalogClient, auth }),\n createCatalogWriteAction(),\n createFilesystemDeleteAction(),\n createFilesystemReadDirAction(),\n createFilesystemRenameAction(),\n createGithubActionsDispatchAction({\n integrations,\n githubCredentialsProvider,\n }),\n createGithubWebhookAction({\n integrations,\n githubCredentialsProvider,\n }),\n createGithubIssuesLabelAction({\n integrations,\n githubCredentialsProvider,\n }),\n createGithubRepoCreateAction({\n integrations,\n githubCredentialsProvider,\n }),\n createGithubRepoPushAction({\n integrations,\n config,\n githubCredentialsProvider,\n }),\n createGithubEnvironmentAction({\n integrations,\n catalogClient,\n }),\n createGithubDeployKeyAction({\n integrations,\n }),\n createGithubAutolinksAction({\n integrations,\n githubCredentialsProvider,\n }),\n createBitbucketPipelinesRunAction({\n integrations,\n }),\n ];\n\n return actions as TemplateAction[];\n};\n"],"names":["DefaultGithubCredentialsProvider","createFetchPlainAction","createFetchPlainFileAction","createFetchTemplateAction","createFetchTemplateFileAction","createPublishGerritAction","createPublishGerritReviewAction","createPublishGiteaAction","createPublishGithubAction","createPublishGithubPullRequestAction","createPublishGitlabAction","createPublishGitlabMergeRequestAction","createGitlabRepoPushAction","createPublishBitbucketAction","createPublishBitbucketCloudAction","createPublishBitbucketCloudPullRequestAction","createPublishBitbucketServerAction","createPublishBitbucketServerPullRequestAction","createPublishAzureAction","createDebugLogAction","createWaitAction","createCatalogRegisterAction","createFetchCatalogEntityAction","createCatalogWriteAction","createFilesystemDeleteAction","createFilesystemReadDirAction","createFilesystemRenameAction","createGithubActionsDispatchAction","createGithubWebhookAction","createGithubIssuesLabelAction","createGithubRepoCreateAction","createGithubRepoPushAction","createGithubEnvironmentAction","createGithubDeployKeyAction","createGithubAutolinksAction","createBitbucketPipelinesRunAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAmIa,MAAA,oBAAA,GAAuB,CAClC,OACqB,KAAA;AACrB,EAAM,MAAA;AAAA,IACJ,MAAA;AAAA,IACA,YAAA;AAAA,IACA,aAAA;AAAA,IACA,IAAA;AAAA,IACA,MAAA;AAAA,IACA,yBAAA;AAAA,IACA;AAAA,GACE,GAAA,OAAA;AAEJ,EAAM,MAAA,yBAAA,GAC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s.js","sources":["../../../../src/scaffolder/actions/builtin/createBuiltinActions.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { CatalogApi } from '@backstage/catalog-client';\nimport { Config } from '@backstage/config';\nimport {\n DefaultGithubCredentialsProvider,\n GithubCredentialsProvider,\n ScmIntegrations,\n} from '@backstage/integration';\nimport {\n TemplateAction,\n TemplateFilter,\n TemplateGlobal,\n} from '@backstage/plugin-scaffolder-node';\nimport {\n createCatalogRegisterAction,\n createCatalogWriteAction,\n createFetchCatalogEntityAction,\n} from './catalog';\n\nimport { createDebugLogAction, createWaitAction } from './debug';\nimport {\n createFetchPlainAction,\n createFetchPlainFileAction,\n createFetchTemplateAction,\n createFetchTemplateFileAction,\n} from './fetch';\nimport {\n createFilesystemDeleteAction,\n createFilesystemReadDirAction,\n createFilesystemRenameAction,\n} from './filesystem';\nimport {\n createGithubActionsDispatchAction,\n createGithubAutolinksAction,\n createGithubDeployKeyAction,\n createGithubEnvironmentAction,\n createGithubIssuesLabelAction,\n createGithubRepoCreateAction,\n createGithubRepoPushAction,\n createGithubWebhookAction,\n createPublishGithubAction,\n createPublishGithubPullRequestAction,\n} from '@backstage/plugin-scaffolder-backend-module-github';\n\nimport { createPublishAzureAction } from '@backstage/plugin-scaffolder-backend-module-azure';\n\nimport { createPublishBitbucketAction } from '@backstage/plugin-scaffolder-backend-module-bitbucket';\n\nimport {\n createPublishBitbucketCloudAction,\n createBitbucketPipelinesRunAction,\n createPublishBitbucketCloudPullRequestAction,\n} from '@backstage/plugin-scaffolder-backend-module-bitbucket-cloud';\n\nimport {\n createPublishBitbucketServerAction,\n createPublishBitbucketServerPullRequestAction,\n} from '@backstage/plugin-scaffolder-backend-module-bitbucket-server';\n\nimport {\n createPublishGerritAction,\n createPublishGerritReviewAction,\n} from '@backstage/plugin-scaffolder-backend-module-gerrit';\n\nimport {\n createPublishGitlabAction,\n createGitlabRepoPushAction,\n createPublishGitlabMergeRequestAction,\n} from '@backstage/plugin-scaffolder-backend-module-gitlab';\n\nimport { createPublishGiteaAction } from '@backstage/plugin-scaffolder-backend-module-gitea';\nimport { AuthService, UrlReaderService } from '@backstage/backend-plugin-api';\n\n/**\n * The options passed to {@link createBuiltinActions}\n * @public\n */\nexport interface CreateBuiltInActionsOptions {\n /**\n * The {@link @backstage/backend-plugin-api#UrlReaderService} interface that will be used in the default actions.\n */\n reader: UrlReaderService;\n /**\n * The {@link @backstage/integrations#ScmIntegrations} that will be used in the default actions.\n */\n integrations: ScmIntegrations;\n /**\n * The {@link @backstage/catalog-client#CatalogApi} that will be used in the default actions.\n */\n catalogClient: CatalogApi;\n /**\n * The {@link @backstage/backend-plugin-api#AuthService} that will be used in the default actions.\n */\n auth?: AuthService;\n /**\n * The {@link @backstage/config#Config} that will be used in the default actions.\n */\n config: Config;\n /**\n * Additional custom filters that will be passed to the nunjucks template engine for use in\n * Template Manifests and also template skeleton files when using `fetch:template`.\n */\n additionalTemplateFilters?: Record<string, TemplateFilter>;\n additionalTemplateGlobals?: Record<string, TemplateGlobal>;\n}\n\n/**\n * A function to generate create a list of default actions that the scaffolder provides.\n * Is called internally in the default setup, but can be used when adding your own actions or overriding the default ones\n *\n * TODO(blam): version 2 of the scaffolder shouldn't ship with the additional modules. We should ship the basics, and let people install\n * modules for the providers they want to use.\n * @public\n * @returns A list of actions that can be used in the scaffolder\n *\n */\nexport const createBuiltinActions = (\n options: CreateBuiltInActionsOptions,\n): TemplateAction[] => {\n const {\n reader,\n integrations,\n catalogClient,\n auth,\n config,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n } = options;\n\n const githubCredentialsProvider: GithubCredentialsProvider =\n DefaultGithubCredentialsProvider.fromIntegrations(integrations);\n\n const actions = [\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 createFetchTemplateFileAction({\n integrations,\n reader,\n additionalTemplateFilters,\n additionalTemplateGlobals,\n }),\n createPublishGerritAction({\n integrations,\n config,\n }),\n createPublishGerritReviewAction({\n integrations,\n config,\n }),\n createPublishGiteaAction({\n integrations,\n config,\n }),\n createPublishGithubAction({\n integrations,\n config,\n githubCredentialsProvider,\n }),\n createPublishGithubPullRequestAction({\n integrations,\n githubCredentialsProvider,\n config,\n }),\n createPublishGitlabAction({\n integrations,\n config,\n }),\n createPublishGitlabMergeRequestAction({\n integrations,\n }),\n createGitlabRepoPushAction({\n integrations,\n }),\n createPublishBitbucketAction({\n integrations,\n config,\n }),\n createPublishBitbucketCloudAction({\n integrations,\n config,\n }),\n createPublishBitbucketCloudPullRequestAction({ integrations, config }),\n createPublishBitbucketServerAction({\n integrations,\n config,\n }),\n createPublishBitbucketServerPullRequestAction({\n integrations,\n config,\n }),\n createPublishAzureAction({\n integrations,\n config,\n }),\n createDebugLogAction(),\n createWaitAction(),\n createCatalogRegisterAction({ catalogClient, integrations, auth }),\n createFetchCatalogEntityAction({ catalogClient, auth }),\n createCatalogWriteAction(),\n createFilesystemDeleteAction(),\n createFilesystemReadDirAction(),\n createFilesystemRenameAction(),\n createGithubActionsDispatchAction({\n integrations,\n githubCredentialsProvider,\n }),\n createGithubWebhookAction({\n integrations,\n githubCredentialsProvider,\n }),\n createGithubIssuesLabelAction({\n integrations,\n githubCredentialsProvider,\n }),\n createGithubRepoCreateAction({\n integrations,\n githubCredentialsProvider,\n }),\n createGithubRepoPushAction({\n integrations,\n config,\n githubCredentialsProvider,\n }),\n createGithubEnvironmentAction({\n integrations,\n catalogClient,\n }),\n createGithubDeployKeyAction({\n integrations,\n }),\n createGithubAutolinksAction({\n integrations,\n githubCredentialsProvider,\n }),\n createBitbucketPipelinesRunAction({\n integrations,\n }),\n ];\n\n return actions as TemplateAction[];\n};\n"],"names":["DefaultGithubCredentialsProvider","createFetchPlainAction","createFetchPlainFileAction","createFetchTemplateAction","createFetchTemplateFileAction","createPublishGerritAction","createPublishGerritReviewAction","createPublishGiteaAction","createPublishGithubAction","createPublishGithubPullRequestAction","createPublishGitlabAction","createPublishGitlabMergeRequestAction","createGitlabRepoPushAction","createPublishBitbucketAction","createPublishBitbucketCloudAction","createPublishBitbucketCloudPullRequestAction","createPublishBitbucketServerAction","createPublishBitbucketServerPullRequestAction","createPublishAzureAction","createDebugLogAction","createWaitAction","createCatalogRegisterAction","createFetchCatalogEntityAction","createCatalogWriteAction","createFilesystemDeleteAction","createFilesystemReadDirAction","createFilesystemRenameAction","createGithubActionsDispatchAction","createGithubWebhookAction","createGithubIssuesLabelAction","createGithubRepoCreateAction","createGithubRepoPushAction","createGithubEnvironmentAction","createGithubDeployKeyAction","createGithubAutolinksAction","createBitbucketPipelinesRunAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAmIa,MAAA,oBAAA,GAAuB,CAClC,OACqB,KAAA;AACrB,EAAM,MAAA;AAAA,IACJ,MAAA;AAAA,IACA,YAAA;AAAA,IACA,aAAA;AAAA,IACA,IAAA;AAAA,IACA,MAAA;AAAA,IACA,yBAAA;AAAA,IACA;AAAA,GACE,GAAA,OAAA;AAEJ,EAAM,MAAA,yBAAA,GACJA,4CAAiC,CAAA,gBAAA,CAAiB,YAAY,CAAA;AAEhE,EAAA,MAAM,OAAU,GAAA;AAAA,IACdC,4BAAuB,CAAA;AAAA,MACrB,MAAA;AAAA,MACA;AAAA,KACD,CAAA;AAAA,IACDC,oCAA2B,CAAA;AAAA,MACzB,MAAA;AAAA,MACA;AAAA,KACD,CAAA;AAAA,IACDC,kCAA0B,CAAA;AAAA,MACxB,YA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