@backstage/plugin-scaffolder-backend 1.16.3-next.0 → 1.16.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 CHANGED
@@ -1,31 +1,56 @@
1
1
  # @backstage/plugin-scaffolder-backend
2
2
 
3
- ## 1.16.3-next.0
3
+ ## 1.16.3
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - a4989552d828: Add examples for `publish:github` and `publish:gitlab` scaffolder actions.
8
- - 5f1a92b9f19f: Use `DefaultAzureDevOpsCredentialsProvider` to retrieve credentials for Azure DevOps.
9
- - fb57a4694fc6: Fixed the plugin and module ID of the alpha `catalogModuleTemplateKind` export.
10
- - cfc3ca6ce060: Changes needed to support MySQL
11
7
  - Updated dependencies
12
- - @backstage/plugin-catalog-backend@1.12.2-next.0
13
- - @backstage/plugin-auth-node@0.3.0-next.0
14
- - @backstage/backend-common@0.19.4-next.0
15
- - @backstage/integration@1.7.0-next.0
16
- - @backstage/backend-tasks@0.5.7-next.0
17
- - @backstage/backend-plugin-api@0.6.2-next.0
8
+ - @backstage/plugin-catalog-backend@1.12.2
9
+ - @backstage/integration@1.6.2
10
+ - @backstage/backend-common@0.19.4
11
+ - @backstage/plugin-scaffolder-node@0.2.2
12
+ - @backstage/backend-tasks@0.5.7
13
+ - @backstage/plugin-auth-node@0.2.19
14
+ - @backstage/plugin-catalog-node@1.4.3
15
+ - @backstage/plugin-permission-node@0.7.13
16
+ - @backstage/backend-plugin-api@0.6.2
18
17
  - @backstage/catalog-client@1.4.3
19
18
  - @backstage/catalog-model@1.4.1
20
19
  - @backstage/config@1.0.8
21
20
  - @backstage/errors@1.2.1
22
21
  - @backstage/types@1.1.0
23
22
  - @backstage/plugin-catalog-common@1.0.15
24
- - @backstage/plugin-catalog-node@1.4.3-next.0
25
23
  - @backstage/plugin-permission-common@0.7.7
26
- - @backstage/plugin-permission-node@0.7.13-next.0
27
24
  - @backstage/plugin-scaffolder-common@1.4.0
28
- - @backstage/plugin-scaffolder-node@0.2.2-next.0
25
+
26
+ ## 1.16.2
27
+
28
+ ### Patch Changes
29
+
30
+ - Updated dependencies
31
+ - @backstage/integration@1.6.1
32
+ - @backstage/plugin-catalog-backend@1.12.1
33
+ - @backstage/backend-common@0.19.3
34
+ - @backstage/plugin-scaffolder-node@0.2.1
35
+ - @backstage/backend-tasks@0.5.6
36
+ - @backstage/plugin-auth-node@0.2.18
37
+ - @backstage/plugin-catalog-node@1.4.2
38
+ - @backstage/plugin-permission-node@0.7.12
39
+ - @backstage/backend-plugin-api@0.6.1
40
+ - @backstage/catalog-client@1.4.3
41
+ - @backstage/catalog-model@1.4.1
42
+ - @backstage/config@1.0.8
43
+ - @backstage/errors@1.2.1
44
+ - @backstage/types@1.1.0
45
+ - @backstage/plugin-catalog-common@1.0.15
46
+ - @backstage/plugin-permission-common@0.7.7
47
+ - @backstage/plugin-scaffolder-common@1.4.0
48
+
49
+ ## 1.16.1
50
+
51
+ ### Patch Changes
52
+
53
+ - 2ba07bcdb046: Fixed the plugin and module ID of the alpha `catalogModuleTemplateKind` export.
29
54
 
30
55
  ## 1.16.0
31
56
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-backend",
3
- "version": "1.16.3-next.0",
3
+ "version": "1.16.3",
4
4
  "main": "../dist/alpha.cjs.js",
