@backstage/plugin-scaffolder-backend 1.3.0-next.2 → 1.3.0

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,5 +1,50 @@
1
1
  # @backstage/plugin-scaffolder-backend
2
2
 
3
+ ## 1.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 35a26131b3: **DEPRECATION**: The `projectid` input parameters to the `publish:gitlab:merge-request`, it's no longer required as it can be decoded from the `repoUrl` input parameter.
8
+ **DEPRECATION**: The `projectid` output of the action in favour of `projectPath`
9
+ - 72dfcbc8bf: A new scaffolder action has been added: `gerrit:publish`
10
+ - ce0d8d7eb1: Fixed a bug in `publish:github` action that didn't permit to add users as collaborators.
11
+ This fix required changing the way parameters are passed to the action.
12
+ In order to add a team as collaborator, now you must use the `team` field instead of `username`.
13
+ In order to add a user as collaborator, you must use the `user` field.
14
+
15
+ It's still possible to use the field `username` but is deprecated in favor of `team`.
16
+
17
+ ```yaml
18
+ - id: publish
19
+ name: Publish
20
+ action: publish:github
21
+ input:
22
+ repoUrl: ...
23
+ collaborators:
24
+ - access: ...
25
+ team: my_team
26
+ - access: ...
27
+ user: my_username
28
+ ```
29
+
30
+ - 582003a059: - Added an optional `list` method on the `TaskBroker` and `TaskStore` interface to list tasks by an optional `userEntityRef`
31
+ - Implemented a `list` method on the `DatabaseTaskStore` class to list tasks by an optional `userEntityRef`
32
+ - Added a route under `/v2/tasks` to list tasks by a `userEntityRef` using the `createdBy` query parameter
33
+ - c042c5eaff: Add an option to not protect the default branch.
34
+ - f93af969cd: Added the ability to support running of templates that are not in the `default` namespace
35
+
36
+ ### Patch Changes
37
+
38
+ - 8f7b1835df: Updated dependency `msw` to `^0.41.0`.
39
+ - 6901f6be4a: Adds more of an explanation when the `publish:github` scaffolder action fails to create a repository.
40
+ - Updated dependencies
41
+ - @backstage/plugin-catalog-backend@1.2.0
42
+ - @backstage/backend-common@0.14.0
43
+ - @backstage/integration@1.2.1
44
+ - @backstage/catalog-client@1.0.3
45
+ - @backstage/catalog-model@1.0.3
46
+ - @backstage/plugin-scaffolder-common@1.1.1
47
+
3
48
  ## 1.3.0-next.2
4
49
 
5
50
  ### Minor Changes
package/dist/index.cjs.js CHANGED
@@ -2416,7 +2416,7 @@ const createPublishGitlabMergeRequestAction = (options) => {
2416
2416
  id: "publish:gitlab:merge-request",
2417
2417
  schema: {
2418
2418
  input: {
2419
- required: ["projectid", "repoUrl", "targetPath", "branchName"],
2419
+ required: ["repoUrl", "targetPath", "branchName"],
2420
2420
  type: "object",
2421
2421
  properties: {
2422
2422
  repoUrl: {
@@ -2463,6 +2463,10 @@ const createPublishGitlabMergeRequestAction = (options) => {
2463
2463
  title: "Gitlab Project id/Name(slug)",
2464
2464
  type: "string"
2465
2465
  },
2466
+ projectPath: {
2467
+ title: "Gitlab Project path",
2468
+ type: "string"
2469
+ },
2466
2470
  mergeRequestURL: {
2467
2471
  title: "MergeRequest(MR) URL",
2468
2472
  type: "string",
@@ -2474,7 +2478,13 @@ const createPublishGitlabMergeRequestAction = (options) => {
2474
2478
  async handler(ctx) {
2475
2479
  var _a;
2476
2480
  const repoUrl = ctx.input.repoUrl;
2477
- const { host } = parseRepoUrl(repoUrl, integrations);
2481
+ const { host, owner, repo } = parseRepoUrl(repoUrl, integrations);
2482
+ const projectPath = `${owner}/${repo}`;
2483
+ if (ctx.input.projectid) {
2484
+ const deprecationWarning = `Property "projectid" is deprecated and no longer to needed to create a MR`;
2485
+ ctx.logger.warn(deprecationWarning);
2486
+ console.warn(deprecationWarning);
2487
+ }
2478
2488
  const integrationConfig = integrations.gitlab.byHost(host);
2479
2489
  const destinationBranch = ctx.input.branchName;
2480
2490
  if (!integrationConfig) {
@@ -2500,23 +2510,24 @@ const createPublishGitlabMergeRequestAction = (options) => {
2500
2510
  content: file.content.toString("base64"),
2501
2511
  execute_filemode: file.executable
2502
2512
  }));
2503
- const projects = await api.Projects.show(ctx.input.projectid);
2513
+ const projects = await api.Projects.show(projectPath);
2504
2514
  const { default_branch: defaultBranch } = projects;
2505
2515
  try {
2506
- await api.Branches.create(ctx.input.projectid, destinationBranch, String(defaultBranch));
2516
+ await api.Branches.create(projectPath, destinationBranch, String(defaultBranch));
2507
2517
  } catch (e) {
2508
2518
  throw new errors.InputError(`The branch creation failed ${e}`);
2509
2519
  }
2510
2520
  try {
2511
- await api.Commits.create(ctx.input.projectid, destinationBranch, ctx.input.title, actions);
2521
+ await api.Commits.create(projectPath, destinationBranch, ctx.input.title, actions);
2512
2522
  } catch (e) {
2513
2523
  throw new errors.InputError(`Committing the changes to ${destinationBranch} failed ${e}`);
2514
2524
  }
2515
2525
  try {
2516
- const mergeRequestUrl = await api.MergeRequests.create(ctx.input.projectid, destinationBranch, String(defaultBranch), ctx.input.title, { description: ctx.input.description }).then((mergeRequest) => {
2526
+ const mergeRequestUrl = await api.MergeRequests.create(projectPath, destinationBranch, String(defaultBranch), ctx.input.title, { description: ctx.input.description }).then((mergeRequest) => {
2517
2527
  return mergeRequest.web_url;
2518
2528
  });
2519
- ctx.output("projectid", ctx.input.projectid);
2529
+ ctx.output("projectid", projectPath);
2530
+ ctx.output("projectPath", projectPath);
2520
2531
  ctx.output("mergeRequestUrl", mergeRequestUrl);
2521
2532
  } catch (e) {
2522
2533
  throw new errors.InputError(`Merge request creation failed${e}`);
@@ -3590,9 +3601,6 @@ function getEntityBaseUrl(entity) {
3590
3601
  }
3591
3602
  async function findTemplate(options) {
3592
3603
  const { entityRef, token, catalogApi } = options;
3593
- if (entityRef.namespace.toLocaleLowerCase("en-US") !== catalogModel.DEFAULT_NAMESPACE) {
3594
- throw new errors.InputError(`Invalid namespace, only '${catalogModel.DEFAULT_NAMESPACE}' namespace is supported`);
3595
- }
3596
3604
  if (entityRef.kind.toLocaleLowerCase("en-US") !== "template") {
3597
3605
  throw new errors.InputError(`Invalid kind, only 'Template' kind is supported`);
3598
3606
  }