@backstage/plugin-scaffolder-backend-module-gitlab 0.7.1-next.0 → 0.7.1

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,30 @@
1
1
  # @backstage/plugin-scaffolder-backend-module-gitlab
2
2
 
3
+ ## 0.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 8fb529a: Added `reviewerIds` to the Gitlab Merge Request action.
8
+ - a913beb: Added action `gitlab:group:migrate` to migrate projects using `bulk_import`
9
+ - 7b62987: Updated the path field in the `gitlab:group:ensureExists` action to accept an array of either strings or objects with name and slug fields.
10
+ - Updated dependencies
11
+ - @backstage/plugin-scaffolder-node@0.6.3
12
+ - @backstage/integration@1.16.1
13
+ - @backstage/backend-plugin-api@1.1.1
14
+ - @backstage/config@1.3.2
15
+ - @backstage/errors@1.2.7
16
+
17
+ ## 0.7.1-next.1
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies
22
+ - @backstage/backend-plugin-api@1.1.1-next.1
23
+ - @backstage/config@1.3.2-next.0
24
+ - @backstage/errors@1.2.7-next.0
25
+ - @backstage/plugin-scaffolder-node@0.6.3-next.1
26
+ - @backstage/integration@1.16.1-next.0
27
+
3
28
  ## 0.7.1-next.0
4
29
 
5
30
  ### Patch Changes
