@backstage/plugin-scaffolder-backend 0.0.0-nightly-20220303023541 → 0.0.0-nightly-20220307022304
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 -8
- package/dist/index.cjs.js +37 -62
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +728 -0
- package/package.json +9 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,24 +1,47 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-backend
|
|
2
2
|
|
|
3
|
-
## 0.0.0-nightly-
|
|
3
|
+
## 0.0.0-nightly-20220307022304
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- f9c7bdd899: **BREAKING**:
|
|
8
|
+
|
|
9
|
+
- Removed the `createFetchCookiecutterAction` export, please use the `@backstage/plugin-scaffolder-backend-module-cookiecutter` package explicitly (see [its README](https://github.com/backstage/backstage/tree/master/plugins/scaffolder-backend-module-cookiecutter) for installation instructions).
|
|
10
|
+
- Removed the `containerRunner` argument from the types `RouterOptions` (as used by `createRouter`) and `CreateBuiltInActionsOptions` (as used by `createBuiltinActions`).
|
|
11
|
+
|
|
12
|
+
- 5afbd16d43: **BREAKING**: Removed the previously deprecated `OctokitProvider` class.
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 458d16869c: Allow passing more repo configuration for `publish:github` action
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
- @backstage/plugin-catalog-backend@0.0.0-nightly-20220307022304
|
|
19
|
+
- @backstage/catalog-model@0.0.0-nightly-20220307022304
|
|
20
|
+
- @backstage/backend-common@0.0.0-nightly-20220307022304
|
|
21
|
+
- @backstage/catalog-client@0.0.0-nightly-20220307022304
|
|
22
|
+
- @backstage/plugin-scaffolder-common@0.0.0-nightly-20220307022304
|
|
23
|
+
|
|
24
|
+
## 0.17.3
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
6
27
|
|
|
7
28
|
- 5c7f2343ea: Applied fix from version 0.17.2 of this package, which is part of the v0.69.2 release of Backstage.
|
|
29
|
+
- 899f196af5: Use `getEntityByRef` instead of `getEntityByName` in the catalog client
|
|
8
30
|
- 34af86517c: ensure `apiBaseUrl` being set for Bitbucket integrations, replace hardcoded defaults
|
|
9
31
|
- d6deb5e440: Set timeout for scaffolder octokit client
|
|
10
32
|
- 83a83381b0: Use the new `processingResult` export from the catalog backend
|
|
11
33
|
- 7372f29473: Cleanup API report
|
|
12
34
|
- c7f6424a26: Applied fix from `v0.17.1` of this package which is part of the `v0.69.1` release of Backstage.
|
|
35
|
+
- 36aa63022b: Use `CompoundEntityRef` instead of `EntityName`, and `getCompoundEntityRef` instead of `getEntityName`, from `@backstage/catalog-model`.
|
|
13
36
|
- 8119a9e011: Fix the support for custom defaultBranch values for Bitbucket Cloud at the `publish:bitbucket` scaffolder action.
|
|
14
37
|
- Updated dependencies
|
|
15
|
-
- @backstage/
|
|
16
|
-
- @backstage/
|
|
17
|
-
- @backstage/
|
|
18
|
-
- @backstage/
|
|
19
|
-
- @backstage/
|
|
20
|
-
- @backstage/
|
|
21
|
-
- @backstage/plugin-scaffolder-common@0.
|
|
38
|
+
- @backstage/catalog-model@0.12.0
|
|
39
|
+
- @backstage/catalog-client@0.8.0
|
|
40
|
+
- @backstage/plugin-catalog-backend@0.23.0
|
|
41
|
+
- @backstage/backend-common@0.12.0
|
|
42
|
+
- @backstage/integration@0.8.0
|
|
43
|
+
- @backstage/plugin-scaffolder-backend-module-cookiecutter@0.2.3
|
|
44
|
+
- @backstage/plugin-scaffolder-common@0.2.3
|
|
22
45
|
|
|
23
46
|
## 0.17.2
|
|
24
47
|
|
package/dist/index.cjs.js
CHANGED
|
@@ -12,7 +12,6 @@ var path = require('path');
|
|
|
12
12
|
var globby = require('globby');
|
|
13
13
|
var isbinaryfile = require('isbinaryfile');
|
|
14
14
|
var vm2 = require('vm2');
|
|
15
|
-
var pluginScaffolderBackendModuleCookiecutter = require('@backstage/plugin-scaffolder-backend-module-cookiecutter');
|
|
16
15
|
var child_process = require('child_process');
|
|
17
16
|
var stream = require('stream');
|
|
18
17
|
var azureDevopsNodeApi = require('azure-devops-node-api');
|
|
@@ -1272,6 +1271,26 @@ function createPublishGithubAction(options) {
|
|
|
1272
1271
|
type: "string",
|
|
1273
1272
|
description: `Sets the default branch on the repository. The default value is 'master'`
|
|
1274
1273
|
},
|
|
1274
|
+
deleteBranchOnMerge: {
|
|
1275
|
+
title: "Delete Branch On Merge",
|
|
1276
|
+
type: "boolean",
|
|
1277
|
+
description: `Delete the branch after merging the PR. The default value is 'false'`
|
|
1278
|
+
},
|
|
1279
|
+
allowMergeCommit: {
|
|
1280
|
+
title: "Allow Merge Commits",
|
|
1281
|
+
type: "boolean",
|
|
1282
|
+
description: `Allow merge commits. The default value is 'true'`
|
|
1283
|
+
},
|
|
1284
|
+
allowSquashMerge: {
|
|
1285
|
+
title: "Allow Squash Merges",
|
|
1286
|
+
type: "boolean",
|
|
1287
|
+
description: `Allow squash merges. The default value is 'true'`
|
|
1288
|
+
},
|
|
1289
|
+
allowRebaseMerge: {
|
|
1290
|
+
title: "Allow Rebase Merges",
|
|
1291
|
+
type: "boolean",
|
|
1292
|
+
description: `Allow rebase merges. The default value is 'true'`
|
|
1293
|
+
},
|
|
1275
1294
|
sourcePath: {
|
|
1276
1295
|
title: "Source Path",
|
|
1277
1296
|
description: "Path within the workspace that will be used as the repository root. If omitted, the entire workspace will be published as the repository.",
|
|
@@ -1333,6 +1352,10 @@ function createPublishGithubAction(options) {
|
|
|
1333
1352
|
requireCodeOwnerReviews = false,
|
|
1334
1353
|
repoVisibility = "private",
|
|
1335
1354
|
defaultBranch = "master",
|
|
1355
|
+
deleteBranchOnMerge = false,
|
|
1356
|
+
allowMergeCommit = true,
|
|
1357
|
+
allowSquashMerge = true,
|
|
1358
|
+
allowRebaseMerge = true,
|
|
1336
1359
|
collaborators,
|
|
1337
1360
|
topics,
|
|
1338
1361
|
token: providedToken
|
|
@@ -1356,11 +1379,19 @@ function createPublishGithubAction(options) {
|
|
|
1356
1379
|
org: owner,
|
|
1357
1380
|
private: repoVisibility === "private",
|
|
1358
1381
|
visibility: repoVisibility,
|
|
1359
|
-
description
|
|
1382
|
+
description,
|
|
1383
|
+
delete_branch_on_merge: deleteBranchOnMerge,
|
|
1384
|
+
allow_merge_commit: allowMergeCommit,
|
|
1385
|
+
allow_squash_merge: allowSquashMerge,
|
|
1386
|
+
allow_rebase_merge: allowRebaseMerge
|
|
1360
1387
|
}) : client.rest.repos.createForAuthenticatedUser({
|
|
1361
1388
|
name: repo,
|
|
1362
1389
|
private: repoVisibility === "private",
|
|
1363
|
-
description
|
|
1390
|
+
description,
|
|
1391
|
+
delete_branch_on_merge: deleteBranchOnMerge,
|
|
1392
|
+
allow_merge_commit: allowMergeCommit,
|
|
1393
|
+
allow_squash_merge: allowSquashMerge,
|
|
1394
|
+
allow_rebase_merge: allowRebaseMerge
|
|
1364
1395
|
});
|
|
1365
1396
|
const { data: newRepo } = await repoCreationPromise;
|
|
1366
1397
|
if (access == null ? void 0 : access.startsWith(`${owner}/`)) {
|
|
@@ -2010,49 +2041,10 @@ function createGithubWebhookAction(options) {
|
|
|
2010
2041
|
});
|
|
2011
2042
|
}
|
|
2012
2043
|
|
|
2013
|
-
class OctokitProvider {
|
|
2014
|
-
constructor(integrations, githubCredentialsProvider) {
|
|
2015
|
-
this.integrations = integrations;
|
|
2016
|
-
this.githubCredentialsProvider = githubCredentialsProvider || integration.DefaultGithubCredentialsProvider.fromIntegrations(this.integrations);
|
|
2017
|
-
}
|
|
2018
|
-
async getOctokit(repoUrl, options) {
|
|
2019
|
-
var _a;
|
|
2020
|
-
const { owner, repo, host } = parseRepoUrl(repoUrl, this.integrations);
|
|
2021
|
-
if (!owner) {
|
|
2022
|
-
throw new errors.InputError(`No owner provided for repo ${repoUrl}`);
|
|
2023
|
-
}
|
|
2024
|
-
const integrationConfig = (_a = this.integrations.github.byHost(host)) == null ? void 0 : _a.config;
|
|
2025
|
-
if (!integrationConfig) {
|
|
2026
|
-
throw new errors.InputError(`No integration for host ${host}`);
|
|
2027
|
-
}
|
|
2028
|
-
if (options == null ? void 0 : options.token) {
|
|
2029
|
-
const client2 = new octokit.Octokit({
|
|
2030
|
-
auth: options.token,
|
|
2031
|
-
baseUrl: integrationConfig.apiBaseUrl,
|
|
2032
|
-
previews: ["nebula-preview"]
|
|
2033
|
-
});
|
|
2034
|
-
return { client: client2, token: options.token, owner, repo };
|
|
2035
|
-
}
|
|
2036
|
-
const { token } = await this.githubCredentialsProvider.getCredentials({
|
|
2037
|
-
url: `https://${host}/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}`
|
|
2038
|
-
});
|
|
2039
|
-
if (!token) {
|
|
2040
|
-
throw new errors.InputError(`No token available for host: ${host}, with owner ${owner}, and repo ${repo}`);
|
|
2041
|
-
}
|
|
2042
|
-
const client = new octokit.Octokit({
|
|
2043
|
-
auth: token,
|
|
2044
|
-
baseUrl: integrationConfig.apiBaseUrl,
|
|
2045
|
-
previews: ["nebula-preview"]
|
|
2046
|
-
});
|
|
2047
|
-
return { client, token, owner, repo };
|
|
2048
|
-
}
|
|
2049
|
-
}
|
|
2050
|
-
|
|
2051
2044
|
const createBuiltinActions = (options) => {
|
|
2052
2045
|
const {
|
|
2053
2046
|
reader,
|
|
2054
2047
|
integrations,
|
|
2055
|
-
containerRunner,
|
|
2056
2048
|
catalogClient,
|
|
2057
2049
|
config,
|
|
2058
2050
|
additionalTemplateFilters
|
|
@@ -2106,16 +2098,6 @@ const createBuiltinActions = (options) => {
|
|
|
2106
2098
|
githubCredentialsProvider
|
|
2107
2099
|
})
|
|
2108
2100
|
];
|
|
2109
|
-
if (containerRunner) {
|
|
2110
|
-
backendCommon.getRootLogger().warn(`[DEPRECATED] The fetch:cookiecutter action will be removed part of the default scaffolder actions in later versions.
|
|
2111
|
-
You can install the package seperately and remove the containerRunner from the createBuiltInActions to remove this warning,
|
|
2112
|
-
or you can migrate to using fetch:template https://backstage.io/docs/features/software-templates/builtin-actions#migrating-from-fetchcookiecutter-to-fetchtemplate`);
|
|
2113
|
-
actions.push(pluginScaffolderBackendModuleCookiecutter.createFetchCookiecutterAction({
|
|
2114
|
-
reader,
|
|
2115
|
-
integrations,
|
|
2116
|
-
containerRunner
|
|
2117
|
-
}));
|
|
2118
|
-
}
|
|
2119
2101
|
return actions;
|
|
2120
2102
|
};
|
|
2121
2103
|
|
|
@@ -2874,9 +2856,9 @@ async function findTemplate(options) {
|
|
|
2874
2856
|
if (entityRef.kind.toLocaleLowerCase("en-US") !== "template") {
|
|
2875
2857
|
throw new errors.InputError(`Invalid kind, only 'Template' kind is supported`);
|
|
2876
2858
|
}
|
|
2877
|
-
const template = await catalogApi.
|
|
2859
|
+
const template = await catalogApi.getEntityByRef(entityRef, { token });
|
|
2878
2860
|
if (!template) {
|
|
2879
|
-
throw new errors.NotFoundError(`Template ${entityRef} not found`);
|
|
2861
|
+
throw new errors.NotFoundError(`Template ${catalogModel.stringifyEntityRef(entityRef)} not found`);
|
|
2880
2862
|
}
|
|
2881
2863
|
return template;
|
|
2882
2864
|
}
|
|
@@ -2894,7 +2876,6 @@ async function createRouter(options) {
|
|
|
2894
2876
|
database,
|
|
2895
2877
|
catalogClient,
|
|
2896
2878
|
actions,
|
|
2897
|
-
containerRunner,
|
|
2898
2879
|
taskWorkers,
|
|
2899
2880
|
additionalTemplateFilters
|
|
2900
2881
|
} = options;
|
|
@@ -2926,7 +2907,6 @@ async function createRouter(options) {
|
|
|
2926
2907
|
const actionsToRegister = Array.isArray(actions) ? actions : createBuiltinActions({
|
|
2927
2908
|
integrations,
|
|
2928
2909
|
catalogClient,
|
|
2929
|
-
containerRunner,
|
|
2930
2910
|
reader,
|
|
2931
2911
|
config,
|
|
2932
2912
|
additionalTemplateFilters
|
|
@@ -3121,7 +3101,7 @@ class ScaffolderEntitiesProcessor {
|
|
|
3121
3101
|
return false;
|
|
3122
3102
|
}
|
|
3123
3103
|
async postProcessEntity(entity, _location, emit) {
|
|
3124
|
-
const selfRef = catalogModel.
|
|
3104
|
+
const selfRef = catalogModel.getCompoundEntityRef(entity);
|
|
3125
3105
|
if (entity.apiVersion === "scaffolder.backstage.io/v1beta3" && entity.kind === "Template") {
|
|
3126
3106
|
const template = entity;
|
|
3127
3107
|
const target = template.spec.owner;
|
|
@@ -3154,12 +3134,7 @@ class ScaffolderEntitiesProcessor {
|
|
|
3154
3134
|
}
|
|
3155
3135
|
}
|
|
3156
3136
|
|
|
3157
|
-
Object.defineProperty(exports, 'createFetchCookiecutterAction', {
|
|
3158
|
-
enumerable: true,
|
|
3159
|
-
get: function () { return pluginScaffolderBackendModuleCookiecutter.createFetchCookiecutterAction; }
|
|
3160
|
-
});
|
|
3161
3137
|
exports.DatabaseTaskStore = DatabaseTaskStore;
|
|
3162
|
-
exports.OctokitProvider = OctokitProvider;
|
|
3163
3138
|
exports.ScaffolderEntitiesProcessor = ScaffolderEntitiesProcessor;
|
|
3164
3139
|
exports.TaskManager = TaskManager;
|
|
3165
3140
|
exports.TaskWorker = TaskWorker;
|