5
5
  "types": "../dist/alpha.d.ts"
6
6
  }
package/dist/alpha.cjs.js CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var backendPluginApi = require('@backstage/backend-plugin-api');
6
6
  var alpha = require('@backstage/plugin-catalog-node/alpha');
7
- var ScaffolderEntitiesProcessor = require('./cjs/ScaffolderEntitiesProcessor-a60339ce.cjs.js');
7
+ var ScaffolderEntitiesProcessor = require('./cjs/ScaffolderEntitiesProcessor-4b7489dd.cjs.js');
8
8
  var alpha$1 = require('@backstage/plugin-scaffolder-common/alpha');
9
9
  var pluginPermissionNode = require('@backstage/plugin-permission-node');
10
10
  var backendCommon = require('@backstage/backend-common');
@@ -81,7 +81,7 @@ var winston__namespace = /*#__PURE__*/_interopNamespace(winston);
81
81
  var nunjucks__default = /*#__PURE__*/_interopDefaultLegacy(nunjucks);
82
82
  var os__default = /*#__PURE__*/_interopDefaultLegacy(os);
83
83
 
84
- const examples$d = [
84
+ const examples$b = [
85
85
  {
86
86
  description: "Register with the catalog",
87
87
  example: yaml__default["default"].stringify({
@@ -105,7 +105,7 @@ function createCatalogRegisterAction(options) {
105
105
  return pluginScaffolderNode.createTemplateAction({
106
106
  id: id$4,
107
107
  description: "Registers entities from a catalog descriptor file in the workspace into the software catalog.",
108
- examples: examples$d,
108
+ examples: examples$b,
109
109
  schema: {
110
110
  input: {
111
111
  oneOf: [
@@ -229,7 +229,7 @@ function createCatalogRegisterAction(options) {
229
229
  });
230
230
  }
231
231
 
232
- const examples$c = [
232
+ const examples$a = [
233
233
  {
234
234
  description: "Write a catalog yaml file",
235
235
  example: yaml__namespace.stringify({
@@ -273,7 +273,7 @@ function createCatalogWriteAction() {
273
273
  )
274
274
  })
275
275
  },
276
- examples: examples$c,
276
+ examples: examples$a,
277
277
  supportsDryRun: true,
278
278
  async handler(ctx) {
279
279
  ctx.logStream.write(`Writing catalog-info.yaml`);
@@ -287,7 +287,7 @@ function createCatalogWriteAction() {
287
287
  });
288
288
  }
289
289
 
290
- const examples$b = [
290
+ const examples$9 = [
291
291
  {
292
292
  description: "Fetch entity by reference",
293
293
  example: yaml__default["default"].stringify({
@@ -326,7 +326,7 @@ function createFetchCatalogEntityAction(options) {
326
326
  return pluginScaffolderNode.createTemplateAction({
327
327
  id: id$2,
328
328
  description: "Returns entity or entities from the catalog by entity reference(s)",
329
- examples: examples$b,
329
+ examples: examples$9,
330
330
  supportsDryRun: true,
331
331
  schema: {
332
332
  input: zod.z.object({
@@ -401,7 +401,7 @@ function createFetchCatalogEntityAction(options) {
401
401
  });
402
402
  }
403
403
 
404
- const examples$a = [
404
+ const examples$8 = [
405
405
  {
406
406
  description: "Write a debug message",
407
407
  example: yaml__default["default"].stringify({
@@ -439,7 +439,7 @@ function createDebugLogAction() {
439
439
  return pluginScaffolderNode.createTemplateAction({
440
440
  id: id$1,
441
441
  description: "Writes a message into the log or lists all files in the workspace.",
442
- examples: examples$a,
442
+ examples: examples$8,
443
443
  schema: {
444
444
  input: {
445
445
  type: "object",
@@ -486,7 +486,7 @@ async function recursiveReadDir(dir) {
486
486
  return files.reduce((a, f) => a.concat(f), []);
487
487
  }
488
488
 
489
- const examples$9 = [
489
+ const examples$7 = [
490
490
  {
491
491
  description: "Waiting for 50 milliseconds",
492
492
  example: yaml__default["default"].stringify({
@@ -549,7 +549,7 @@ function createWaitAction(options) {
549
549
  return pluginScaffolderNode.createTemplateAction({
550
550
  id,
551
551
  description: "Waits for a certain period of time.",
552
- examples: examples$9,
552
+ examples: examples$7,
553
553
  schema: {
554
554
  input: {
555
555
  type: "object",
@@ -594,7 +594,7 @@ function createWaitAction(options) {
594
594
  });
595
595
  }
596
596
 
597
- const examples$8 = [
597
+ const examples$6 = [
598
598
  {
599
599
  description: "Downloads content and places it in the workspace.",
600
600
  example: yaml__default["default"].stringify({
@@ -633,7 +633,7 @@ function createFetchPlainAction(options) {
633
633
  const { reader, integrations } = options;
634
634
  return pluginScaffolderNode.createTemplateAction({
635
635
  id: ACTION_ID,
636
- examples: examples$8,
636
+ examples: examples$6,
637
637
  description: "Downloads content and places it in the workspace, or optionally in a subdirectory specified by the `targetPath` input option.",
638
638
  schema: {
639
639
  input: {
@@ -670,7 +670,7 @@ function createFetchPlainAction(options) {
670
670
  });
671
671
  }
672
672
 
673
- const examples$7 = [
673
+ const examples$5 = [
674
674
  {
675
675
  description: "Downloads a file and places it in the workspace.",
676
676
  example: yaml__default["default"].stringify({
@@ -694,7 +694,7 @@ function createFetchPlainFileAction(options) {
694
694
  return pluginScaffolderNode.createTemplateAction({
695
695
  id: "fetch:plain:file",
696
696
  description: "Downloads single file and places it in the workspace.",
697
- examples: examples$7,
697
+ examples: examples$5,
698
698
  schema: {
699
699
  input: {
700
700
  type: "object",
@@ -962,7 +962,7 @@ const createDefaultFilters = ({
962
962
  };
963
963
  };
964
964
 
965
- const examples$6 = [
965
+ const examples$4 = [
966
966
  {
967
967
  description: "Downloads a skelaton directory that lives alongside the template file and fill it out with values.",
968
968
  example: yaml__default["default"].stringify({
@@ -998,7 +998,7 @@ function createFetchTemplateAction(options) {
998
998
  return pluginScaffolderNode.createTemplateAction({
999
999
  id: "fetch:template",
1000
1000
  description: "Downloads a skeleton, templates variables into file and directory names and content, and places the result in the workspace, or optionally in a subdirectory specified by the `targetPath` input option.",
1001
- examples: examples$6,
1001
+ examples: examples$4,
1002
1002
  schema: {
1003
1003
  input: {
1004
1004
  type: "object",
@@ -1203,7 +1203,7 @@ function containsSkippedContent(localOutputPath) {
1203
1203
  return localOutputPath === "" || localOutputPath.startsWith("/") || localOutputPath.includes("//");
1204
1204
  }
1205
1205
 
1206
- const examples$5 = [
1206
+ const examples$3 = [
1207
1207
  {
1208
1208
  description: "Delete specified files",
1209
1209
  example: yaml__namespace.stringify({
@@ -1225,7 +1225,7 @@ const createFilesystemDeleteAction = () => {
1225
1225
  return pluginScaffolderNode.createTemplateAction({
1226
1226
  id: "fs:delete",
1227
1227
  description: "Deletes files and directories from the workspace",
1228
- examples: examples$5,
1228
+ examples: examples$3,
1229
1229
  schema: {
1230
1230
  input: {
1231
1231
  required: ["files"],
@@ -1262,7 +1262,7 @@ const createFilesystemDeleteAction = () => {
1262
1262
  });
1263
1263
  };
1264
1264
 
1265
- const examples$4 = [
1265
+ const examples$2 = [
1266
1266
  {
1267
1267
  description: "Rename specified files ",
1268
1268
  example: yaml__namespace.stringify({
@@ -1288,7 +1288,7 @@ const createFilesystemRenameAction = () => {
1288
1288
  return pluginScaffolderNode.createTemplateAction({
1289
1289
  id: "fs:rename",
1290
1290
  description: "Renames files and directories within the workspace",
1291
- examples: examples$4,
1291
+ examples: examples$2,
1292
1292
  schema: {
1293
1293
  input: {
1294
1294
  required: ["files"],
@@ -2170,7 +2170,7 @@ const commitHash = {
2170
2170
  type: "string"
2171
2171
  };
2172
2172
 
2173
- const examples$3 = [
2173
+ const examples$1 = [
2174
2174
  {
2175
2175
  description: "Creates a GitHub repository with default configuration.",
2176
2176
  example: yaml__default["default"].stringify({
@@ -2223,7 +2223,7 @@ function createGithubRepoCreateAction(options) {
2223
2223
  return pluginScaffolderNode.createTemplateAction({
2224
2224
  id: "github:repo:create",
2225
2225
  description: "Creates a GitHub repository.",
2226
- examples: examples$3,
2226
+ examples: examples$1,
2227
2227
  schema: {
2228
2228
  input: {
2229
2229
  type: "object",
@@ -2330,7 +2330,7 @@ function createGithubRepoCreateAction(options) {
2330
2330
  });
2331
2331
  }
2332
2332
 
2333
- const examples$2 = [
2333
+ const examples = [
2334
2334
  {
2335
2335
  description: "Setup repo with no modifications to branch protection rules",
2336
2336
  example: yaml__default["default"].stringify({
@@ -2382,7 +2382,7 @@ function createGithubRepoPushAction(options) {
2382
2382
  return pluginScaffolderNode.createTemplateAction({
2383
2383
  id: "github:repo:push",
2384
2384
  description: "Initializes a git repository of contents in workspace and publishes it to GitHub.",
2385
- examples: examples$2,
2385
+ examples,
2386
2386
  schema: {
2387
2387
  input: {
2388
2388
  type: "object",
@@ -2929,7 +2929,7 @@ function createPublishAzureAction(options) {
2929
2929
  }
2930
2930
  },
2931
2931
  async handler(ctx) {
2932
- var _a, _b;
2932
+ var _a;
2933
2933
  const {
2934
2934
  repoUrl,
2935
2935
  defaultBranch = "master",
@@ -2946,16 +2946,18 @@ function createPublishAzureAction(options) {
2946
2946
  `Invalid URL provider was included in the repo URL to create ${ctx.input.repoUrl}, missing organization`
2947
2947
  );
2948
2948
  }
2949
- const url = `https://${host}/${organization}`;
2950
- const credentialProvider = integration.DefaultAzureDevOpsCredentialsProvider.fromIntegrations(integrations);
2951
- const credentials = await credentialProvider.getCredentials({ url });
2952
- if (credentials === void 0 && ctx.input.token === void 0) {
2949
+ const integrationConfig = integrations.azure.byHost(host);
2950
+ if (!integrationConfig) {
2953
2951
  throw new errors.InputError(
2954
- `No credentials provided ${url}, please check your integrations config`
2952
+ `No matching integration configuration for host ${host}, please check your integrations config`
2955
2953
  );
2956
2954
  }
2957
- const authHandler = ctx.input.token || (credentials == null ? void 0 : credentials.type) === "pat" ? azureDevopsNodeApi.getPersonalAccessTokenHandler((_a = ctx.input.token) != null ? _a : credentials.token) : azureDevopsNodeApi.getBearerHandler(credentials.token);
2958
- const webApi = new azureDevopsNodeApi.WebApi(url, authHandler);
2955
+ if (!integrationConfig.config.token && !ctx.input.token) {
2956
+ throw new errors.InputError(`No token provided for Azure Integration ${host}`);
2957
+ }
2958
+ const token = (_a = ctx.input.token) != null ? _a : integrationConfig.config.token;
2959
+ const authHandler = azureDevopsNodeApi.getPersonalAccessTokenHandler(token);
2960
+ const webApi = new azureDevopsNodeApi.WebApi(`https://${host}/${organization}`, authHandler);
2959
2961
  const client = await webApi.getGitApi();
2960
2962
  const createOptions = { name: repo };
2961
2963
  const returnedRepo = await client.createRepository(createOptions, owner);
@@ -2980,15 +2982,14 @@ function createPublishAzureAction(options) {
2980
2982
  name: gitAuthorName ? gitAuthorName : config.getOptionalString("scaffolder.defaultAuthor.name"),
2981
2983
  email: gitAuthorEmail ? gitAuthorEmail : config.getOptionalString("scaffolder.defaultAuthor.email")
2982
2984
  };
2983
- const auth = ctx.input.token || (credentials == null ? void 0 : credentials.type) === "pat" ? {
2984
- username: "notempty",
2985
- password: (_b = ctx.input.token) != null ? _b : credentials.token
2986
- } : { token: credentials.token };
2987
2985
  const commitResult = await initRepoAndPush({
2988
2986
  dir: getRepoSourceDirectory(ctx.workspacePath, ctx.input.sourcePath),
2989
2987
  remoteUrl,
2990
2988
  defaultBranch,
2991
- auth,
2989
+ auth: {
2990
+ username: "notempty",
2991
+ password: token
2992
+ },
2992
2993
  logger: ctx.logger,
2993
2994
  commitMessage: gitCommitMessage ? gitCommitMessage : config.getOptionalString("scaffolder.defaultCommitMessage"),
2994
2995
  gitAuthorInfo
@@ -4165,63 +4166,11 @@ Change-Id: ${changeId}`;
4165
4166
  });
4166
4167
  }
4167
4168
 
4168
- const examples$1 = [
4169
- {
4170
- description: "Initializes a git repository of contents in workspace and publish it to GitHub with default configuration.",
4171
- example: yaml__default["default"].stringify({
4172
- steps: [
4173
- {
4174
- id: "publish",
4175
- action: "publish:github",
4176
- name: "Publish to GitHub",
4177
- input: {
4178
- repoUrl: "github.com?repo=repo&owner=owner"
4179
- }
4180
- }
4181
- ]
4182
- })
4183
- },
4184
- {
4185
- description: "Add a description.",
4186
- example: yaml__default["default"].stringify({
4187
- steps: [
4188
- {
4189
- id: "publish",
4190
- action: "publish:github",
4191
- name: "Publish to GitHub",
4192
- input: {
4193
- repoUrl: "github.com?repo=repo&owner=owner",
4194
- description: "Initialize a git repository"
4195
- }
4196
- }
4197
- ]
4198
- })
4199
- },
4200
- {
4201
- description: "Change visibility of the repository.",
4202
- example: yaml__default["default"].stringify({
4203
- steps: [
4204
- {
4205
- id: "publish",
4206
- action: "publish:github",
4207
- name: "Publish to GitHub",
4208
- input: {
4209
- repoUrl: "github.com?repo=repo&owner=owner",
4210
- description: "Initialize a git repository",
4211
- repoVisibility: "public"
4212
- }
4213
- }
4214
- ]
4215
- })
4216
- }
4217
- ];
4218
-
4219
4169
  function createPublishGithubAction(options) {
4220
4170
  const { integrations, config, githubCredentialsProvider } = options;
4221
4171
  return pluginScaffolderNode.createTemplateAction({
4222
4172
  id: "publish:github",
4223
4173
  description: "Initializes a git repository of contents in workspace and publishes it to GitHub.",
4224
- examples: examples$1,
4225
4174
  schema: {
4226
4175
  input: {
4227
4176
  type: "object",
@@ -4699,63 +4648,11 @@ const createPublishGithubPullRequestAction = (options) => {
4699
4648
  }
4700
4649
  };
4701
4650
 
4702
- const examples = [
4703
- {
4704
- description: "Initializes a git repository of the content in the workspace, and publishes it to GitLab.",
4705
- example: yaml__default["default"].stringify({
4706
- steps: [
4707
- {
4708
- id: "publish",
4709
- action: "publish:gitlab",
4710
- name: "Publish to GitLab",
4711
- input: {
4712
- repoUrl: "gitlab.com?repo=project_name&owner=group_name"
4713
- }
4714
- }
4715
- ]
4716
- })
4717
- },
4718
- {
4719
- description: "Add a description.",
4720
- example: yaml__default["default"].stringify({
4721
- steps: [
4722
- {
4723
- id: "publish",
4724
- action: "publish:gitlab",
4725
- name: "Publish to GitLab",
4726
- input: {
4727
- repoUrl: "gitlab.com?repo=project_name&owner=group_name",
4728
- description: "Initialize a git repository"
4729
- }
4730
- }
4731
- ]
4732
- })
4733
- },
4734
- {
4735
- description: "Sets the commit message on the repository. The default value is `initial commit`.",
4736
- example: yaml__default["default"].stringify({
4737
- steps: [
4738
- {
4739
- id: "publish",
4740
- action: "publish:gitlab",
4741
- name: "Publish to GitLab",
4742
- input: {
4743
- repoUrl: "gitlab.com?repo=project_name&owner=group_name",
4744
- description: "Initialize a git repository",
4745
- gitCommitMessage: "Started a project."
4746
- }
4747
- }
4748
- ]
4749
- })
4750
- }
4751
- ];
4752
-
4753
4651
  function createPublishGitlabAction(options) {
4754
4652
  const { integrations, config } = options;
4755
4653
  return pluginScaffolderNode.createTemplateAction({
4756
4654
  id: "publish:gitlab",
4757
4655
  description: "Initializes a git repository of the content in the workspace, and publishes it to GitLab.",
4758
- examples,
4759
4656
  schema: {
4760
4657
  input: {
4761
4658
  type: "object",
@@ -5409,19 +5306,13 @@ class DatabaseTaskStore {
5409
5306
  }
5410
5307
  async listStaleTasks(options) {
5411
5308
  const { timeoutS } = options;
5412
- let heartbeatInterval = this.db.raw(`? - interval '${timeoutS} seconds'`, [
5413
- this.db.fn.now()
5414
- ]);
5415
- if (this.db.client.config.client.includes("mysql")) {
5416
- heartbeatInterval = this.db.raw(
5417
- `date_sub(now(), interval ${timeoutS} second)`
5418
- );
5419
- } else if (this.db.client.config.client.includes("sqlite3")) {
5420
- heartbeatInterval = this.db.raw(`datetime('now', ?)`, [
5421
- `-${timeoutS} seconds`
5422
- ]);
5423
- }
5424
- const rawRows = await this.db("tasks").where("status", "processing").andWhere("last_heartbeat_at", "<=", heartbeatInterval);
5309
+ const rawRows = await this.db("tasks").where("status", "processing").andWhere(
5310
+ "last_heartbeat_at",
5311
+ "<=",
5312
+ this.db.client.config.client.includes("sqlite3") ? this.db.raw(`datetime('now', ?)`, [`-${timeoutS} seconds`]) : this.db.raw(`? - interval '${timeoutS} seconds'`, [
5313
+ this.db.fn.now()
5314
+ ])
5315
+ );
5425
5316
  const tasks = rawRows.map((row) => ({
5426
5317
  taskId: row.id
5427
5318
  }));
@@ -7104,4 +6995,4 @@ exports.createRouter = createRouter;
7104
6995
  exports.createWaitAction = createWaitAction;
7105
6996
  exports.scaffolderActionRules = scaffolderActionRules;
7106
6997
  exports.scaffolderTemplateRules = scaffolderTemplateRules;
7107
- //# sourceMappingURL=ScaffolderEntitiesProcessor-a60339ce.cjs.js.map
6998
+ //# sourceMappingURL=ScaffolderEntitiesProcessor-4b7489dd.cjs.js.map