@backstage/plugin-scaffolder-backend 1.4.0-next.2 → 1.4.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 +28 -4
- package/alpha/package.json +6 -0
- package/dist/index.alpha.d.ts +959 -0
- package/dist/index.beta.d.ts +955 -0
- package/dist/index.cjs.js +38 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +647 -604
- package/package.json +21 -17
package/dist/index.cjs.js
CHANGED
|
@@ -36,6 +36,8 @@ var zod = require('zod');
|
|
|
36
36
|
var url = require('url');
|
|
37
37
|
var os = require('os');
|
|
38
38
|
var pluginCatalogBackend = require('@backstage/plugin-catalog-backend');
|
|
39
|
+
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
40
|
+
var pluginCatalogNode = require('@backstage/plugin-catalog-node');
|
|
39
41
|
|
|
40
42
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
41
43
|
|
|
@@ -571,8 +573,9 @@ function createFetchTemplateAction(options) {
|
|
|
571
573
|
await fs__default["default"].ensureDir(outputPath);
|
|
572
574
|
} else {
|
|
573
575
|
const inputFilePath = backendCommon.resolveSafeChildPath(templateDir, location);
|
|
574
|
-
|
|
575
|
-
|
|
576
|
+
const stats = await fs__default["default"].promises.lstat(inputFilePath);
|
|
577
|
+
if (stats.isSymbolicLink() || await isbinaryfile.isBinaryFile(inputFilePath)) {
|
|
578
|
+
ctx.logger.info(`Copying file binary or symbolic link at ${location}, to template output path.`);
|
|
576
579
|
await fs__default["default"].copy(inputFilePath, outputPath);
|
|
577
580
|
} else {
|
|
578
581
|
const statsObj = await fs__default["default"].stat(inputFilePath);
|
|
@@ -2721,6 +2724,11 @@ function createPublishGitlabAction(options) {
|
|
|
2721
2724
|
title: "Authentication Token",
|
|
2722
2725
|
type: "string",
|
|
2723
2726
|
description: "The token to use for authorization to GitLab"
|
|
2727
|
+
},
|
|
2728
|
+
setUserAsOwner: {
|
|
2729
|
+
title: "Set User As Owner",
|
|
2730
|
+
type: "boolean",
|
|
2731
|
+
description: "Set the token user as owner of the newly created repository. Requires a token authorized to do the edit in the integration configuration for the matching host"
|
|
2724
2732
|
}
|
|
2725
2733
|
}
|
|
2726
2734
|
},
|
|
@@ -2745,7 +2753,8 @@ function createPublishGitlabAction(options) {
|
|
|
2745
2753
|
defaultBranch = "master",
|
|
2746
2754
|
gitCommitMessage = "initial commit",
|
|
2747
2755
|
gitAuthorName,
|
|
2748
|
-
gitAuthorEmail
|
|
2756
|
+
gitAuthorEmail,
|
|
2757
|
+
setUserAsOwner = false
|
|
2749
2758
|
} = ctx.input;
|
|
2750
2759
|
const { owner, repo, host } = parseRepoUrl(repoUrl, integrations);
|
|
2751
2760
|
if (!owner) {
|
|
@@ -2765,15 +2774,22 @@ function createPublishGitlabAction(options) {
|
|
|
2765
2774
|
[tokenType]: token
|
|
2766
2775
|
});
|
|
2767
2776
|
let { id: targetNamespace } = await client.Namespaces.show(owner);
|
|
2777
|
+
const { id: userId } = await client.Users.current();
|
|
2768
2778
|
if (!targetNamespace) {
|
|
2769
|
-
|
|
2770
|
-
targetNamespace = id;
|
|
2779
|
+
targetNamespace = userId;
|
|
2771
2780
|
}
|
|
2772
|
-
const { http_url_to_repo } = await client.Projects.create({
|
|
2781
|
+
const { id: projectId, http_url_to_repo } = await client.Projects.create({
|
|
2773
2782
|
namespace_id: targetNamespace,
|
|
2774
2783
|
name: repo,
|
|
2775
2784
|
visibility: repoVisibility
|
|
2776
2785
|
});
|
|
2786
|
+
if (setUserAsOwner && integrationConfig.config.token) {
|
|
2787
|
+
const adminClient = new node.Gitlab({
|
|
2788
|
+
host: integrationConfig.config.baseUrl,
|
|
2789
|
+
token: integrationConfig.config.token
|
|
2790
|
+
});
|
|
2791
|
+
await adminClient.ProjectMembers.add(projectId, userId, 50);
|
|
2792
|
+
}
|
|
2777
2793
|
const remoteUrl = http_url_to_repo.replace(/\.git$/, "");
|
|
2778
2794
|
const repoContentsUrl = `${remoteUrl}/-/blob/${defaultBranch}`;
|
|
2779
2795
|
const gitAuthorInfo = {
|
|
@@ -4128,6 +4144,21 @@ class ScaffolderEntitiesProcessor {
|
|
|
4128
4144
|
}
|
|
4129
4145
|
}
|
|
4130
4146
|
|
|
4147
|
+
const scaffolderCatalogModule = backendPluginApi.createBackendModule({
|
|
4148
|
+
moduleId: "scaffolder.module",
|
|
4149
|
+
pluginId: "catalog",
|
|
4150
|
+
register(env) {
|
|
4151
|
+
env.registerInit({
|
|
4152
|
+
deps: {
|
|
4153
|
+
catalogProcessingExtensionPoint: pluginCatalogNode.catalogProcessingExtentionPoint
|
|
4154
|
+
},
|
|
4155
|
+
async init({ catalogProcessingExtensionPoint }) {
|
|
4156
|
+
catalogProcessingExtensionPoint.addProcessor(new ScaffolderEntitiesProcessor());
|
|
4157
|
+
}
|
|
4158
|
+
});
|
|
4159
|
+
}
|
|
4160
|
+
});
|
|
4161
|
+
|
|
4131
4162
|
exports.DatabaseTaskStore = DatabaseTaskStore;
|
|
4132
4163
|
exports.ScaffolderEntitiesProcessor = ScaffolderEntitiesProcessor;
|
|
4133
4164
|
exports.TaskManager = TaskManager;
|
|
@@ -4160,4 +4191,5 @@ exports.createRouter = createRouter;
|
|
|
4160
4191
|
exports.createTemplateAction = createTemplateAction;
|
|
4161
4192
|
exports.executeShellCommand = executeShellCommand;
|
|
4162
4193
|
exports.fetchContents = fetchContents;
|
|
4194
|
+
exports.scaffolderCatalogModule = scaffolderCatalogModule;
|
|
4163
4195
|
//# sourceMappingURL=index.cjs.js.map
|