@backstage/plugin-scaffolder-backend 0.17.2 → 0.17.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 +24 -2
- package/dist/index.cjs.js +23 -14
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +104 -10
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,38 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-backend
|
|
2
2
|
|
|
3
|
+
## 0.17.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5c7f2343ea: Applied fix from version 0.17.2 of this package, which is part of the v0.69.2 release of Backstage.
|
|
8
|
+
- 899f196af5: Use `getEntityByRef` instead of `getEntityByName` in the catalog client
|
|
9
|
+
- 34af86517c: ensure `apiBaseUrl` being set for Bitbucket integrations, replace hardcoded defaults
|
|
10
|
+
- d6deb5e440: Set timeout for scaffolder octokit client
|
|
11
|
+
- 83a83381b0: Use the new `processingResult` export from the catalog backend
|
|
12
|
+
- 7372f29473: Cleanup API report
|
|
13
|
+
- c7f6424a26: Applied fix from `v0.17.1` of this package which is part of the `v0.69.1` release of Backstage.
|
|
14
|
+
- 36aa63022b: Use `CompoundEntityRef` instead of `EntityName`, and `getCompoundEntityRef` instead of `getEntityName`, from `@backstage/catalog-model`.
|
|
15
|
+
- 8119a9e011: Fix the support for custom defaultBranch values for Bitbucket Cloud at the `publish:bitbucket` scaffolder action.
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @backstage/catalog-model@0.12.0
|
|
18
|
+
- @backstage/catalog-client@0.8.0
|
|
19
|
+
- @backstage/plugin-catalog-backend@0.23.0
|
|
20
|
+
- @backstage/backend-common@0.12.0
|
|
21
|
+
- @backstage/integration@0.8.0
|
|
22
|
+
- @backstage/plugin-scaffolder-backend-module-cookiecutter@0.2.3
|
|
23
|
+
- @backstage/plugin-scaffolder-common@0.2.3
|
|
24
|
+
|
|
3
25
|
## 0.17.2
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
6
28
|
|
|
7
|
-
- `repoUrl` does not have a protocol in `publish:github:pull-request`
|
|
29
|
+
- bug: `repoUrl` does not have a protocol in `publish:github:pull-request`
|
|
8
30
|
|
|
9
31
|
## 0.17.1
|
|
10
32
|
|
|
11
33
|
### Patch Changes
|
|
12
34
|
|
|
13
|
-
- bug: fixing `repoUrl` resolution for `github:
|
|
35
|
+
- bug: fixing `repoUrl` resolution for `publish:github:pull-request` action
|
|
14
36
|
|
|
15
37
|
## 0.17.0
|
|
16
38
|
|
package/dist/index.cjs.js
CHANGED
|
@@ -938,7 +938,9 @@ const createBitbucketCloudRepository = async (opts) => {
|
|
|
938
938
|
repo,
|
|
939
939
|
description,
|
|
940
940
|
repoVisibility,
|
|
941
|
-
|
|
941
|
+
mainBranch,
|
|
942
|
+
authorization,
|
|
943
|
+
apiBaseUrl
|
|
942
944
|
} = opts;
|
|
943
945
|
const options = {
|
|
944
946
|
method: "POST",
|
|
@@ -955,7 +957,7 @@ const createBitbucketCloudRepository = async (opts) => {
|
|
|
955
957
|
};
|
|
956
958
|
let response;
|
|
957
959
|
try {
|
|
958
|
-
response = await fetch__default["default"](
|
|
960
|
+
response = await fetch__default["default"](`${apiBaseUrl}/repositories/${workspace}/${repo}`, options);
|
|
959
961
|
} catch (e) {
|
|
960
962
|
throw new Error(`Unable to create repository, ${e}`);
|
|
961
963
|
}
|
|
@@ -969,12 +971,11 @@ const createBitbucketCloudRepository = async (opts) => {
|
|
|
969
971
|
remoteUrl = link.href;
|
|
970
972
|
}
|
|
971
973
|
}
|
|
972
|
-
const repoContentsUrl = `${r.links.html.href}/src
|
|
974
|
+
const repoContentsUrl = `${r.links.html.href}/src/${mainBranch}`;
|
|
973
975
|
return { remoteUrl, repoContentsUrl };
|
|
974
976
|
};
|
|
975
977
|
const createBitbucketServerRepository = async (opts) => {
|
|
976
978
|
const {
|
|
977
|
-
host,
|
|
978
979
|
project,
|
|
979
980
|
repo,
|
|
980
981
|
description,
|
|
@@ -996,8 +997,7 @@ const createBitbucketServerRepository = async (opts) => {
|
|
|
996
997
|
}
|
|
997
998
|
};
|
|
998
999
|
try {
|
|
999
|
-
|
|
1000
|
-
response = await fetch__default["default"](`${baseUrl}/projects/${project}/repos`, options);
|
|
1000
|
+
response = await fetch__default["default"](`${apiBaseUrl}/projects/${project}/repos`, options);
|
|
1001
1001
|
} catch (e) {
|
|
1002
1002
|
throw new Error(`Unable to create repository, ${e}`);
|
|
1003
1003
|
}
|
|
@@ -1117,16 +1117,20 @@ function createPublishBitbucketAction(options) {
|
|
|
1117
1117
|
if (!integrationConfig) {
|
|
1118
1118
|
throw new errors.InputError(`No matching integration configuration for host ${host}, please check your integrations config`);
|
|
1119
1119
|
}
|
|
1120
|
-
const authorization = getAuthorizationHeader(ctx.input.token ? {
|
|
1120
|
+
const authorization = getAuthorizationHeader(ctx.input.token ? {
|
|
1121
|
+
host: integrationConfig.config.host,
|
|
1122
|
+
apiBaseUrl: integrationConfig.config.apiBaseUrl,
|
|
1123
|
+
token: ctx.input.token
|
|
1124
|
+
} : integrationConfig.config);
|
|
1121
1125
|
const apiBaseUrl = integrationConfig.config.apiBaseUrl;
|
|
1122
1126
|
const createMethod = host === "bitbucket.org" ? createBitbucketCloudRepository : createBitbucketServerRepository;
|
|
1123
1127
|
const { remoteUrl, repoContentsUrl } = await createMethod({
|
|
1124
1128
|
authorization,
|
|
1125
|
-
host,
|
|
1126
1129
|
workspace: workspace || "",
|
|
1127
1130
|
project,
|
|
1128
1131
|
repo,
|
|
1129
1132
|
repoVisibility,
|
|
1133
|
+
mainBranch: defaultBranch,
|
|
1130
1134
|
description,
|
|
1131
1135
|
apiBaseUrl
|
|
1132
1136
|
});
|
|
@@ -1192,10 +1196,14 @@ function createPublishFileAction() {
|
|
|
1192
1196
|
});
|
|
1193
1197
|
}
|
|
1194
1198
|
|
|
1199
|
+
const DEFAULT_TIMEOUT_MS = 6e4;
|
|
1195
1200
|
async function getOctokitOptions(options) {
|
|
1196
1201
|
var _a;
|
|
1197
1202
|
const { integrations, credentialsProvider, repoUrl, token } = options;
|
|
1198
1203
|
const { owner, repo, host } = parseRepoUrl(repoUrl, integrations);
|
|
1204
|
+
const requestOptions = {
|
|
1205
|
+
timeout: DEFAULT_TIMEOUT_MS
|
|
1206
|
+
};
|
|
1199
1207
|
if (!owner) {
|
|
1200
1208
|
throw new errors.InputError(`No owner provided for repo ${repoUrl}`);
|
|
1201
1209
|
}
|
|
@@ -1207,7 +1215,8 @@ async function getOctokitOptions(options) {
|
|
|
1207
1215
|
return {
|
|
1208
1216
|
auth: token,
|
|
1209
1217
|
baseUrl: integrationConfig.apiBaseUrl,
|
|
1210
|
-
previews: ["nebula-preview"]
|
|
1218
|
+
previews: ["nebula-preview"],
|
|
1219
|
+
request: requestOptions
|
|
1211
1220
|
};
|
|
1212
1221
|
}
|
|
1213
1222
|
const githubCredentialsProvider = credentialsProvider != null ? credentialsProvider : integration.DefaultGithubCredentialsProvider.fromIntegrations(integrations);
|
|
@@ -2865,9 +2874,9 @@ async function findTemplate(options) {
|
|
|
2865
2874
|
if (entityRef.kind.toLocaleLowerCase("en-US") !== "template") {
|
|
2866
2875
|
throw new errors.InputError(`Invalid kind, only 'Template' kind is supported`);
|
|
2867
2876
|
}
|
|
2868
|
-
const template = await catalogApi.
|
|
2877
|
+
const template = await catalogApi.getEntityByRef(entityRef, { token });
|
|
2869
2878
|
if (!template) {
|
|
2870
|
-
throw new errors.NotFoundError(`Template ${entityRef} not found`);
|
|
2879
|
+
throw new errors.NotFoundError(`Template ${catalogModel.stringifyEntityRef(entityRef)} not found`);
|
|
2871
2880
|
}
|
|
2872
2881
|
return template;
|
|
2873
2882
|
}
|
|
@@ -3112,7 +3121,7 @@ class ScaffolderEntitiesProcessor {
|
|
|
3112
3121
|
return false;
|
|
3113
3122
|
}
|
|
3114
3123
|
async postProcessEntity(entity, _location, emit) {
|
|
3115
|
-
const selfRef = catalogModel.
|
|
3124
|
+
const selfRef = catalogModel.getCompoundEntityRef(entity);
|
|
3116
3125
|
if (entity.apiVersion === "scaffolder.backstage.io/v1beta3" && entity.kind === "Template") {
|
|
3117
3126
|
const template = entity;
|
|
3118
3127
|
const target = template.spec.owner;
|
|
@@ -3121,7 +3130,7 @@ class ScaffolderEntitiesProcessor {
|
|
|
3121
3130
|
defaultKind: "Group",
|
|
3122
3131
|
defaultNamespace: selfRef.namespace
|
|
3123
3132
|
});
|
|
3124
|
-
emit(pluginCatalogBackend.
|
|
3133
|
+
emit(pluginCatalogBackend.processingResult.relation({
|
|
3125
3134
|
source: selfRef,
|
|
3126
3135
|
type: catalogModel.RELATION_OWNED_BY,
|
|
3127
3136
|
target: {
|
|
@@ -3130,7 +3139,7 @@ class ScaffolderEntitiesProcessor {
|
|
|
3130
3139
|
name: targetRef.name
|
|
3131
3140
|
}
|
|
3132
3141
|
}));
|
|
3133
|
-
emit(pluginCatalogBackend.
|
|
3142
|
+
emit(pluginCatalogBackend.processingResult.relation({
|
|
3134
3143
|
source: {
|
|
3135
3144
|
kind: targetRef.kind,
|
|
3136
3145
|
namespace: targetRef.namespace,
|