@@ -16,9 +16,17 @@ const createGitlabGroupEnsureExistsAction = (options) => {
16
16
  schema: {
17
17
  input: commonGitlabConfig.default.merge(
18
18
  zod.z.object({
19
- path: zod.z.array(zod.z.string(), {
20
- description: "A path of group names that is ensured to exist"
21
- }).min(1)
19
+ path: zod.z.array(
20
+ zod.z.string().or(
21
+ zod.z.object({
22
+ name: zod.z.string(),
23
+ slug: zod.z.string()
24
+ })
25
+ ),
26
+ {
27
+ description: "A path of group names or objects (name and slug) that is ensured to exist"
28
+ }
29
+ ).min(1)
22
30
  })
23
31
  ),
24
32
  output: zod.z.object({
@@ -36,7 +44,9 @@ const createGitlabGroupEnsureExistsAction = (options) => {
36
44
  let currentPath = null;
37
45
  let parentId = null;
38
46
  for (const pathElement of path) {
39
- const fullPath = currentPath ? `${currentPath}/${pathElement}` : pathElement;
47
+ const slug = typeof pathElement === "string" ? pathElement : pathElement.slug;
48
+ const name = typeof pathElement === "string" ? pathElement : pathElement.name;
49
+ const fullPath = currentPath ? `${currentPath}/${slug}` : slug;
40
50
  const result = await api.Groups.search(
41
51
  fullPath
42
52
  );
@@ -46,8 +56,8 @@ const createGitlabGroupEnsureExistsAction = (options) => {
46
56
  if (!subGroup) {
47
57
  ctx.logger.info(`creating missing group ${fullPath}`);
48
58
  parentId = (await api.Groups.create(
49
- pathElement,
50
- pathElement,
59
+ name,
60
+ slug,
51
61
  parentId ? {
52
62
  parentId
53
63
  } : {}
@@ -1 +1 @@
1
- {"version":3,"file":"gitlabGroupEnsureExists.cjs.js","sources":["../../src/actions/gitlabGroupEnsureExists.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { GroupSchema } from '@gitbeaker/rest';\nimport { z } from 'zod';\nimport commonGitlabConfig from '../commonGitlabConfig';\nimport { getClient, parseRepoUrl } from '../util';\nimport { examples } from './gitlabGroupEnsureExists.examples';\n\n/**\n * Creates an `gitlab:group:ensureExists` Scaffolder action.\n *\n * @public\n */\nexport const createGitlabGroupEnsureExistsAction = (options: {\n integrations: ScmIntegrationRegistry;\n}) => {\n const { integrations } = options;\n\n return createTemplateAction({\n id: 'gitlab:group:ensureExists',\n description: 'Ensures a Gitlab group exists',\n supportsDryRun: true,\n examples,\n schema: {\n input: commonGitlabConfig.merge(\n z.object({\n path: z\n .array(z.string(), {\n description: 'A path of group names that is ensured to exist',\n })\n .min(1),\n }),\n ),\n output: z.object({\n groupId: z\n .number({ description: 'The id of the innermost sub-group' })\n .optional(),\n }),\n },\n async handler(ctx) {\n if (ctx.isDryRun) {\n ctx.output('groupId', 42);\n return;\n }\n\n const { token, repoUrl, path } = ctx.input;\n\n const { host } = parseRepoUrl(repoUrl, integrations);\n\n const api = getClient({ host, integrations, token });\n\n let currentPath: string | null = null;\n let parentId: number | null = null;\n for (const pathElement of path) {\n const fullPath: string = currentPath\n ? `${currentPath}/${pathElement}`\n : pathElement;\n const result = (await api.Groups.search(\n fullPath,\n )) as unknown as Array<GroupSchema>; // recast since the return type for search is wrong in the gitbeaker typings\n const subGroup = result.find(\n searchPathElem => searchPathElem.full_path === fullPath,\n );\n if (!subGroup) {\n ctx.logger.info(`creating missing group ${fullPath}`);\n parentId = (\n await api.Groups.create(\n pathElement,\n pathElement,\n parentId\n ? {\n parentId: parentId,\n }\n : {},\n )\n )?.id;\n } else {\n parentId = subGroup.id;\n }\n currentPath = fullPath;\n }\n if (parentId !== null) {\n ctx.output('groupId', parentId);\n }\n },\n });\n};\n"],"names":["createTemplateAction","examples","commonGitlabConfig","z","parseRepoUrl","getClient"],"mappings":";;;;;;;;AA6Ba,MAAA,mCAAA,GAAsC,CAAC,OAE9C,KAAA;AACJ,EAAM,MAAA,EAAE,cAAiB,GAAA,OAAA;AAEzB,EAAA,OAAOA,yCAAqB,CAAA;AAAA,IAC1B,EAAI,EAAA,2BAAA;AAAA,IACJ,WAAa,EAAA,+BAAA;AAAA,IACb,cAAgB,EAAA,IAAA;AAAA,cAChBC,yCAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,OAAOC,0BAAmB,CAAA,KAAA;AAAA,QACxBC,MAAE,MAAO,CAAA;AAAA,U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,GAAA,CAAA,MAAM,IAAI,MAAO,CAAA,MAAA;AAAA,YACf,WAAA;AAAA,YACA,WAAA;AAAA,YACA,QACI,GAAA;AAAA,cACE;AAAA,gBAEF;AAAC,WAEN,GAAA,EAAA;AAAA,SACE,MAAA;AACL,UAAA,QAAA,GAAW,QAAS,CAAA,EAAA;AAAA;AAEtB,QAAc,WAAA,GAAA,QAAA;AAAA;AAEhB,MAAA,IAAI,aAAa,IAAM,EAAA;AACrB,QAAI,GAAA,CAAA,MAAA,CAAO,WAAW,QAAQ,CAAA;AAAA;AAChC;AACF,GACD,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"gitlabGroupEnsureExists.cjs.js","sources":["../../src/actions/gitlabGroupEnsureExists.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { GroupSchema } from '@gitbeaker/rest';\nimport { z } from 'zod';\nimport commonGitlabConfig from '../commonGitlabConfig';\nimport { getClient, parseRepoUrl } from '../util';\nimport { examples } from './gitlabGroupEnsureExists.examples';\n\n/**\n * Creates an `gitlab:group:ensureExists` Scaffolder action.\n *\n * @public\n */\nexport const createGitlabGroupEnsureExistsAction = (options: {\n integrations: ScmIntegrationRegistry;\n}) => {\n const { integrations } = options;\n\n return createTemplateAction({\n id: 'gitlab:group:ensureExists',\n description: 'Ensures a Gitlab group exists',\n supportsDryRun: true,\n examples,\n schema: {\n input: commonGitlabConfig.merge(\n z.object({\n path: z\n .array(\n z.string().or(\n z.object({\n name: z.string(),\n slug: z.string(),\n }),\n ),\n {\n description:\n 'A path of group names or objects (name and slug) that is ensured to exist',\n },\n )\n .min(1),\n }),\n ),\n output: z.object({\n groupId: z\n .number({ description: 'The id of the innermost sub-group' })\n .optional(),\n }),\n },\n async handler(ctx) {\n if (ctx.isDryRun) {\n ctx.output('groupId', 42);\n return;\n }\n\n const { token, repoUrl, path } = ctx.input;\n\n const { host } = parseRepoUrl(repoUrl, integrations);\n\n const api = getClient({ host, integrations, token });\n\n let currentPath: string | null = null;\n let parentId: number | null = null;\n for (const pathElement of path) {\n const slug =\n typeof pathElement === 'string' ? pathElement : pathElement.slug;\n const name =\n typeof pathElement === 'string' ? pathElement : pathElement.name;\n const fullPath: string = currentPath ? `${currentPath}/${slug}` : slug;\n const result = (await api.Groups.search(\n fullPath,\n )) as unknown as Array<GroupSchema>; // recast since the return type for search is wrong in the gitbeaker typings\n const subGroup = result.find(\n searchPathElem => searchPathElem.full_path === fullPath,\n );\n if (!subGroup) {\n ctx.logger.info(`creating missing group ${fullPath}`);\n parentId = (\n await api.Groups.create(\n name,\n slug,\n parentId\n ? {\n parentId: parentId,\n }\n : {},\n )\n )?.id;\n } else {\n parentId = subGroup.id;\n }\n currentPath = fullPath;\n }\n if (parentId !== null) {\n ctx.output('groupId', parentId);\n }\n },\n });\n};\n"],"names":["createTemplateAction","examples","commonGitlabConfig","z","parseRepoUrl","getClient"],"mappings":";;;;;;;;AA6Ba,MAAA,mCAAA,GAAsC,CAAC,OAE9C,KAAA;AACJ,EAAM,MAAA,EAAE,cAAiB,GAAA,OAAA;AAEzB,EAAA,OAAOA,yCAAqB,CAAA;AAAA,IAC1B,EAAI,EAAA,2BAAA;AAAA,IACJ,WAAa,EAAA,+BAAA;AAAA,IACb,cAAgB,EAAA,IAAA;AAAA,cAChBC,yCAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,OAAOC,0BAAmB,CAAA,KAAA;AAAA,QACxBC,MAAE,MAAO,CAAA;AA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MAAA,GAAU,MAAM,GAAA,CAAI,MAAO,CAAA,MAAA;AAAA,UAC/B;AAAA,SACF;AACA,QAAA,MAAM,WAAW,MAAO,CAAA,IAAA;AAAA,UACtB,CAAA,cAAA,KAAkB,eAAe,SAAc,KAAA;AAAA,SACjD;AACA,QAAA,IAAI,CAAC,QAAU,EAAA;AACb,UAAA,GAAA,CAAI,MAAO,CAAA,IAAA,CAAK,CAA0B,uBAAA,EAAA,QAAQ,CAAE,CAAA,CAAA;AACpD,UACE,QAAA,GAAA,CAAA,MAAM,IAAI,MAAO,CAAA,MAAA;AAAA,YACf,IAAA;AAAA,YACA,IAAA;AAAA,YACA,QACI,GAAA;AAAA,cACE;AAAA,gBAEF;AAAC,WAEN,GAAA,EAAA;AAAA,SACE,MAAA;AACL,UAAA,QAAA,GAAW,QAAS,CAAA,EAAA;AAAA;AAEtB,QAAc,WAAA,GAAA,QAAA;AAAA;AAEhB,MAAA,IAAI,aAAa,IAAM,EAAA;AACrB,QAAI,GAAA,CAAA,MAAA,CAAO,WAAW,QAAQ,CAAA;AAAA;AAChC;AACF,GACD,CAAA;AACH;;;;"}
@@ -71,6 +71,26 @@ const examples = [
71
71
  }
72
72
  ]
73
73
  })
74
+ },
75
+ {
76
+ description: "Create a group nested within another group using objects",
77
+ example: yaml__default.default.stringify({
78
+ steps: [
79
+ {
80
+ id: "gitlabGroup",
81
+ name: "Group",
82
+ action: "gitlab:group:ensureExists",
83
+ input: {
84
+ repoUrl: "gitlab.com",
85
+ path: [
86
+ { name: "Group 1", slug: "group1" },
87
+ { name: "Group 2", slug: "group2" },
88
+ { name: "Group 3", slug: "group3" }
89
+ ]
90
+ }
91
+ }
92
+ ]
93
+ })
74
94
  }
75
95
  ];
76
96
 
@@ -1 +1 @@
1
- {"version":3,"file":"gitlabGroupEnsureExists.examples.cjs.js","sources":["../../src/actions/gitlabGroupEnsureExists.examples.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Creating a group at the top level',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: ['group1'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a group nested within another group',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: ['group1', 'group2'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a group nested within multiple other groups',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: ['group1', 'group2', 'group3'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a group in dry run mode',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n isDryRun: true,\n input: {\n repoUrl: 'https://gitlab.com/my-repo',\n path: ['group1', 'group2', 'group3'],\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAkBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,mCAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,aAAA;AAAA,UACJ,IAAM,EAAA,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;AACF,KACD;AAAA;AAEL;;;;"}
1
+ {"version":3,"file":"gitlabGroupEnsureExists.examples.cjs.js","sources":["../../src/actions/gitlabGroupEnsureExists.examples.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Creating a group at the top level',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: ['group1'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a group nested within another group',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: ['group1', 'group2'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a group nested within multiple other groups',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: ['group1', 'group2', 'group3'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a group in dry run mode',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n isDryRun: true,\n input: {\n repoUrl: 'https://gitlab.com/my-repo',\n path: ['group1', 'group2', 'group3'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a group nested within another group using objects',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: [\n { name: 'Group 1', slug: 'group1' },\n { name: 'Group 2', slug: 'group2' },\n { name: 'Group 3', slug: 'group3' },\n ],\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAkBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,mCAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,aAAA;AAAA,UACJ,IAAM,EAAA,OAAA;AAAA,UACN,MAAQ,EAAA,2BAAA;AAAA,UACR,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,YAAA;AAAA,YACT,IAAA,EAAM,CAAC,QAAQ;AAAA;AACjB;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,4CAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,aAAA;AAAA,UACJ,IAAM,EAAA,OAAA;AAAA,UACN,MAAQ,EAAA,2BAAA;AAAA,UACR,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,YAAA;AAAA,YACT,IAAA,EAAM,CAAC,QAAA,EAAU,QAAQ;AAAA;AAC3B;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,oDAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,aAAA;AAAA,UACJ,IAAM,EAAA,OAAA;AAAA,UACN,MAAQ,EAAA,2BAAA;AAAA,UACR,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,YAAA;AAAA,YACT,IAAM,EAAA,CAAC,QAAU,EAAA,QAAA,EAAU,QAAQ;AAAA;AACrC;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,gCAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,aAAA;AAAA,UACJ,IAAM,EAAA,OAAA;AAAA,UACN,MAAQ,EAAA,2BAAA;AAAA,UACR,QAAU,EAAA,IAAA;AAAA,UACV,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,4BAAA;AAAA,YACT,IAAM,EAAA,CAAC,QAAU,EAAA,QAAA,EAAU,QAAQ;AAAA;AACrC;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,0DAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,aAAA;AAAA,UACJ,IAAM,EAAA,OAAA;AAAA,UACN,MAAQ,EAAA,2BAAA;AAAA,UACR,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,YAAA;AAAA,YACT,IAAM,EAAA;AAAA,cACJ,EAAE,IAAA,EAAM,SAAW,EAAA,IAAA,EAAM,QAAS,EAAA;AAAA,cAClC,EAAE,IAAA,EAAM,SAAW,EAAA,IAAA,EAAM,QAAS,EAAA;AAAA,cAClC,EAAE,IAAA,EAAM,SAAW,EAAA,IAAA,EAAM,QAAS;AAAA;AACpC;AACF;AACF;AACF,KACD;AAAA;AAEL;;;;"}
@@ -113,6 +113,14 @@ which uses additional API calls in order to detect whether to 'create', 'update'
113
113
  title: "Merge Request Assignee",
114
114
  type: "string",
115
115
  description: "User this merge request will be assigned to"
116
+ },
117
+ reviewers: {
118
+ title: "Merge Request Reviewers",
119
+ type: "array",
120
+ items: {
121
+ type: "string"
122
+ },
123
+ description: "Users that will be assigned as reviewers"
116
124
  }
117
125
  }
118
126
  },
@@ -142,6 +150,7 @@ which uses additional API calls in order to detect whether to 'create', 'update'
142
150
  async handler(ctx) {
143
151
  const {
144
152
  assignee,
153
+ reviewers,
145
154
  branchName,
146
155
  targetBranchName,
147
156
  description,
@@ -172,6 +181,24 @@ which uses additional API calls in order to detect whether to 'create', 'update'
172
181
  );
173
182
  }
174
183
  }
184
+ let reviewerIds = void 0;
185
+ if (reviewers !== void 0) {
186
+ reviewerIds = (await Promise.all(
187
+ reviewers.map(async (reviewer) => {
188
+ try {
189
+ const reviewerUser = await api.Users.all({
190
+ username: reviewer
191
+ });
192
+ return reviewerUser[0].id;
193
+ } catch (e) {
194
+ ctx.logger.warn(
195
+ `Failed to find gitlab user id for ${reviewer}: ${e}. Proceeding with MR creation without reviewer.`
196
+ );
197
+ return void 0;
198
+ }
199
+ })
200
+ )).filter((id) => id !== void 0);
201
+ }
175
202
  let fileRoot;
176
203
  if (sourcePath) {
177
204
  fileRoot = backendPluginApi.resolveSafeChildPath(ctx.workspacePath, sourcePath);
@@ -268,7 +295,7 @@ which uses additional API calls in order to detect whether to 'create', 'update'
268
295
  }
269
296
  }
270
297
  try {
271
- const mergeRequestUrl = await api.MergeRequests.create(
298
+ let mergeRequest = await api.MergeRequests.create(
272
299
  repoID,
273
300
  branchName,
274
301
  String(targetBranch),
@@ -276,13 +303,43 @@ which uses additional API calls in order to detect whether to 'create', 'update'
276
303
  {
277
304
  description,
278
305
  removeSourceBranch: removeSourceBranch ? removeSourceBranch : false,
279
- assigneeId
306
+ assigneeId,
307
+ reviewerIds
280
308
  }
281
- ).then((mergeRequest) => mergeRequest.web_url ?? mergeRequest.webUrl);
309
+ );
310
+ while (mergeRequest.detailed_merge_status === "preparing" || mergeRequest.detailed_merge_status === "approvals_syncing" || mergeRequest.detailed_merge_status === "checking") {
311
+ mergeRequest = await api.MergeRequests.show(repoID, mergeRequest.iid);
312
+ ctx.logger.info(`${mergeRequest.detailed_merge_status}`);
313
+ }
314
+ const approvalRules = await api.MergeRequestApprovals.allApprovalRules(
315
+ repoID,
316
+ {
317
+ mergerequestIId: mergeRequest.iid
318
+ }
319
+ );
320
+ if (approvalRules.length !== 0) {
321
+ const eligibleApprovers = approvalRules.filter((rule) => rule.eligible_approvers !== void 0).map((rule) => {
322
+ return rule.eligible_approvers;
323
+ }).flat();
324
+ const eligibleUserIds = /* @__PURE__ */ new Set([
325
+ ...eligibleApprovers.map((user) => user.id),
326
+ ...reviewerIds ?? []
327
+ ]);
328
+ mergeRequest = await api.MergeRequests.edit(
329
+ repoID,
330
+ mergeRequest.iid,
331
+ {
332
+ reviewerIds: Array.from(eligibleUserIds)
333
+ }
334
+ );
335
+ }
282
336
  ctx.output("projectid", repoID);
283
337
  ctx.output("targetBranchName", targetBranch);
284
338
  ctx.output("projectPath", repoID);
285
- ctx.output("mergeRequestUrl", mergeRequestUrl);
339
+ ctx.output(
340
+ "mergeRequestUrl",
341
+ mergeRequest.web_url ?? mergeRequest.webUrl
342
+ );
286
343
  } catch (e) {
287
344
  throw new errors.InputError(
288
345
  `Merge request creation failed. ${helpers.getErrorMessage(e)}`
@@ -1 +1 @@
1
- {"version":3,"file":"gitlabMergeRequest.cjs.js","sources":["../../src/actions/gitlabMergeRequest.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createTemplateAction,\n parseRepoUrl,\n SerializedFile,\n serializeDirectoryContents,\n} from '@backstage/plugin-scaffolder-node';\nimport { Gitlab, RepositoryTreeSchema, CommitAction } from '@gitbeaker/rest';\nimport path from 'path';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { InputError } from '@backstage/errors';\nimport {\n LoggerService,\n resolveSafeChildPath,\n} from '@backstage/backend-plugin-api';\nimport { createGitlabApi, getErrorMessage } from './helpers';\nimport { examples } from './gitlabMergeRequest.examples';\nimport { createHash } from 'crypto';\n\nfunction computeSha256(file: SerializedFile): string {\n const hash = createHash('sha256');\n hash.update(file.content);\n return hash.digest('hex');\n}\n\nasync function getFileAction(\n fileInfo: { file: SerializedFile; targetPath?: string },\n target: { repoID: string; branch: string },\n api: InstanceType<typeof Gitlab>,\n logger: LoggerService,\n remoteFiles: RepositoryTreeSchema[],\n defaultCommitAction:\n | 'create'\n | 'delete'\n | 'update'\n | 'skip'\n | 'auto' = 'auto',\n): Promise<'create' | 'delete' | 'update' | 'skip'> {\n if (defaultCommitAction === 'auto') {\n const filePath = path.join(fileInfo.targetPath ?? '', fileInfo.file.path);\n\n if (remoteFiles?.some(remoteFile => remoteFile.path === filePath)) {\n try {\n const targetFile = await api.RepositoryFiles.show(\n target.repoID,\n filePath,\n target.branch,\n );\n if (computeSha256(fileInfo.file) === targetFile.content_sha256) {\n return 'skip';\n }\n } catch (error) {\n logger.warn(\n `Unable to retrieve detailed information for remote file ${filePath}`,\n );\n }\n return 'update';\n }\n return 'create';\n }\n return defaultCommitAction;\n}\n\n/**\n * Create a new action that creates a gitlab merge request.\n *\n * @public\n */\nexport const createPublishGitlabMergeRequestAction = (options: {\n integrations: ScmIntegrationRegistry;\n}) => {\n const { integrations } = options;\n\n return createTemplateAction<{\n repoUrl: string;\n title: string;\n description: string;\n branchName: string;\n targetBranchName?: string;\n sourcePath?: string;\n targetPath?: string;\n token?: string;\n commitAction?: 'create' | 'delete' | 'update' | 'skip' | 'auto';\n /** @deprecated projectID passed as query parameters in the repoUrl */\n projectid?: string;\n removeSourceBranch?: boolean;\n assignee?: string;\n }>({\n id: 'publish:gitlab:merge-request',\n examples,\n schema: {\n input: {\n required: ['repoUrl', 'branchName'],\n type: 'object',\n properties: {\n repoUrl: {\n type: 'string',\n title: 'Repository Location',\n description: `\\\nAccepts the format 'gitlab.com?repo=project_name&owner=group_name' where \\\n'project_name' is the repository name and 'group_name' is a group or username`,\n },\n /** @deprecated projectID is passed as query parameters in the repoUrl */\n projectid: {\n type: 'string',\n title: 'projectid',\n description: 'Project ID/Name(slug) of the Gitlab Project',\n },\n title: {\n type: 'string',\n title: 'Merge Request Name',\n description: 'The name for the merge request',\n },\n description: {\n type: 'string',\n title: 'Merge Request Description',\n description: 'The description of the merge request',\n },\n branchName: {\n type: 'string',\n title: 'Source Branch Name',\n description: 'The source branch name of the merge request',\n },\n targetBranchName: {\n type: 'string',\n title: 'Target Branch Name',\n description: 'The target branch name of the merge request',\n },\n sourcePath: {\n type: 'string',\n title: 'Working Subdirectory',\n description: `\\\nSubdirectory of working directory to copy changes from. \\\nFor reasons of backward compatibility, any specified 'targetPath' input will \\\nbe applied in place of an absent/falsy value for this input. \\\nCircumvent this behavior using '.'`,\n },\n targetPath: {\n type: 'string',\n title: 'Repository Subdirectory',\n description: 'Subdirectory of repository to apply changes to',\n },\n token: {\n title: 'Authentication Token',\n type: 'string',\n description: 'The token to use for authorization to GitLab',\n },\n commitAction: {\n title: 'Commit action',\n type: 'string',\n enum: ['create', 'update', 'delete', 'auto'],\n description: `\\\nThe action to be used for git commit. Defaults to the custom 'auto' action provided by backstage,\nwhich uses additional API calls in order to detect whether to 'create', 'update' or 'skip' each source file.`,\n },\n removeSourceBranch: {\n title: 'Delete source branch',\n type: 'boolean',\n description:\n 'Option to delete source branch once the MR has been merged. Default: false',\n },\n assignee: {\n title: 'Merge Request Assignee',\n type: 'string',\n description: 'User this merge request will be assigned to',\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n targetBranchName: {\n title: 'Target branch name of the merge request',\n type: 'string',\n },\n projectid: {\n title: 'Gitlab Project id/Name(slug)',\n type: 'string',\n },\n projectPath: {\n title: 'Gitlab Project path',\n type: 'string',\n },\n mergeRequestUrl: {\n title: 'MergeRequest(MR) URL',\n type: 'string',\n description: 'Link to the merge request in GitLab',\n },\n },\n },\n },\n async handler(ctx) {\n const {\n assignee,\n branchName,\n targetBranchName,\n description,\n repoUrl,\n removeSourceBranch,\n targetPath,\n sourcePath,\n title,\n token,\n } = ctx.input;\n\n const { owner, repo, project } = parseRepoUrl(repoUrl, integrations);\n const repoID = project ? project : `${owner}/${repo}`;\n\n const api = createGitlabApi({\n integrations,\n token,\n repoUrl,\n });\n\n let assigneeId = undefined;\n\n if (assignee !== undefined) {\n try {\n const assigneeUser = await api.Users.all({ username: assignee });\n assigneeId = assigneeUser[0].id;\n } catch (e) {\n ctx.logger.warn(\n `Failed to find gitlab user id for ${assignee}: ${getErrorMessage(\n e,\n )}. Proceeding with MR creation without an assignee.`,\n );\n }\n }\n\n let fileRoot: string;\n if (sourcePath) {\n fileRoot = resolveSafeChildPath(ctx.workspacePath, sourcePath);\n } else if (targetPath) {\n // for backward compatibility\n fileRoot = resolveSafeChildPath(ctx.workspacePath, targetPath);\n } else {\n fileRoot = ctx.workspacePath;\n }\n\n const fileContents = await serializeDirectoryContents(fileRoot, {\n gitignore: true,\n });\n\n let targetBranch = targetBranchName;\n if (!targetBranch) {\n const projects = await api.Projects.show(repoID);\n const defaultBranch = projects.default_branch ?? projects.defaultBranch;\n if (typeof defaultBranch !== 'string' || !defaultBranch) {\n throw new InputError(\n `The branch creation failed. Target branch was not provided, and could not find default branch from project settings. Project: ${JSON.stringify(\n project,\n )}`,\n );\n }\n targetBranch = defaultBranch;\n }\n\n let remoteFiles: RepositoryTreeSchema[] = [];\n if ((ctx.input.commitAction ?? 'auto') === 'auto') {\n try {\n remoteFiles = await api.Repositories.allRepositoryTrees(repoID, {\n ref: targetBranch,\n recursive: true,\n path: targetPath ?? undefined,\n });\n } catch (e) {\n ctx.logger.warn(\n `Could not retrieve the list of files for ${repoID} (branch: ${targetBranch}) : ${getErrorMessage(\n e,\n )}`,\n );\n }\n }\n const actions: CommitAction[] =\n ctx.input.commitAction === 'skip'\n ? []\n : (\n (\n await Promise.all(\n fileContents.map(async file => {\n const action = await getFileAction(\n { file, targetPath },\n { repoID, branch: targetBranch! },\n api,\n ctx.logger,\n remoteFiles,\n ctx.input.commitAction,\n );\n return { file, action };\n }),\n )\n ).filter(o => o.action !== 'skip') as {\n file: SerializedFile;\n action: CommitAction['action'];\n }[]\n ).map(({ file, action }) => ({\n action,\n filePath: targetPath\n ? path.posix.join(targetPath, file.path)\n : file.path,\n encoding: 'base64',\n content: file.content.toString('base64'),\n execute_filemode: file.executable,\n }));\n\n let createBranch: boolean;\n if (actions.length) {\n createBranch = true;\n } else {\n try {\n await api.Branches.show(repoID, branchName);\n createBranch = false;\n ctx.logger.info(\n `Using existing branch ${branchName} without modification.`,\n );\n } catch (e) {\n createBranch = true;\n }\n }\n if (createBranch) {\n try {\n await api.Branches.create(repoID, branchName, String(targetBranch));\n } catch (e) {\n throw new InputError(\n `The branch creation failed. Please check that your repo does not already contain a branch named '${branchName}'. ${getErrorMessage(\n e,\n )}`,\n );\n }\n }\n if (actions.length) {\n try {\n await api.Commits.create(repoID, branchName, title, actions);\n } catch (e) {\n throw new InputError(\n `Committing the changes to ${branchName} failed. Please check that none of the files created by the template already exists. ${getErrorMessage(\n e,\n )}`,\n );\n }\n }\n try {\n const mergeRequestUrl = await api.MergeRequests.create(\n repoID,\n branchName,\n String(targetBranch),\n title,\n {\n description,\n removeSourceBranch: removeSourceBranch ? removeSourceBranch : false,\n assigneeId,\n },\n ).then(mergeRequest => mergeRequest.web_url ?? mergeRequest.webUrl);\n ctx.output('projectid', repoID);\n ctx.output('targetBranchName', targetBranch);\n ctx.output('projectPath', repoID);\n ctx.output('mergeRequestUrl', mergeRequestUrl);\n } catch (e) {\n throw new InputError(\n `Merge request creation failed. ${getErrorMessage(e)}`,\n );\n }\n },\n });\n};\n"],"names":["createHash","path","createTemplateAction","examples","parseRepoUrl","createGitlabApi","getErrorMessage","resolveSafeChildPath","serializeDirectoryContents","InputError"],"mappings":";;;;;;;;;;;;;;AAkCA,SAAS,cAAc,IAA8B,EAAA;AACnD,E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AAO,CAAA;AAAA,iBACpD,CAAG,EAAA;AACV,UAAA,MAAM,IAAIG,iBAAA;AAAA,YACR,CAAA,0BAAA,EAA6B,UAAU,CAAwF,qFAAA,EAAAH,uBAAA;AAAA,cAC7H;AAAA,aACD,CAAA;AAAA,WACH;AAAA;AACF;AAEF,MAAI,IAAA;AACF,QAAM,MAAA,eAAA,GAAkB,MAAM,GAAA,CAAI,aAAc,CAAA,MAAA;AAAA,UAC9C,MAAA;AAAA,UACA,UAAA;AAAA,UACA,OAAO,YAAY,CAAA;AAAA,UACnB,KAAA;AAAA,UACA;AAAA,YACE,WAAA;AAAA,YACA,kBAAA,EAAoB,qBAAqB,kBAAqB,GAAA,KAAA;AAAA,YAC9D;AAAA;AACF,UACA,IAAK,CAAA,CAAA,YAAA,KAAgB,YAAa,CAAA,OAAA,IAAW,aAAa,MAAM,CAAA;AAClE,QAAI,GAAA,CAAA,MAAA,CAAO,aAAa,MAAM,CAAA;AAC9B,QAAI,GAAA,CAAA,MAAA,CAAO,oBAAoB,YAAY,CAAA;AAC3C,QAAI,GAAA,CAAA,MAAA,CAAO,eAAe,MAAM,CAAA;AAChC,QAAI,GAAA,CAAA,MAAA,CAAO,mBAAmB,eAAe,CAAA;AAAA,eACtC,CAAG,EAAA;AACV,QAAA,MAAM,IAAIG,iBAAA;AAAA,UACR,CAAA,+BAAA,EAAkCH,uBAAgB,CAAA,CAAC,CAAC,CAAA;AAAA,SACtD;AAAA;AACF;AACF,GACD,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"gitlabMergeRequest.cjs.js","sources":["../../src/actions/gitlabMergeRequest.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createTemplateAction,\n parseRepoUrl,\n SerializedFile,\n serializeDirectoryContents,\n} from '@backstage/plugin-scaffolder-node';\nimport {\n Gitlab,\n RepositoryTreeSchema,\n CommitAction,\n SimpleUserSchema,\n} from '@gitbeaker/rest';\nimport path from 'path';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { InputError } from '@backstage/errors';\nimport {\n LoggerService,\n resolveSafeChildPath,\n} from '@backstage/backend-plugin-api';\nimport { createGitlabApi, getErrorMessage } from './helpers';\nimport { examples } from './gitlabMergeRequest.examples';\nimport { createHash } from 'crypto';\n\nfunction computeSha256(file: SerializedFile): string {\n const hash = createHash('sha256');\n hash.update(file.content);\n return hash.digest('hex');\n}\n\nasync function getFileAction(\n fileInfo: { file: SerializedFile; targetPath?: string },\n target: { repoID: string; branch: string },\n api: InstanceType<typeof Gitlab>,\n logger: LoggerService,\n remoteFiles: RepositoryTreeSchema[],\n defaultCommitAction:\n | 'create'\n | 'delete'\n | 'update'\n | 'skip'\n | 'auto' = 'auto',\n): Promise<'create' | 'delete' | 'update' | 'skip'> {\n if (defaultCommitAction === 'auto') {\n const filePath = path.join(fileInfo.targetPath ?? '', fileInfo.file.path);\n\n if (remoteFiles?.some(remoteFile => remoteFile.path === filePath)) {\n try {\n const targetFile = await api.RepositoryFiles.show(\n target.repoID,\n filePath,\n target.branch,\n );\n if (computeSha256(fileInfo.file) === targetFile.content_sha256) {\n return 'skip';\n }\n } catch (error) {\n logger.warn(\n `Unable to retrieve detailed information for remote file ${filePath}`,\n );\n }\n return 'update';\n }\n return 'create';\n }\n return defaultCommitAction;\n}\n\n/**\n * Create a new action that creates a gitlab merge request.\n *\n * @public\n */\nexport const createPublishGitlabMergeRequestAction = (options: {\n integrations: ScmIntegrationRegistry;\n}) => {\n const { integrations } = options;\n\n return createTemplateAction<{\n repoUrl: string;\n title: string;\n description: string;\n branchName: string;\n targetBranchName?: string;\n sourcePath?: string;\n targetPath?: string;\n token?: string;\n commitAction?: 'create' | 'delete' | 'update' | 'skip' | 'auto';\n /** @deprecated projectID passed as query parameters in the repoUrl */\n projectid?: string;\n removeSourceBranch?: boolean;\n assignee?: string;\n reviewers?: string[];\n }>({\n id: 'publish:gitlab:merge-request',\n examples,\n schema: {\n input: {\n required: ['repoUrl', 'branchName'],\n type: 'object',\n properties: {\n repoUrl: {\n type: 'string',\n title: 'Repository Location',\n description: `\\\nAccepts the format 'gitlab.com?repo=project_name&owner=group_name' where \\\n'project_name' is the repository name and 'group_name' is a group or username`,\n },\n /** @deprecated projectID is passed as query parameters in the repoUrl */\n projectid: {\n type: 'string',\n title: 'projectid',\n description: 'Project ID/Name(slug) of the Gitlab Project',\n },\n title: {\n type: 'string',\n title: 'Merge Request Name',\n description: 'The name for the merge request',\n },\n description: {\n type: 'string',\n title: 'Merge Request Description',\n description: 'The description of the merge request',\n },\n branchName: {\n type: 'string',\n title: 'Source Branch Name',\n description: 'The source branch name of the merge request',\n },\n targetBranchName: {\n type: 'string',\n title: 'Target Branch Name',\n description: 'The target branch name of the merge request',\n },\n sourcePath: {\n type: 'string',\n title: 'Working Subdirectory',\n description: `\\\nSubdirectory of working directory to copy changes from. \\\nFor reasons of backward compatibility, any specified 'targetPath' input will \\\nbe applied in place of an absent/falsy value for this input. \\\nCircumvent this behavior using '.'`,\n },\n targetPath: {\n type: 'string',\n title: 'Repository Subdirectory',\n description: 'Subdirectory of repository to apply changes to',\n },\n token: {\n title: 'Authentication Token',\n type: 'string',\n description: 'The token to use for authorization to GitLab',\n },\n commitAction: {\n title: 'Commit action',\n type: 'string',\n enum: ['create', 'update', 'delete', 'auto'],\n description: `\\\nThe action to be used for git commit. Defaults to the custom 'auto' action provided by backstage,\nwhich uses additional API calls in order to detect whether to 'create', 'update' or 'skip' each source file.`,\n },\n removeSourceBranch: {\n title: 'Delete source branch',\n type: 'boolean',\n description:\n 'Option to delete source branch once the MR has been merged. Default: false',\n },\n assignee: {\n title: 'Merge Request Assignee',\n type: 'string',\n description: 'User this merge request will be assigned to',\n },\n reviewers: {\n title: 'Merge Request Reviewers',\n type: 'array',\n items: {\n type: 'string',\n },\n description: 'Users that will be assigned as reviewers',\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n targetBranchName: {\n title: 'Target branch name of the merge request',\n type: 'string',\n },\n projectid: {\n title: 'Gitlab Project id/Name(slug)',\n type: 'string',\n },\n projectPath: {\n title: 'Gitlab Project path',\n type: 'string',\n },\n mergeRequestUrl: {\n title: 'MergeRequest(MR) URL',\n type: 'string',\n description: 'Link to the merge request in GitLab',\n },\n },\n },\n },\n async handler(ctx) {\n const {\n assignee,\n reviewers,\n branchName,\n targetBranchName,\n description,\n repoUrl,\n removeSourceBranch,\n targetPath,\n sourcePath,\n title,\n token,\n } = ctx.input;\n\n const { owner, repo, project } = parseRepoUrl(repoUrl, integrations);\n const repoID = project ? project : `${owner}/${repo}`;\n\n const api = createGitlabApi({\n integrations,\n token,\n repoUrl,\n });\n\n let assigneeId = undefined;\n\n if (assignee !== undefined) {\n try {\n const assigneeUser = await api.Users.all({ username: assignee });\n assigneeId = assigneeUser[0].id;\n } catch (e) {\n ctx.logger.warn(\n `Failed to find gitlab user id for ${assignee}: ${getErrorMessage(\n e,\n )}. Proceeding with MR creation without an assignee.`,\n );\n }\n }\n\n let reviewerIds: number[] | undefined = undefined; // Explicitly set to undefined. Strangely, passing an empty array to the API will result the other options being undefined also being explicity passed to the Gitlab API call (e.g. assigneeId)\n if (reviewers !== undefined) {\n reviewerIds = (\n await Promise.all(\n reviewers.map(async reviewer => {\n try {\n const reviewerUser = await api.Users.all({\n username: reviewer,\n });\n return reviewerUser[0].id;\n } catch (e) {\n ctx.logger.warn(\n `Failed to find gitlab user id for ${reviewer}: ${e}. Proceeding with MR creation without reviewer.`,\n );\n return undefined;\n }\n }),\n )\n ).filter(id => id !== undefined) as number[];\n }\n\n let fileRoot: string;\n if (sourcePath) {\n fileRoot = resolveSafeChildPath(ctx.workspacePath, sourcePath);\n } else if (targetPath) {\n // for backward compatibility\n fileRoot = resolveSafeChildPath(ctx.workspacePath, targetPath);\n } else {\n fileRoot = ctx.workspacePath;\n }\n\n const fileContents = await serializeDirectoryContents(fileRoot, {\n gitignore: true,\n });\n\n let targetBranch = targetBranchName;\n if (!targetBranch) {\n const projects = await api.Projects.show(repoID);\n const defaultBranch = projects.default_branch ?? projects.defaultBranch;\n if (typeof defaultBranch !== 'string' || !defaultBranch) {\n throw new InputError(\n `The branch creation failed. Target branch was not provided, and could not find default branch from project settings. Project: ${JSON.stringify(\n project,\n )}`,\n );\n }\n targetBranch = defaultBranch;\n }\n\n let remoteFiles: RepositoryTreeSchema[] = [];\n if ((ctx.input.commitAction ?? 'auto') === 'auto') {\n try {\n remoteFiles = await api.Repositories.allRepositoryTrees(repoID, {\n ref: targetBranch,\n recursive: true,\n path: targetPath ?? undefined,\n });\n } catch (e) {\n ctx.logger.warn(\n `Could not retrieve the list of files for ${repoID} (branch: ${targetBranch}) : ${getErrorMessage(\n e,\n )}`,\n );\n }\n }\n const actions: CommitAction[] =\n ctx.input.commitAction === 'skip'\n ? []\n : (\n (\n await Promise.all(\n fileContents.map(async file => {\n const action = await getFileAction(\n { file, targetPath },\n { repoID, branch: targetBranch! },\n api,\n ctx.logger,\n remoteFiles,\n ctx.input.commitAction,\n );\n return { file, action };\n }),\n )\n ).filter(o => o.action !== 'skip') as {\n file: SerializedFile;\n action: CommitAction['action'];\n }[]\n ).map(({ file, action }) => ({\n action,\n filePath: targetPath\n ? path.posix.join(targetPath, file.path)\n : file.path,\n encoding: 'base64',\n content: file.content.toString('base64'),\n execute_filemode: file.executable,\n }));\n\n let createBranch: boolean;\n if (actions.length) {\n createBranch = true;\n } else {\n try {\n await api.Branches.show(repoID, branchName);\n createBranch = false;\n ctx.logger.info(\n `Using existing branch ${branchName} without modification.`,\n );\n } catch (e) {\n createBranch = true;\n }\n }\n if (createBranch) {\n try {\n await api.Branches.create(repoID, branchName, String(targetBranch));\n } catch (e) {\n throw new InputError(\n `The branch creation failed. Please check that your repo does not already contain a branch named '${branchName}'. ${getErrorMessage(\n e,\n )}`,\n );\n }\n }\n if (actions.length) {\n try {\n await api.Commits.create(repoID, branchName, title, actions);\n } catch (e) {\n throw new InputError(\n `Committing the changes to ${branchName} failed. Please check that none of the files created by the template already exists. ${getErrorMessage(\n e,\n )}`,\n );\n }\n }\n try {\n let mergeRequest = await api.MergeRequests.create(\n repoID,\n branchName,\n String(targetBranch),\n title,\n {\n description,\n removeSourceBranch: removeSourceBranch ? removeSourceBranch : false,\n assigneeId,\n reviewerIds,\n },\n );\n\n // Because we don't know the code owners before the MR is created, we can't check the approval rules beforehand.\n // Getting the approval rules beforehand is very difficult, especially, because of the inheritance rules for groups.\n // Code owners take a moment to be processed and added to the approval rules after the MR is created.\n\n while (\n mergeRequest.detailed_merge_status === 'preparing' ||\n mergeRequest.detailed_merge_status === 'approvals_syncing' ||\n mergeRequest.detailed_merge_status === 'checking'\n ) {\n mergeRequest = await api.MergeRequests.show(repoID, mergeRequest.iid);\n ctx.logger.info(`${mergeRequest.detailed_merge_status}`);\n }\n\n const approvalRules = await api.MergeRequestApprovals.allApprovalRules(\n repoID,\n {\n mergerequestIId: mergeRequest.iid,\n },\n );\n\n if (approvalRules.length !== 0) {\n const eligibleApprovers = approvalRules\n .filter(rule => rule.eligible_approvers !== undefined)\n .map(rule => {\n return rule.eligible_approvers as SimpleUserSchema[];\n })\n .flat();\n\n const eligibleUserIds = new Set([\n ...eligibleApprovers.map(user => user.id),\n ...(reviewerIds ?? []),\n ]);\n\n mergeRequest = await api.MergeRequests.edit(\n repoID,\n mergeRequest.iid,\n {\n reviewerIds: Array.from(eligibleUserIds),\n },\n );\n }\n\n ctx.output('projectid', repoID);\n ctx.output('targetBranchName', targetBranch);\n ctx.output('projectPath', repoID);\n ctx.output(\n 'mergeRequestUrl',\n mergeRequest.web_url ?? mergeRequest.webUrl,\n );\n } catch (e) {\n throw new InputError(\n `Merge request creation failed. ${getErrorMessage(e)}`,\n );\n }\n },\n });\n};\n"],"names":["createHash","path","createTemplateAction","examples","parseRepoUrl","createGitlabApi","getErrorMessage","resolveSafeChildPath","serializeDirectoryContents","InputError"],"mappings":";;;;;;;;;;;;;;AAuCA,SAAS,cAAc,IAA8B,EAAA;AACnD,EAAM,MAAA,IAAA,GAAOA,kBAAW,QAAQ,CAAA;AAChC,EAAK,IAAA,CAAA,MAAA,CAAO,KAAK,OAAO,CAAA;AACxB,EAAO,OAAA,IAAA,CAAK,OAAO,KAAK,CAAA;AAC1B;AAEA,eAAe,cACb,QACA,EAAA,MAAA,EACA,KACA,MACA,EAAA,WAAA,EACA,sBAKa,MACqC,EAAA;AAClD,EAAA,IAAI,wBAAwB,MAAQ,EAAA;AAClC,IAAM,MAAA,QAAA,GAAWC,sBAAK,IAAK,CAAA,QAAA,CAAS,cAAc,EAAI,EAAA,QAAA,CAAS,KAAK,IAAI,CAAA;AAExE,IAAA,IAAI,aAAa,IAAK,CAAA,CAAA,UAAA,KAAc,UAAW,CAAA,IAAA,KAAS,QAAQ,CAAG,EAAA;AACjE,MAAI,IAAA;AACF,QAAM,MAAA,UAAA,GAAa,MAAM,GAAA,CAAI,eAAgB,CAAA,IAAA;AAAA,UAC3C,MAAO,CAAA,MAAA;AAAA,UACP,QAAA;AAAA,UACA,MAAO,CAAA;AAAA,SACT;AACA,QAAA,IAAI,aAAc,CAAA,QAAA,CAAS,IAAI,CAAA,KAAM,WAAW,cAAgB,EAAA;AAC9D,UAAO,OAAA,MAAA;AAAA;AACT,eACO,KAAO,EAAA;AACd,QAAO,MAAA,CAAA,IAAA;AAAA,UACL,2DAA2D,QAAQ,CAAA;AAAA,SACrE;AAAA;AAEF,MAAO,OAAA,QAAA;AAAA;AAET,IAAO,OAAA,QAAA;AAAA;AAET,EAAO,OAAA,mBAAA;AACT;AAOa,MAAA,qCAAA,GAAwC,CAAC,OAEhD,KAAA;AACJ,EAAM,MAAA,EA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AAM,IAAI,aAAc,CAAA,IAAA;AAAA,YACrC,MAAA;AAAA,YACA,YAAa,CAAA,GAAA;AAAA,YACb;AAAA,cACE,WAAA,EAAa,KAAM,CAAA,IAAA,CAAK,eAAe;AAAA;AACzC,WACF;AAAA;AAGF,QAAI,GAAA,CAAA,MAAA,CAAO,aAAa,MAAM,CAAA;AAC9B,QAAI,GAAA,CAAA,MAAA,CAAO,oBAAoB,YAAY,CAAA;AAC3C,QAAI,GAAA,CAAA,MAAA,CAAO,eAAe,MAAM,CAAA;AAChC,QAAI,GAAA,CAAA,MAAA;AAAA,UACF,iBAAA;AAAA,UACA,YAAA,CAAa,WAAW,YAAa,CAAA;AAAA,SACvC;AAAA,eACO,CAAG,EAAA;AACV,QAAA,MAAM,IAAIG,iBAAA;AAAA,UACR,CAAA,+BAAA,EAAkCH,uBAAgB,CAAA,CAAC,CAAC,CAAA;AAAA,SACtD;AAAA;AACF;AACF,GACD,CAAA;AACH;;;;"}
@@ -0,0 +1,113 @@
1
+ 'use strict';
2
+
3
+ var pluginScaffolderNode = require('@backstage/plugin-scaffolder-node');
4
+ var errors = require('@backstage/errors');
5
+ var helpers = require('./helpers.cjs.js');
6
+ var gitlabRepoPush_examples = require('./gitlabRepoPush.examples.cjs.js');
7
+
8
+ const createGitlabProjectMigrateAction = (options) => {
9
+ const { integrations } = options;
10
+ return pluginScaffolderNode.createTemplateAction({
11
+ id: "gitlab:group:migrate",
12
+ examples: gitlabRepoPush_examples.examples,
13
+ schema: {
14
+ input: {
15
+ required: [
16
+ "destinationAccessToken",
17
+ "destinationUrl",
18
+ "sourceAccessToken",
19
+ "sourceFullPath",
20
+ "sourceUrl"
21
+ ],
22
+ type: "object",
23
+ properties: {
24
+ destinationAccessToken: {
25
+ type: "string",
26
+ title: "Target Repository Access Token",
27
+ description: `The token to use for authorization to the target GitLab'`
28
+ },
29
+ destinationUrl: {
30
+ type: "string",
31
+ title: "Target Project Location",
32
+ description: `Accepts the format 'gitlab.com?repo=project_name&owner=group_name' where 'project_name' is the repository name and 'group_name' is a group or username`
33
+ },
34
+ sourceAccessToken: {
35
+ type: "string",
36
+ title: "Source Group Access Token",
37
+ description: `The token to use for authorization to the source GitLab'`
38
+ },
39
+ sourceFullPath: {
40
+ type: "string",
41
+ title: "Group Full Path",
42
+ description: "Full path to the project in the source Gitlab instance"
43
+ },
44
+ sourceUrl: {
45
+ type: "string",
46
+ title: "Source URL Location",
47
+ description: `Accepts the format 'https://gitlab.com/'`
48
+ }
49
+ }
50
+ },
51
+ output: {
52
+ type: "object",
53
+ properties: {
54
+ importedRepoUrl: {
55
+ title: "URL to the newly imported repo",
56
+ type: "string"
57
+ }
58
+ }
59
+ }
60
+ },
61
+ async handler(ctx) {
62
+ const {
63
+ destinationAccessToken,
64
+ destinationUrl,
65
+ sourceAccessToken,
66
+ sourceFullPath,
67
+ sourceUrl
68
+ } = ctx.input;
69
+ const {
70
+ host: destinationHost,
71
+ repo: destinationSlug,
72
+ owner: destinationNamespace
73
+ } = pluginScaffolderNode.parseRepoUrl(destinationUrl, integrations);
74
+ if (!destinationNamespace) {
75
+ throw new errors.InputError(
76
+ `Failed to determine target repository to migrate to. Make sure destinationUrl matches the format 'gitlab.myorg.com?repo=project_name&owner=group_name'`
77
+ );
78
+ }
79
+ const api = helpers.createGitlabApi({
80
+ integrations,
81
+ token: destinationAccessToken,
82
+ repoUrl: destinationUrl
83
+ });
84
+ const migrationEntity = [
85
+ {
86
+ sourceType: "project_entity",
87
+ sourceFullPath,
88
+ destinationSlug,
89
+ destinationNamespace
90
+ }
91
+ ];
92
+ const sourceConfig = {
93
+ url: sourceUrl,
94
+ access_token: sourceAccessToken
95
+ };
96
+ try {
97
+ await api.Migrations.create(sourceConfig, migrationEntity);
98
+ } catch (e) {
99
+ throw new errors.InputError(
100
+ `Failed to transfer repo ${sourceFullPath}. Make sure that ${sourceFullPath} exists in ${sourceUrl}, and token has enough rights.
101
+ Error: ${e}`
102
+ );
103
+ }
104
+ ctx.output(
105
+ "importedRepoUrl",
106
+ `${destinationHost}/${destinationNamespace}/${destinationSlug}`
107
+ );
108
+ }
109
+ });
110
+ };
111
+
112
+ exports.createGitlabProjectMigrateAction = createGitlabProjectMigrateAction;
113
+ //# sourceMappingURL=gitlabProjectMigrate.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlabProjectMigrate.cjs.js","sources":["../../src/actions/gitlabProjectMigrate.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createTemplateAction,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { InputError } from '@backstage/errors';\nimport { createGitlabApi } from './helpers';\nimport { examples } from './gitlabRepoPush.examples';\nimport { MigrationEntityOptions } from '@gitbeaker/rest';\n\n/**\n * Create a new action that imports a gitlab project into another gitlab project (potentially from another gitlab instance).\n *\n * @public\n */\nexport const createGitlabProjectMigrateAction = (options: {\n integrations: ScmIntegrationRegistry;\n}) => {\n const { integrations } = options;\n\n return createTemplateAction<{\n destinationAccessToken: string;\n destinationUrl: string;\n sourceAccessToken: string;\n sourceFullPath: string;\n sourceUrl: string;\n }>({\n id: 'gitlab:group:migrate',\n examples,\n schema: {\n input: {\n required: [\n 'destinationAccessToken',\n 'destinationUrl',\n 'sourceAccessToken',\n 'sourceFullPath',\n 'sourceUrl',\n ],\n type: 'object',\n properties: {\n destinationAccessToken: {\n type: 'string',\n title: 'Target Repository Access Token',\n description: `The token to use for authorization to the target GitLab'`,\n },\n destinationUrl: {\n type: 'string',\n title: 'Target Project Location',\n description: `Accepts the format 'gitlab.com?repo=project_name&owner=group_name' where 'project_name' is the repository name and 'group_name' is a group or username`,\n },\n sourceAccessToken: {\n type: 'string',\n title: 'Source Group Access Token',\n description: `The token to use for authorization to the source GitLab'`,\n },\n sourceFullPath: {\n type: 'string',\n title: 'Group Full Path',\n description:\n 'Full path to the project in the source Gitlab instance',\n },\n sourceUrl: {\n type: 'string',\n title: 'Source URL Location',\n description: `Accepts the format 'https://gitlab.com/'`,\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n importedRepoUrl: {\n title: 'URL to the newly imported repo',\n type: 'string',\n },\n },\n },\n },\n\n async handler(ctx) {\n const {\n destinationAccessToken,\n destinationUrl,\n sourceAccessToken,\n sourceFullPath,\n sourceUrl,\n } = ctx.input;\n\n const {\n host: destinationHost,\n repo: destinationSlug,\n owner: destinationNamespace,\n } = parseRepoUrl(destinationUrl, integrations);\n\n if (!destinationNamespace) {\n throw new InputError(\n `Failed to determine target repository to migrate to. Make sure destinationUrl matches the format 'gitlab.myorg.com?repo=project_name&owner=group_name'`,\n );\n }\n\n const api = createGitlabApi({\n integrations,\n token: destinationAccessToken,\n repoUrl: destinationUrl,\n });\n\n const migrationEntity: MigrationEntityOptions[] = [\n {\n sourceType: 'project_entity',\n sourceFullPath: sourceFullPath,\n destinationSlug: destinationSlug,\n destinationNamespace: destinationNamespace,\n },\n ];\n\n const sourceConfig = {\n url: sourceUrl,\n access_token: sourceAccessToken,\n };\n\n try {\n await api.Migrations.create(sourceConfig, migrationEntity);\n } catch (e: any) {\n throw new InputError(\n `Failed to transfer repo ${sourceFullPath}. Make sure that ${sourceFullPath} exists in ${sourceUrl}, and token has enough rights.\\nError: ${e}`,\n );\n }\n\n ctx.output(\n 'importedRepoUrl',\n `${destinationHost}/${destinationNamespace}/${destinationSlug}`,\n );\n },\n });\n};\n"],"names":["createTemplateAction","examples","parseRepoUrl","InputError","createGitlabApi"],"mappings":";;;;;;;AA+Ba,MAAA,gCAAA,GAAmC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+65,10 @@ declare function createPublishGitlabAction(options: {
65
65
  declare const createGitlabGroupEnsureExistsAction: (options: {
66
66
  integrations: ScmIntegrationRegistry;
67
67
  }) => _backstage_plugin_scaffolder_node.TemplateAction<{
68
- path: string[];
68
+ path: (string | {
69
+ name: string;
70
+ slug: string;
71
+ })[];
69
72
  repoUrl: string;
70
73
  token?: string | undefined;
71
74
  }, {
@@ -183,6 +186,7 @@ declare const createPublishGitlabMergeRequestAction: (options: {
183
186
  projectid?: string | undefined;
184
187
  removeSourceBranch?: boolean | undefined;
185
188
  assignee?: string | undefined;
189
+ reviewers?: string[] | undefined;
186
190
  }, _backstage_types.JsonObject>;
187
191
 
188
192
  /**
@@ -14,6 +14,7 @@ var gitlabProjectDeployTokenCreate = require('./actions/gitlabProjectDeployToken
14
14
  var gitlabProjectVariableCreate = require('./actions/gitlabProjectVariableCreate.cjs.js');
15
15
  var gitlabRepoPush = require('./actions/gitlabRepoPush.cjs.js');
16
16
  require('./commonGitlabConfig.cjs.js');
17
+ var gitlabProjectMigrate = require('./actions/gitlabProjectMigrate.cjs.js');
17
18
  var autocomplete = require('./autocomplete/autocomplete.cjs.js');
18
19
 
19
20
  const gitlabModule = backendPluginApi.createBackendModule({
@@ -30,6 +31,7 @@ const gitlabModule = backendPluginApi.createBackendModule({
30
31
  const integrations = integration.ScmIntegrations.fromConfig(config);
31
32
  scaffolder.addActions(
32
33
  gitlabGroupEnsureExists.createGitlabGroupEnsureExistsAction({ integrations }),
34
+ gitlabProjectMigrate.createGitlabProjectMigrateAction({ integrations }),
33
35
  gitlabIssueCreate.createGitlabIssueAction({ integrations }),
34
36
  gitlabProjectAccessTokenCreate.createGitlabProjectAccessTokenAction({ integrations }),
35
37
  gitlabProjectDeployTokenCreate.createGitlabProjectDeployTokenAction({ integrations }),
@@ -1 +1 @@
1
- {"version":3,"file":"module.cjs.js","sources":["../src/module.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { ScmIntegrations } from '@backstage/integration';\nimport {\n scaffolderActionsExtensionPoint,\n scaffolderAutocompleteExtensionPoint,\n} from '@backstage/plugin-scaffolder-node/alpha';\nimport {\n createGitlabGroupEnsureExistsAction,\n createGitlabIssueAction,\n createGitlabProjectAccessTokenAction,\n createGitlabProjectDeployTokenAction,\n createGitlabProjectVariableAction,\n createGitlabRepoPushAction,\n createPublishGitlabAction,\n createPublishGitlabMergeRequestAction,\n createTriggerGitlabPipelineAction,\n editGitlabIssueAction,\n} from './actions';\nimport { createHandleAutocompleteRequest } from './autocomplete/autocomplete';\n\n/**\n * @public\n * The GitLab Module for the Scaffolder Backend\n */\nexport const gitlabModule = createBackendModule({\n pluginId: 'scaffolder',\n moduleId: 'gitlab',\n register({ registerInit }) {\n registerInit({\n deps: {\n scaffolder: scaffolderActionsExtensionPoint,\n autocomplete: scaffolderAutocompleteExtensionPoint,\n config: coreServices.rootConfig,\n },\n async init({ scaffolder, autocomplete, config }) {\n const integrations = ScmIntegrations.fromConfig(config);\n\n scaffolder.addActions(\n createGitlabGroupEnsureExistsAction({ integrations }),\n createGitlabIssueAction({ integrations }),\n createGitlabProjectAccessTokenAction({ integrations }),\n createGitlabProjectDeployTokenAction({ integrations }),\n createGitlabProjectVariableAction({ integrations }),\n createGitlabRepoPushAction({ integrations }),\n editGitlabIssueAction({ integrations }),\n createPublishGitlabAction({ config, integrations }),\n createPublishGitlabMergeRequestAction({ integrations }),\n createTriggerGitlabPipelineAction({ integrations }),\n );\n\n autocomplete.addAutocompleteProvider({\n id: 'gitlab',\n handler: createHandleAutocompleteRequest({ integrations }),\n });\n },\n });\n },\n});\n"],"names":["createBackendModule","scaffolderActionsExtensionPoint","scaffolderAutocompleteExtensionPoint","coreServices","autocomplete","ScmIntegrations","createGitlabGroupEnsureExistsAction","createGitlabIssueAction","createGitlabProjectAccessTokenAction","createGitlabProjectDeployTokenAction","createGitlabProjectVariableAction","createGitlabRepoPushAction","editGitlabIssueAction","createPublishGitlabAction","createPublishGitlabMergeRequestAction","createTriggerGitlabPipelineAction","createHandleAutocompleteRequest"],"mappings":";;;;;;;;;;;;;;;;;;AA0CO,MAAM,eAAeA,oCAAoB,CAAA;AAAA,EAC9C,QAAU,EAAA,YAAA;AAAA,EACV,QAAU,EAAA,QAAA;AAAA,EACV,QAAA,CAAS,EAAE,YAAA,EAAgB,EAAA;AACzB,IAAa,YAAA,CAAA;AAAA,MACX,IAAM,EAAA;AAAA,QACJ,UAAY,EAAAC,qCAAA;AAAA,QACZ,YAAc,EAAAC,0CAAA;AAAA,QACd,QAAQC,6BAAa,CAAA;AAAA,OACvB;AAAA,MACA,MAAM,IAAK,CAAA,EAAE,UAAY,gBAAAC,cAAA,EAAc,QAAU,EAAA;AAC/C,QAAM,MAAA,YAAA,GAAeC,2BAAgB,CAAA,UAAA,CAAW,MAAM,CAAA;AAEtD,QAAW,UAAA,CAAA,UAAA;AAAA,UACTC,2DAAA,CAAoC,EAAE,YAAA,EAAc,CAAA;AAAA,UACpDC,yCAAA,CAAwB,EAAE,YAAA,EAAc,CAAA;AAAA,UACxCC,mEAAA,CAAqC,EAAE,YAAA,EAAc,CAAA;AAAA,UACrDC,mEAAA,CAAqC,EAAE,YAAA,EAAc,CAAA;AAAA,UACrDC,6DAAA,CAAkC,EAAE,YAAA,EAAc,CAAA;AAAA,UAClDC,yCAAA,CAA2B,EAAE,YAAA,EAAc,CAAA;AAAA,UAC3CC,qCAAA,CAAsB,EAAE,YAAA,EAAc,CAAA;AAAA,UACtCC,gCAA0B,CAAA,EAAE,MAAQ,EAAA,YAAA,EAAc,CAAA;AAAA,UAClDC,wDAAA,CAAsC,EAAE,YAAA,EAAc,CAAA;AAAA,UACtDC,uDAAA,CAAkC,EAAE,YAAA,EAAc;AAAA,SACpD;AAEA,QAAAX,cAAA,CAAa,uBAAwB,CAAA;AAAA,UACnC,EAAI,EAAA,QAAA;AAAA,UACJ,OAAS,EAAAY,4CAAA,CAAgC,EAAE,YAAA,EAAc;AAAA,SAC1D,CAAA;AAAA;AACH,KACD,CAAA;AAAA;AAEL,CAAC;;;;"}
1
+ {"version":3,"file":"module.cjs.js","sources":["../src/module.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { ScmIntegrations } from '@backstage/integration';\nimport {\n scaffolderActionsExtensionPoint,\n scaffolderAutocompleteExtensionPoint,\n} from '@backstage/plugin-scaffolder-node/alpha';\nimport {\n createGitlabGroupEnsureExistsAction,\n createGitlabIssueAction,\n createGitlabProjectAccessTokenAction,\n createGitlabProjectDeployTokenAction,\n createGitlabProjectVariableAction,\n createGitlabRepoPushAction,\n createPublishGitlabAction,\n createPublishGitlabMergeRequestAction,\n createTriggerGitlabPipelineAction,\n editGitlabIssueAction,\n} from './actions';\nimport { createGitlabProjectMigrateAction } from './actions/gitlabProjectMigrate';\nimport { createHandleAutocompleteRequest } from './autocomplete/autocomplete';\n\n/**\n * @public\n * The GitLab Module for the Scaffolder Backend\n */\nexport const gitlabModule = createBackendModule({\n pluginId: 'scaffolder',\n moduleId: 'gitlab',\n register({ registerInit }) {\n registerInit({\n deps: {\n scaffolder: scaffolderActionsExtensionPoint,\n autocomplete: scaffolderAutocompleteExtensionPoint,\n config: coreServices.rootConfig,\n },\n async init({ scaffolder, autocomplete, config }) {\n const integrations = ScmIntegrations.fromConfig(config);\n\n scaffolder.addActions(\n createGitlabGroupEnsureExistsAction({ integrations }),\n createGitlabProjectMigrateAction({ integrations }),\n createGitlabIssueAction({ integrations }),\n createGitlabProjectAccessTokenAction({ integrations }),\n createGitlabProjectDeployTokenAction({ integrations }),\n createGitlabProjectVariableAction({ integrations }),\n createGitlabRepoPushAction({ integrations }),\n editGitlabIssueAction({ integrations }),\n createPublishGitlabAction({ config, integrations }),\n createPublishGitlabMergeRequestAction({ integrations }),\n createTriggerGitlabPipelineAction({ integrations }),\n );\n\n autocomplete.addAutocompleteProvider({\n id: 'gitlab',\n handler: createHandleAutocompleteRequest({ integrations }),\n });\n },\n });\n },\n});\n"],"names":["createBackendModule","scaffolderActionsExtensionPoint","scaffolderAutocompleteExtensionPoint","coreServices","autocomplete","ScmIntegrations","createGitlabGroupEnsureExistsAction","createGitlabProjectMigrateAction","createGitlabIssueAction","createGitlabProjectAccessTokenAction","createGitlabProjectDeployTokenAction","createGitlabProjectVariableAction","createGitlabRepoPushAction","editGitlabIssueAction","createPublishGitlabAction","createPublishGitlabMergeRequestAction","createTriggerGitlabPipelineAction","createHandleAutocompleteRequest"],"mappings":";;;;;;;;;;;;;;;;;;;AA2CO,MAAM,eAAeA,oCAAoB,CAAA;AAAA,EAC9C,QAAU,EAAA,YAAA;AAAA,EACV,QAAU,EAAA,QAAA;AAAA,EACV,QAAA,CAAS,EAAE,YAAA,EAAgB,EAAA;AACzB,IAAa,YAAA,CAAA;AAAA,MACX,IAAM,EAAA;AAAA,QACJ,UAAY,EAAAC,qCAAA;AAAA,QACZ,YAAc,EAAAC,0CAAA;AAAA,QACd,QAAQC,6BAAa,CAAA;AAAA,OACvB;AAAA,MACA,MAAM,IAAK,CAAA,EAAE,UAAY,gBAAAC,cAAA,EAAc,QAAU,EAAA;AAC/C,QAAM,MAAA,YAAA,GAAeC,2BAAgB,CAAA,UAAA,CAAW,MAAM,CAAA;AAEtD,QAAW,UAAA,CAAA,UAAA;AAAA,UACTC,2DAAA,CAAoC,EAAE,YAAA,EAAc,CAAA;AAAA,UACpDC,qDAAA,CAAiC,EAAE,YAAA,EAAc,CAAA;AAAA,UACjDC,yCAAA,CAAwB,EAAE,YAAA,EAAc,CAAA;AAAA,UACxCC,mEAAA,CAAqC,EAAE,YAAA,EAAc,CAAA;AAAA,UACrDC,mEAAA,CAAqC,EAAE,YAAA,EAAc,CAAA;AAAA,UACrDC,6DAAA,CAAkC,EAAE,YAAA,EAAc,CAAA;AAAA,UAClDC,yCAAA,CAA2B,EAAE,YAAA,EAAc,CAAA;AAAA,UAC3CC,qCAAA,CAAsB,EAAE,YAAA,EAAc,CAAA;AAAA,UACtCC,gCAA0B,CAAA,EAAE,MAAQ,EAAA,YAAA,EAAc,CAAA;AAAA,UAClDC,wDAAA,CAAsC,EAAE,YAAA,EAAc,CAAA;AAAA,UACtDC,uDAAA,CAAkC,EAAE,YAAA,EAAc;AAAA,SACpD;AAEA,QAAAZ,cAAA,CAAa,uBAAwB,CAAA;AAAA,UACnC,EAAI,EAAA,QAAA;AAAA,UACJ,OAAS,EAAAa,4CAAA,CAAgC,EAAE,YAAA,EAAc;AAAA,SAC1D,CAAA;AAAA;AACH,KACD,CAAA;AAAA;AAEL,CAAC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-backend-module-gitlab",
3
- "version": "0.7.1-next.0",
3
+ "version": "0.7.1",
4
4
  "backstage": {
5
5
  "role": "backend-plugin-module",
6
6
  "pluginId": "scaffolder",
@@ -51,11 +51,11 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "@backstage/backend-common": "^0.25.0",
54
- "@backstage/backend-plugin-api": "1.1.1-next.0",
55
- "@backstage/config": "1.3.1",
56
- "@backstage/errors": "1.2.6",
57
- "@backstage/integration": "1.16.0",
58
- "@backstage/plugin-scaffolder-node": "0.6.3-next.0",
54
+ "@backstage/backend-plugin-api": "^1.1.1",
55
+ "@backstage/config": "^1.3.2",
56
+ "@backstage/errors": "^1.2.7",
57
+ "@backstage/integration": "^1.16.1",
58
+ "@backstage/plugin-scaffolder-node": "^0.6.3",
59
59
  "@gitbeaker/rest": "^41.2.0",
60
60
  "luxon": "^3.0.0",
61
61
  "winston": "^3.2.1",
@@ -63,9 +63,9 @@
63
63
  "zod": "^3.22.4"
64
64
  },
65
65
  "devDependencies": {
66
- "@backstage/backend-test-utils": "1.2.1-next.0",
67
- "@backstage/cli": "0.29.5-next.0",
68
- "@backstage/core-app-api": "1.15.3",
69
- "@backstage/plugin-scaffolder-node-test-utils": "0.1.18-next.0"
66
+ "@backstage/backend-test-utils": "^1.2.1",
67
+ "@backstage/cli": "^0.29.5",
68
+ "@backstage/core-app-api": "^1.15.4",
69
+ "@backstage/plugin-scaffolder-node-test-utils": "^0.1.18"
70
70
  }
71
71
  }