@backstage/plugin-scaffolder-backend 1.22.6-next.2 → 1.22.6
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 +31 -0
- package/README.md +16 -14
- package/alpha/package.json +1 -1
- package/dist/alpha.cjs.js +1 -1
- package/dist/cjs/{router-DhoUgDz0.cjs.js → router-BKGs_U4O.cjs.js} +18 -16
- package/dist/cjs/router-BKGs_U4O.cjs.js.map +1 -0
- package/dist/index.cjs.js +2 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/package.json +24 -24
- package/dist/cjs/router-DhoUgDz0.cjs.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-backend
|
|
2
2
|
|
|
3
|
+
## 1.22.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 131e5cb: Fix broken links in README.
|
|
8
|
+
- 025641b: Fix issue with the log format not being respected when logging from actions
|
|
9
|
+
- d229dc4: Move path utilities from `backend-common` to the `backend-plugin-api` package.
|
|
10
|
+
- e4b50ab: Scaffolder workspace serialization
|
|
11
|
+
- 025641b: Redact `meta` fields too with the logger
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
- @backstage/plugin-scaffolder-common@1.5.2
|
|
14
|
+
- @backstage/plugin-catalog-node@1.12.0
|
|
15
|
+
- @backstage/plugin-scaffolder-backend-module-github@0.2.8
|
|
16
|
+
- @backstage/plugin-scaffolder-backend-module-gitea@0.1.8
|
|
17
|
+
- @backstage/plugin-scaffolder-backend-module-gitlab@0.4.0
|
|
18
|
+
- @backstage/catalog-model@1.5.0
|
|
19
|
+
- @backstage/backend-common@0.22.0
|
|
20
|
+
- @backstage/backend-plugin-api@0.6.18
|
|
21
|
+
- @backstage/plugin-scaffolder-node@0.4.4
|
|
22
|
+
- @backstage/backend-tasks@0.5.23
|
|
23
|
+
- @backstage/plugin-scaffolder-backend-module-bitbucket-server@0.1.8
|
|
24
|
+
- @backstage/plugin-auth-node@0.4.13
|
|
25
|
+
- @backstage/integration@1.11.0
|
|
26
|
+
- @backstage/catalog-client@1.6.5
|
|
27
|
+
- @backstage/plugin-catalog-backend-module-scaffolder-entity-model@0.1.16
|
|
28
|
+
- @backstage/plugin-permission-node@0.7.29
|
|
29
|
+
- @backstage/plugin-scaffolder-backend-module-azure@0.1.10
|
|
30
|
+
- @backstage/plugin-scaffolder-backend-module-bitbucket@0.2.8
|
|
31
|
+
- @backstage/plugin-scaffolder-backend-module-bitbucket-cloud@0.1.8
|
|
32
|
+
- @backstage/plugin-scaffolder-backend-module-gerrit@0.1.10
|
|
33
|
+
|
|
3
34
|
## 1.22.6-next.2
|
|
4
35
|
|
|
5
36
|
### 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-BKGs_U4O.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');
|
|
@@ -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');
|
|
@@ -286,7 +287,7 @@ function createCatalogWriteAction() {
|
|
|
286
287
|
const entityRef = (_a = ctx.templateInfo) == null ? void 0 : _a.entityRef;
|
|
287
288
|
const path = filePath != null ? filePath : "catalog-info.yaml";
|
|
288
289
|
await fs__default.default.writeFile(
|
|
289
|
-
|
|
290
|
+
backendPluginApi.resolveSafeChildPath(ctx.workspacePath, path),
|
|
290
291
|
yaml__namespace.stringify({
|
|
291
292
|
...entity,
|
|
292
293
|
metadata: {
|
|
@@ -684,7 +685,7 @@ function createFetchPlainAction(options) {
|
|
|
684
685
|
var _a, _b;
|
|
685
686
|
ctx.logger.info("Fetching plain content from remote URL");
|
|
686
687
|
const targetPath = (_a = ctx.input.targetPath) != null ? _a : "./";
|
|
687
|
-
const outputPath =
|
|
688
|
+
const outputPath = backendPluginApi.resolveSafeChildPath(ctx.workspacePath, targetPath);
|
|
688
689
|
await pluginScaffolderNode.fetchContents({
|
|
689
690
|
reader,
|
|
690
691
|
integrations,
|
|
@@ -749,7 +750,7 @@ function createFetchPlainFileAction(options) {
|
|
|
749
750
|
async handler(ctx) {
|
|
750
751
|
var _a;
|
|
751
752
|
ctx.logger.info("Fetching plain content from remote URL");
|
|
752
|
-
const outputPath =
|
|
753
|
+
const outputPath = backendPluginApi.resolveSafeChildPath(
|
|
753
754
|
ctx.workspacePath,
|
|
754
755
|
ctx.input.targetPath
|
|
755
756
|
);
|
|
@@ -860,7 +861,7 @@ class SecureTemplater {
|
|
|
860
861
|
const context = await isolate.createContext();
|
|
861
862
|
const contextGlobal = context.global;
|
|
862
863
|
const nunjucksSource = await fs__default.default.readFile(
|
|
863
|
-
|
|
864
|
+
backendPluginApi.resolvePackagePath(
|
|
864
865
|
"@backstage/plugin-scaffolder-backend",
|
|
865
866
|
"assets/nunjucks.js.txt"
|
|
866
867
|
),
|
|
@@ -1045,9 +1046,9 @@ function createFetchTemplateAction(options) {
|
|
|
1045
1046
|
var _a, _b;
|
|
1046
1047
|
ctx.logger.info("Fetching template content from remote URL");
|
|
1047
1048
|
const workDir = await ctx.createTemporaryDirectory();
|
|
1048
|
-
const templateDir =
|
|
1049
|
+
const templateDir = backendPluginApi.resolveSafeChildPath(workDir, "template");
|
|
1049
1050
|
const targetPath = (_a = ctx.input.targetPath) != null ? _a : "./";
|
|
1050
|
-
const outputDir =
|
|
1051
|
+
const outputDir = backendPluginApi.resolveSafeChildPath(ctx.workspacePath, targetPath);
|
|
1051
1052
|
if (ctx.input.copyWithoutRender && ctx.input.copyWithoutTemplating) {
|
|
1052
1053
|
throw new errors.InputError(
|
|
1053
1054
|
"Fetch action input copyWithoutRender and copyWithoutTemplating can not be used at the same time"
|
|
@@ -1147,7 +1148,7 @@ function createFetchTemplateAction(options) {
|
|
|
1147
1148
|
if (containsSkippedContent(localOutputPath)) {
|
|
1148
1149
|
continue;
|
|
1149
1150
|
}
|
|
1150
|
-
const outputPath =
|
|
1151
|
+
const outputPath = backendPluginApi.resolveSafeChildPath(outputDir, localOutputPath);
|
|
1151
1152
|
if (fs__default.default.existsSync(outputPath) && !ctx.input.replace) {
|
|
1152
1153
|
continue;
|
|
1153
1154
|
}
|
|
@@ -1162,7 +1163,7 @@ function createFetchTemplateAction(options) {
|
|
|
1162
1163
|
);
|
|
1163
1164
|
await fs__default.default.ensureDir(outputPath);
|
|
1164
1165
|
} else {
|
|
1165
|
-
const inputFilePath =
|
|
1166
|
+
const inputFilePath = backendPluginApi.resolveSafeChildPath(templateDir, location);
|
|
1166
1167
|
const stats = await fs__default.default.promises.lstat(inputFilePath);
|
|
1167
1168
|
if (stats.isSymbolicLink() || await isbinaryfile.isBinaryFile(inputFilePath)) {
|
|
1168
1169
|
ctx.logger.info(
|
|
@@ -1237,7 +1238,7 @@ const createFilesystemDeleteAction = () => {
|
|
|
1237
1238
|
throw new errors.InputError("files must be an Array");
|
|
1238
1239
|
}
|
|
1239
1240
|
for (const file of ctx.input.files) {
|
|
1240
|
-
const filepath =
|
|
1241
|
+
const filepath = backendPluginApi.resolveSafeChildPath(ctx.workspacePath, file);
|
|
1241
1242
|
try {
|
|
1242
1243
|
await fs__default.default.remove(filepath);
|
|
1243
1244
|
ctx.logger.info(`File ${filepath} deleted successfully`);
|
|
@@ -1318,11 +1319,11 @@ const createFilesystemRenameAction = () => {
|
|
|
1318
1319
|
if (!file.from || !file.to) {
|
|
1319
1320
|
throw new errors.InputError("each file must have a from and to property");
|
|
1320
1321
|
}
|
|
1321
|
-
const sourceFilepath =
|
|
1322
|
+
const sourceFilepath = backendPluginApi.resolveSafeChildPath(
|
|
1322
1323
|
ctx.workspacePath,
|
|
1323
1324
|
file.from
|
|
1324
1325
|
);
|
|
1325
|
-
const destFilepath =
|
|
1326
|
+
const destFilepath = backendPluginApi.resolveSafeChildPath(ctx.workspacePath, file.to);
|
|
1326
1327
|
try {
|
|
1327
1328
|
await fs__default.default.move(sourceFilepath, destFilepath, {
|
|
1328
1329
|
overwrite: (_b = file.overwrite) != null ? _b : false
|
|
@@ -1387,7 +1388,8 @@ const createBuiltinActions = (options) => {
|
|
|
1387
1388
|
}),
|
|
1388
1389
|
github.createPublishGithubPullRequestAction({
|
|
1389
1390
|
integrations,
|
|
1390
|
-
githubCredentialsProvider
|
|
1391
|
+
githubCredentialsProvider,
|
|
1392
|
+
config
|
|
1391
1393
|
}),
|
|
1392
1394
|
gitlab.createPublishGitlabAction({
|
|
1393
1395
|
integrations,
|
|
@@ -1549,7 +1551,7 @@ var __publicField$3 = (obj, key, value) => {
|
|
|
1549
1551
|
__defNormalProp$3(obj, key + "" , value);
|
|
1550
1552
|
return value;
|
|
1551
1553
|
};
|
|
1552
|
-
const migrationsDir =
|
|
1554
|
+
const migrationsDir = backendPluginApi.resolvePackagePath(
|
|
1553
1555
|
"@backstage/plugin-scaffolder-backend",
|
|
1554
1556
|
"migrations"
|
|
1555
1557
|
);
|
|
@@ -3154,7 +3156,7 @@ function createDryRunner(options) {
|
|
|
3154
3156
|
});
|
|
3155
3157
|
const dryRunId = uuid.v4();
|
|
3156
3158
|
const log = new Array();
|
|
3157
|
-
const contentsPath =
|
|
3159
|
+
const contentsPath = backendPluginApi.resolveSafeChildPath(
|
|
3158
3160
|
options.workingDirectory,
|
|
3159
3161
|
`dry-run-content-${dryRunId}`
|
|
3160
3162
|
);
|
|
@@ -3175,7 +3177,7 @@ function createDryRunner(options) {
|
|
|
3175
3177
|
templateInfo: {
|
|
3176
3178
|
entityRef: "template:default/dry-run",
|
|
3177
3179
|
baseUrl: url.pathToFileURL(
|
|
3178
|
-
|
|
3180
|
+
backendPluginApi.resolveSafeChildPath(contentsPath, "template.yaml")
|
|
3179
3181
|
).toString()
|
|
3180
3182
|
}
|
|
3181
3183
|
},
|
|
@@ -3780,4 +3782,4 @@ exports.createRouter = createRouter;
|
|
|
3780
3782
|
exports.createWaitAction = createWaitAction;
|
|
3781
3783
|
exports.scaffolderActionRules = scaffolderActionRules;
|
|
3782
3784
|
exports.scaffolderTemplateRules = scaffolderTemplateRules;
|
|
3783
|
-
//# sourceMappingURL=router-
|
|
3785
|
+
//# sourceMappingURL=router-BKGs_U4O.cjs.js.map
|