@backstage/plugin-scaffolder-backend 1.21.0-next.0 → 1.21.0-next.1
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 +36 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.cjs.js +1 -1
- package/dist/cjs/{router-842a762b.cjs.js → router-43c4dd8a.cjs.js} +49 -7
- package/dist/cjs/router-43c4dd8a.cjs.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +6 -0
- package/package.json +20 -20
- package/dist/cjs/router-842a762b.cjs.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-backend
|
|
2
2
|
|
|
3
|
+
## 1.21.0-next.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 78c100b: Support providing an overriding token for `fetch:template`, `fetch:plain` and `fetch:file` when interacting with upstream integrations
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 09f8b31: Simple typo fix in the fetch:template action example on the word 'skeleton'.
|
|
12
|
+
- f6792c6: Move the `NODE_OPTIONS` messaging for `--no-node-snapshot` to the `SecureTemplater` in order to get better messaging at runtime
|
|
13
|
+
- e1c479d: When using node 20+ the `scaffolder-backend` will now throw an error at startup if the `--no-node-snapshot` option was
|
|
14
|
+
not provided to node.
|
|
15
|
+
- e0e5afe: Add option to configure nunjucks with the `trimBlocks` and `lstripBlocks` options in the fetch:template action
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @backstage/plugin-scaffolder-backend-module-github@0.2.0-next.1
|
|
18
|
+
- @backstage/catalog-model@1.4.4-next.0
|
|
19
|
+
- @backstage/catalog-client@1.6.0-next.1
|
|
20
|
+
- @backstage/backend-plugin-api@0.6.10-next.1
|
|
21
|
+
- @backstage/backend-common@0.21.0-next.1
|
|
22
|
+
- @backstage/integration@1.9.0-next.0
|
|
23
|
+
- @backstage/plugin-scaffolder-node@0.3.0-next.1
|
|
24
|
+
- @backstage/backend-tasks@0.5.15-next.1
|
|
25
|
+
- @backstage/config@1.1.1
|
|
26
|
+
- @backstage/errors@1.2.3
|
|
27
|
+
- @backstage/types@1.1.1
|
|
28
|
+
- @backstage/plugin-auth-node@0.4.4-next.1
|
|
29
|
+
- @backstage/plugin-catalog-backend-module-scaffolder-entity-model@0.1.7-next.1
|
|
30
|
+
- @backstage/plugin-catalog-node@1.6.2-next.1
|
|
31
|
+
- @backstage/plugin-permission-common@0.7.12
|
|
32
|
+
- @backstage/plugin-permission-node@0.7.21-next.1
|
|
33
|
+
- @backstage/plugin-scaffolder-backend-module-azure@0.1.2-next.1
|
|
34
|
+
- @backstage/plugin-scaffolder-backend-module-bitbucket@0.1.2-next.1
|
|
35
|
+
- @backstage/plugin-scaffolder-backend-module-gerrit@0.1.2-next.1
|
|
36
|
+
- @backstage/plugin-scaffolder-backend-module-gitlab@0.2.13-next.1
|
|
37
|
+
- @backstage/plugin-scaffolder-common@1.5.0-next.1
|
|
38
|
+
|
|
3
39
|
## 1.21.0-next.0
|
|
4
40
|
|
|
5
41
|
### Minor Changes
|
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-43c4dd8a.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');
|
|
@@ -640,6 +640,11 @@ function createFetchPlainAction(options) {
|
|
|
640
640
|
title: "Target Path",
|
|
641
641
|
description: "Target path within the working directory to download the contents to.",
|
|
642
642
|
type: "string"
|
|
643
|
+
},
|
|
644
|
+
token: {
|
|
645
|
+
title: "Token",
|
|
646
|
+
description: "An optional token to use for authentication when reading the resources.",
|
|
647
|
+
type: "string"
|
|
643
648
|
}
|
|
644
649
|
}
|
|
645
650
|
}
|
|
@@ -655,7 +660,8 @@ function createFetchPlainAction(options) {
|
|
|
655
660
|
integrations,
|
|
656
661
|
baseUrl: (_b = ctx.templateInfo) == null ? void 0 : _b.baseUrl,
|
|
657
662
|
fetchUrl: ctx.input.url,
|
|
658
|
-
outputPath
|
|
663
|
+
outputPath,
|
|
664
|
+
token: ctx.input.token
|
|
659
665
|
});
|
|
660
666
|
}
|
|
661
667
|
});
|
|
@@ -700,6 +706,11 @@ function createFetchPlainFileAction(options) {
|
|
|
700
706
|
title: "Target Path",
|
|
701
707
|
description: "Target path within the working directory to download the file as.",
|
|
702
708
|
type: "string"
|
|
709
|
+
},
|
|
710
|
+
token: {
|
|
711
|
+
title: "Token",
|
|
712
|
+
description: "An optional token to use for authentication when reading the resources.",
|
|
713
|
+
type: "string"
|
|
703
714
|
}
|
|
704
715
|
}
|
|
705
716
|
}
|
|
@@ -717,12 +728,22 @@ function createFetchPlainFileAction(options) {
|
|
|
717
728
|
integrations,
|
|
718
729
|
baseUrl: (_a = ctx.templateInfo) == null ? void 0 : _a.baseUrl,
|
|
719
730
|
fetchUrl: ctx.input.url,
|
|
720
|
-
outputPath
|
|
731
|
+
outputPath,
|
|
732
|
+
token: ctx.input.token
|
|
721
733
|
});
|
|
722
734
|
}
|
|
723
735
|
});
|
|
724
736
|
}
|
|
725
737
|
|
|
738
|
+
function isNoNodeSnapshotOptionProvided() {
|
|
739
|
+
var _a;
|
|
740
|
+
return ((_a = process.env.NODE_OPTIONS) == null ? void 0 : _a.includes("--no-node-snapshot")) || process.argv.includes("--no-node-snapshot");
|
|
741
|
+
}
|
|
742
|
+
function getMajorNodeVersion() {
|
|
743
|
+
const version = process.versions.node;
|
|
744
|
+
return parseInt(version.split(".")[0], 10);
|
|
745
|
+
}
|
|
746
|
+
|
|
726
747
|
const mkScript = (nunjucksSource) => `
|
|
727
748
|
const { render, renderCompat } = (() => {
|
|
728
749
|
const module = {};
|
|
@@ -733,6 +754,7 @@ const { render, renderCompat } = (() => {
|
|
|
733
754
|
|
|
734
755
|
const env = module.exports.configure({
|
|
735
756
|
autoescape: false,
|
|
757
|
+
...JSON.parse(nunjucksConfigs),
|
|
736
758
|
tags: {
|
|
737
759
|
variableStart: '\${{',
|
|
738
760
|
variableEnd: '}}',
|
|
@@ -741,6 +763,7 @@ const { render, renderCompat } = (() => {
|
|
|
741
763
|
|
|
742
764
|
const compatEnv = module.exports.configure({
|
|
743
765
|
autoescape: false,
|
|
766
|
+
...JSON.parse(nunjucksConfigs),
|
|
744
767
|
tags: {
|
|
745
768
|
variableStart: '{{',
|
|
746
769
|
variableEnd: '}}',
|
|
@@ -793,8 +816,16 @@ class SecureTemplater {
|
|
|
793
816
|
const {
|
|
794
817
|
cookiecutterCompat,
|
|
795
818
|
templateFilters = {},
|
|
796
|
-
templateGlobals = {}
|
|
819
|
+
templateGlobals = {},
|
|
820
|
+
nunjucksConfigs = {}
|
|
797
821
|
} = options;
|
|
822
|
+
const nodeVersion = getMajorNodeVersion();
|
|
823
|
+
if (nodeVersion >= 20 && !isNoNodeSnapshotOptionProvided()) {
|
|
824
|
+
throw new Error(
|
|
825
|
+
`When using Node.js version 20 or newer, the scaffolder backend plugin requires that it be started with the --no-node-snapshot option.
|
|
826
|
+
Please make sure that you have NODE_OPTIONS=--no-node-snapshot in your environment.`
|
|
827
|
+
);
|
|
828
|
+
}
|
|
798
829
|
const isolate = new isolatedVm.Isolate({ memoryLimit: 128 });
|
|
799
830
|
const context = await isolate.createContext();
|
|
800
831
|
const contextGlobal = context.global;
|
|
@@ -808,6 +839,7 @@ class SecureTemplater {
|
|
|
808
839
|
const nunjucksScript = await isolate.compileScript(
|
|
809
840
|
mkScript(nunjucksSource)
|
|
810
841
|
);
|
|
842
|
+
await contextGlobal.set("nunjucksConfigs", JSON.stringify(nunjucksConfigs));
|
|
811
843
|
const availableFilters = Object.keys(templateFilters);
|
|
812
844
|
await contextGlobal.set(
|
|
813
845
|
"availableTemplateFilters",
|
|
@@ -884,7 +916,7 @@ const createDefaultFilters = ({
|
|
|
884
916
|
|
|
885
917
|
const examples$2 = [
|
|
886
918
|
{
|
|
887
|
-
description: "Downloads a
|
|
919
|
+
description: "Downloads a skeleton directory that lives alongside the template file and fill it out with values.",
|
|
888
920
|
example: yaml__default["default"].stringify({
|
|
889
921
|
steps: [
|
|
890
922
|
{
|
|
@@ -969,6 +1001,11 @@ function createFetchTemplateAction(options) {
|
|
|
969
1001
|
title: "Replace files",
|
|
970
1002
|
description: "If set, replace files in targetPath instead of skipping existing ones.",
|
|
971
1003
|
type: "boolean"
|
|
1004
|
+
},
|
|
1005
|
+
token: {
|
|
1006
|
+
title: "Token",
|
|
1007
|
+
description: "An optional token to use for authentication when reading the resources.",
|
|
1008
|
+
type: "string"
|
|
972
1009
|
}
|
|
973
1010
|
}
|
|
974
1011
|
}
|
|
@@ -1020,7 +1057,8 @@ function createFetchTemplateAction(options) {
|
|
|
1020
1057
|
integrations,
|
|
1021
1058
|
baseUrl: (_b = ctx.templateInfo) == null ? void 0 : _b.baseUrl,
|
|
1022
1059
|
fetchUrl: ctx.input.url,
|
|
1023
|
-
outputPath: templateDir
|
|
1060
|
+
outputPath: templateDir,
|
|
1061
|
+
token: ctx.input.token
|
|
1024
1062
|
});
|
|
1025
1063
|
ctx.logger.info("Listing files and directories in template");
|
|
1026
1064
|
const allEntriesInTemplate = await globby__default["default"](`**/*`, {
|
|
@@ -1053,7 +1091,11 @@ function createFetchTemplateAction(options) {
|
|
|
1053
1091
|
...defaultTemplateFilters,
|
|
1054
1092
|
...additionalTemplateFilters
|
|
1055
1093
|
},
|
|
1056
|
-
templateGlobals: additionalTemplateGlobals
|
|
1094
|
+
templateGlobals: additionalTemplateGlobals,
|
|
1095
|
+
nunjucksConfigs: {
|
|
1096
|
+
trimBlocks: ctx.input.trimBlocks,
|
|
1097
|
+
lstripBlocks: ctx.input.lstripBlocks
|
|
1098
|
+
}
|
|
1057
1099
|
});
|
|
1058
1100
|
for (const location of allEntriesInTemplate) {
|
|
1059
1101
|
let renderContents;
|
|
@@ -3340,4 +3382,4 @@ exports.createRouter = createRouter;
|
|
|
3340
3382
|
exports.createWaitAction = createWaitAction;
|
|
3341
3383
|
exports.scaffolderActionRules = scaffolderActionRules;
|
|
3342
3384
|
exports.scaffolderTemplateRules = scaffolderTemplateRules;
|
|
3343
|
-
//# sourceMappingURL=router-
|
|
3385
|
+
//# sourceMappingURL=router-43c4dd8a.cjs.js.map
|