@backstage/plugin-scaffolder-backend 0.0.0-nightly-20220705025009 → 0.0.0-nightly-20220708025041

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,6 +1,6 @@
1
1
  # @backstage/plugin-scaffolder-backend
2
2
 
3
- ## 0.0.0-nightly-20220705025009
3
+ ## 0.0.0-nightly-20220708025041
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -11,6 +11,40 @@
11
11
  ### Patch Changes
12
12
 
13
13
  - 801d606909: Improve error messaging when passing in malformed auth
14
+ - af02f54483: new setUserAsOwner flag for publish:gitlab action
15
+
16
+ The field default is `false`. When true it will use the token configured in the gitlab integration for the matching host, to try and set the user logged in via `repoUrlPicker` `requestUserCredentials` OAuth flow as owner of the repository created in GitLab.
17
+
18
+ - a70869e775: Updated dependency `msw` to `^0.43.0`.
19
+ - 679b32172e: Updated dependency `knex` to `^2.0.0`.
20
+ - 735853353b: Updated dependency `@octokit/webhooks` to `^10.0.0`.
21
+ - e2d7b76f43: Upgrade git-url-parse to 12.0.0.
22
+
23
+ Motivation for upgrade is transitively upgrading parse-url which is vulnerable
24
+ to several CVEs detected by Snyk.
25
+
26
+ - SNYK-JS-PARSEURL-2935944
27
+ - SNYK-JS-PARSEURL-2935947
28
+ - SNYK-JS-PARSEURL-2936249
29
+
30
+ - Updated dependencies
31
+ - @backstage/backend-common@0.0.0-nightly-20220708025041
32
+ - @backstage/plugin-catalog-backend@0.0.0-nightly-20220708025041
33
+ - @backstage/catalog-model@0.0.0-nightly-20220708025041
34
+ - @backstage/catalog-client@0.0.0-nightly-20220708025041
35
+ - @backstage/integration@0.0.0-nightly-20220708025041
36
+ - @backstage/errors@0.0.0-nightly-20220708025041
37
+ - @backstage/plugin-scaffolder-common@0.0.0-nightly-20220708025041
38
+
39
+ ## 1.4.0-next.2
40
+
41
+ ### Minor Changes
42
+
43
+ - 4baf8a4ece: Update GitLab Merge Request Action to allow source branch to be deleted
44
+ - 2db07887cb: Added two new scaffolder actions: `github:repo:create` and `github:repo:push`
45
+
46
+ ### Patch Changes
47
+
14
48
  - 679b32172e: Updated dependency `knex` to `^2.0.0`.
15
49
  - e2d7b76f43: Upgrade git-url-parse to 12.0.0.
16
50
 
@@ -22,13 +56,10 @@
22
56
  - SNYK-JS-PARSEURL-2936249
23
57
 
24
58
  - Updated dependencies
25
- - @backstage/backend-common@0.0.0-nightly-20220705025009
26
- - @backstage/catalog-model@0.0.0-nightly-20220705025009
27
- - @backstage/plugin-catalog-backend@0.0.0-nightly-20220705025009
28
- - @backstage/errors@0.0.0-nightly-20220705025009
29
- - @backstage/integration@0.0.0-nightly-20220705025009
30
- - @backstage/catalog-client@0.0.0-nightly-20220705025009
31
- - @backstage/plugin-scaffolder-common@0.0.0-nightly-20220705025009
59
+ - @backstage/catalog-model@1.1.0-next.2
60
+ - @backstage/backend-common@0.14.1-next.2
61
+ - @backstage/plugin-catalog-backend@1.2.1-next.2
62
+ - @backstage/integration@1.2.2-next.2
32
63
 
33
64
  ## 1.4.0-next.1
34
65
 
package/dist/index.cjs.js CHANGED
@@ -2721,6 +2721,11 @@ function createPublishGitlabAction(options) {
2721
2721
  title: "Authentication Token",
2722
2722
  type: "string",
2723
2723
  description: "The token to use for authorization to GitLab"
2724
+ },
2725
+ setUserAsOwner: {
2726
+ title: "Set User As Owner",
2727
+ type: "boolean",
2728
+ 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
2729
  }
2725
2730
  }
2726
2731
  },
@@ -2745,7 +2750,8 @@ function createPublishGitlabAction(options) {
2745
2750
  defaultBranch = "master",
2746
2751
  gitCommitMessage = "initial commit",
2747
2752
  gitAuthorName,
2748
- gitAuthorEmail
2753
+ gitAuthorEmail,
2754
+ setUserAsOwner = false
2749
2755
  } = ctx.input;
2750
2756
  const { owner, repo, host } = parseRepoUrl(repoUrl, integrations);
2751
2757
  if (!owner) {
@@ -2765,15 +2771,22 @@ function createPublishGitlabAction(options) {
2765
2771
  [tokenType]: token
2766
2772
  });
2767
2773
  let { id: targetNamespace } = await client.Namespaces.show(owner);
2774
+ const { id: userId } = await client.Users.current();
2768
2775
  if (!targetNamespace) {
2769
- const { id } = await client.Users.current();
2770
- targetNamespace = id;
2776
+ targetNamespace = userId;
2771
2777
  }
2772
- const { http_url_to_repo } = await client.Projects.create({
2778
+ const { id: projectId, http_url_to_repo } = await client.Projects.create({
2773
2779
  namespace_id: targetNamespace,
2774
2780
  name: repo,
2775
2781
  visibility: repoVisibility
2776
2782
  });
2783
+ if (setUserAsOwner && integrationConfig.config.token) {
2784
+ const adminClient = new node.Gitlab({
2785
+ host: integrationConfig.config.baseUrl,
2786
+ token: integrationConfig.config.token
2787
+ });
2788
+ await adminClient.ProjectMembers.add(projectId, userId, 50);
2789
+ }
2777
2790
  const remoteUrl = http_url_to_repo.replace(/\.git$/, "");
2778
2791
  const repoContentsUrl = `${remoteUrl}/-/blob/${defaultBranch}`;
2779
2792
  const gitAuthorInfo = {