@backstage/plugin-scaffolder-backend-module-gitlab 0.11.3-next.1 → 0.11.3-next.2

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,16 @@
1
1
  # @backstage/plugin-scaffolder-backend-module-gitlab
2
2
 
3
+ ## 0.11.3-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 6b5e7d9: Allow setting optional description on group creation
8
+ - f0f9403: Changed `gitlab:group:ensureExists` action to use `Groups.show` API instead of `Groups.search` for checking if a group path exists. This is more efficient as it directly retrieves the group by path rather than searching and filtering results.
9
+ - Updated dependencies
10
+ - @backstage/integration@1.20.0-next.2
11
+ - @backstage/backend-plugin-api@1.7.0-next.1
12
+ - @backstage/plugin-scaffolder-node@0.12.5-next.1
13
+
3
14
  ## 0.11.3-next.1
4
15
 
5
16
  ### Patch Changes
@@ -19,6 +19,9 @@ const createGitlabGroupEnsureExistsAction = (options) => {
19
19
  token: (z) => z.string({
20
20
  description: "The token to use for authorization to GitLab"
21
21
  }).optional(),
22
+ description: (z) => z.string({
23
+ description: "The group\u2019s description"
24
+ }).optional(),
22
25
  path: (z) => z.array(
23
26
  z.string().or(
24
27
  z.object({
@@ -42,32 +45,37 @@ const createGitlabGroupEnsureExistsAction = (options) => {
42
45
  ctx.output("groupId", 42);
43
46
  return;
44
47
  }
45
- const { token, repoUrl, path } = ctx.input;
48
+ const { token, repoUrl, path, description } = ctx.input;
46
49
  const { host } = util.parseRepoUrl(repoUrl, integrations);
47
50
  const api = util.getClient({ host, integrations, token });
48
51
  let currentPath = null;
49
52
  let parentId = null;
50
- for (const { name, slug } of pathIterator(path)) {
53
+ const pathParts = [...pathIterator(path)];
54
+ const lastIndex = pathParts.length - 1;
55
+ for (let i = 0; i < pathParts.length; i++) {
56
+ const { name, slug } = pathParts[i];
51
57
  const fullPath = currentPath ? `${currentPath}/${slug}` : slug;
52
- const result = await api.Groups.search(
53
- fullPath
54
- );
55
- const subGroup = result.find(
56
- (searchPathElem) => searchPathElem.full_path === fullPath
57
- );
58
+ let subGroup;
59
+ try {
60
+ subGroup = await api.Groups.show(
61
+ fullPath
62
+ );
63
+ } catch (error) {
64
+ if (error.cause?.response?.status !== 404) {
65
+ throw error;
66
+ }
67
+ }
58
68
  if (!subGroup) {
59
69
  ctx.logger.info(`creating missing group ${fullPath}`);
60
70
  parentId = await ctx.checkpoint({
61
71
  key: `ensure.${name}.${slug}.${parentId}`,
62
72
  // eslint-disable-next-line no-loop-func
63
73
  fn: async () => {
64
- return (await api.Groups.create(
65
- name,
66
- slug,
67
- parentId ? {
68
- parentId
69
- } : {}
70
- ))?.id;
74
+ const groupOptions = {
75
+ ...parentId ? { parentId } : {},
76
+ ...description && i === lastIndex ? { description } : {}
77
+ };
78
+ return (await api.Groups.create(name, slug, groupOptions))?.id;
71
79
  }
72
80
  });
73
81
  } else {
@@ -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 { 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: {\n repoUrl: z =>\n z.string({\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 token: z =>\n z\n .string({\n description: 'The token to use for authorization to GitLab',\n })\n .optional(),\n path: z =>\n 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 output: {\n groupId: z =>\n z\n .number({\n description: 'The id of the innermost sub-group',\n })\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 { name, slug } of pathIterator(path)) {\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\n parentId = await ctx.checkpoint({\n key: `ensure.${name}.${slug}.${parentId}`,\n // eslint-disable-next-line no-loop-func\n fn: async () => {\n return (\n await api.Groups.create(\n name,\n slug,\n parentId\n ? {\n parentId: parentId,\n }\n : {},\n )\n )?.id;\n },\n });\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\ntype PathPart = { name: string; slug: string };\ntype PathItem = string | PathPart;\n\nfunction* pathIterator(items: PathItem[]): Generator<PathPart> {\n for (const item of items) {\n if (typeof item === 'string') {\n const parts = item.split('/');\n for (const part of parts) {\n yield { name: part, slug: part };\n }\n } else {\n yield item;\n }\n }\n}\n"],"names":["createTemplateAction","examples","parseRepoUrl","getClient"],"mappings":";;;;;;AA2BO,MAAM,mCAAA,GAAsC,CAAC,OAAA,KAE9C;AACJ,EAAA,MAAM,EAAE,cAAa,GAAI,OAAA;AAEzB,EAAA,OAAOA,yCAAA,CAAqB;AAAA,IAC1B,EAAA,EAAI,2BAAA;AAAA,IACJ,WAAA,EAAa,+BAAA;AAAA,IACb,cAAA,EAAgB,IAAA;AAAA,cAChBC,yCAAA;AAAA,IACA,MAAA,EAAQ;AAAA,MACN,KAAA,EAAO;AAAA,QACL,OAAA,EAAS,CAAA,CAAA,KACP,CAAA,CAAE,MAAA,CAAO;AAAA,UACP,WAAA,EAAa,CAAA,sJAAA;AAAA,SACd,CAAA;AAAA,QACH,KAAA,EAAO,CAAA,CAAA,KACL,CAAA,CACG,MAAA,CAAO;AAAA,UACN,WAAA,EAAa;AAAA,SACd,EACA,QAAA,EAAS;AAAA,QACd,IAAA,EAAM,OACJ,CAAA,CACG,KAAA;AAAA,UACC,CAAA,CAAE,QAAO,CAAE,EAAA;AAAA,YACT,EAAE,MAAA,CAAO;AAAA,cACP,IAAA,EAAM,EAAE,MAAA,EAAO;AAAA,cACf,IAAA,EAAM,EAAE,MAAA;AAAO,aAChB;AAAA,WACH;AAAA,UACA;AAAA,YACE,WAAA,EACE;AAAA;AACJ,SACF,CACC,IAAI,CAAC;AAAA,OACZ;AAAA,MACA,MAAA,EAAQ;AAAA,QACN,OAAA,EAAS,CAAA,CAAA,KACP,CAAA,CACG,MAAA,CAAO;AAAA,UACN,WAAA,EAAa;AAAA,SACd,EACA,QAAA;AAAS;AAChB,KACF;AAAA,IACA,MAAM,QAAQ,GAAA,EAAK;AACjB,MAAA,IAAI,IAAI,QAAA,EAAU;AAChB,QAAA,GAAA,CAAI,MAAA,CAAO,WAAW,EAAE,CAAA;AAC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UAAA,QAAA,GAAW,QAAA,CAAS,EAAA;AAAA,QACtB;AACA,QAAA,WAAA,GAAc,QAAA;AAAA,MAChB;AACA,MAAA,IAAI,aAAa,IAAA,EAAM;AACrB,QAAA,GAAA,CAAI,MAAA,CAAO,WAAW,QAAQ,CAAA;AAAA,MAChC;AAAA,IACF;AAAA,GACD,CAAA;AACH;AAKA,UAAU,aAAa,KAAA,EAAwC;AAC7D,EAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB,IAAA,IAAI,OAAO,SAAS,QAAA,EAAU;AAC5B,MAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA;AAC5B,MAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB,QAAA,MAAM,EAAE,IAAA,EAAM,IAAA,EAAM,IAAA,EAAM,IAAA,EAAK;AAAA,MACjC;AAAA,IACF,CAAA,MAAO;AACL,MAAA,MAAM,IAAA;AAAA,IACR;AAAA,EACF;AACF;;;;"}
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, CreateGroupOptions } from '@gitbeaker/rest';\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: {\n repoUrl: z =>\n z.string({\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 token: z =>\n z\n .string({\n description: 'The token to use for authorization to GitLab',\n })\n .optional(),\n description: z =>\n z\n .string({\n description: 'The group’s description',\n })\n .optional(),\n path: z =>\n 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 output: {\n groupId: z =>\n z\n .number({\n description: 'The id of the innermost sub-group',\n })\n .optional(),\n },\n },\n async handler(ctx) {\n if (ctx.isDryRun) {\n ctx.output('groupId', 42);\n return;\n }\n const { token, repoUrl, path, description } = 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 const pathParts = [...pathIterator(path)];\n const lastIndex = pathParts.length - 1;\n for (let i = 0; i < pathParts.length; i++) {\n const { name, slug } = pathParts[i];\n const fullPath: string = currentPath ? `${currentPath}/${slug}` : slug;\n let subGroup: GroupSchema | undefined;\n try {\n subGroup = (await api.Groups.show(\n fullPath,\n )) as unknown as GroupSchema;\n } catch (error: any) {\n // 404 means the group doesn't exist - we'll create it below\n // Any other error should be thrown\n if (error.cause?.response?.status !== 404) {\n throw error;\n }\n }\n if (!subGroup) {\n ctx.logger.info(`creating missing group ${fullPath}`);\n\n parentId = await ctx.checkpoint({\n key: `ensure.${name}.${slug}.${parentId}`,\n // eslint-disable-next-line no-loop-func\n fn: async () => {\n const groupOptions: CreateGroupOptions = {\n ...(parentId ? { parentId } : {}),\n ...(description && i === lastIndex ? { description } : {}),\n };\n return (await api.Groups.create(name, slug, groupOptions))?.id;\n },\n });\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\ntype PathPart = { name: string; slug: string };\ntype PathItem = string | PathPart;\n\nfunction* pathIterator(items: PathItem[]): Generator<PathPart> {\n for (const item of items) {\n if (typeof item === 'string') {\n const parts = item.split('/');\n for (const part of parts) {\n yield { name: part, slug: part };\n }\n } else {\n yield item;\n }\n }\n}\n"],"names":["createTemplateAction","examples","parseRepoUrl","getClient"],"mappings":";;;;;;AA2BO,MAAM,mCAAA,GAAsC,CAAC,OAAA,KAE9C;AACJ,EAAA,MAAM,EAAE,cAAa,GAAI,OAAA;AAEzB,EAAA,OAAOA,yCAAA,CAAqB;AAAA,IAC1B,EAAA,EAAI,2BAAA;AAAA,IACJ,WAAA,EAAa,+BAAA;AAAA,IACb,cAAA,EAAgB,IAAA;AAAA,cAChBC,yCAAA;AAAA,IACA,MAAA,EAAQ;AAAA,MACN,KAAA,EAAO;AAAA,QACL,OAAA,EAAS,CAAA,CAAA,KACP,CAAA,CAAE,MAAA,CAAO;AAAA,UACP,WAAA,EAAa,CAAA,sJAAA;AAAA,SACd,CAAA;AAAA,QACH,KAAA,EAAO,CAAA,CAAA,KACL,CAAA,CACG,MAAA,CAAO;AAAA,UACN,WAAA,EAAa;AAAA,SACd,EACA,QAAA,EAAS;AAAA,QACd,WAAA,EAAa,CAAA,CAAA,KACX,CAAA,CACG,MAAA,CAAO;AAAA,UACN,WAAA,EAAa;AAAA,SACd,EACA,QAAA,EAAS;AAAA,QACd,IAAA,EAAM,OACJ,CAAA,CACG,KAAA;AAAA,UACC,CAAA,CAAE,QAAO,CAAE,EAAA;AAAA,YACT,EAAE,MAAA,CAAO;AAAA,cACP,IAAA,EAAM,EAAE,MAAA,EAAO;AAAA,cACf,IAAA,EAAM,EAAE,MAAA;AAAO,aAChB;AAAA,WACH;AAAA,UACA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AAM,EAAE,IAAA,EAAM,IAAA,EAAM,IAAA,EAAM,IAAA,EAAK;AAAA,MACjC;AAAA,IACF,CAAA,MAAO;AACL,MAAA,MAAM,IAAA;AAAA,IACR;AAAA,EACF;AACF;;;;"}
@@ -8,7 +8,7 @@ var yaml__default = /*#__PURE__*/_interopDefaultCompat(yaml);
8
8
 
9
9
  const examples = [
10
10
  {
11
- description: "Creating a group at the top level",
11
+ description: "Creating a group at the top level, with a description",
12
12
  example: yaml__default.default.stringify({
13
13
  steps: [
14
14
  {
@@ -17,7 +17,8 @@ const examples = [
17
17
  action: "gitlab:group:ensureExists",
18
18
  input: {
19
19
  repoUrl: "gitlab.com",
20
- path: ["group1"]
20
+ path: ["group1"],
21
+ description: "This is a top-level group"
21
22
  }
22
23
  }
23
24
  ]
@@ -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 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 description:\n 'Create a group nested within another group using path and 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 'group1/group2',\n { name: 'Group 3', slug: 'group3' },\n { name: 'Group 4', slug: 'group4' },\n ],\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAkBO,MAAM,QAAA,GAA8B;AAAA,EACzC;AAAA,IACE,WAAA,EAAa,mCAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,EAAA,EAAI,aAAA;AAAA,UACJ,IAAA,EAAM,OAAA;AAAA,UACN,MAAA,EAAQ,2BAAA;AAAA,UACR,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,YAAA;AAAA,YACT,IAAA,EAAM,CAAC,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AAA,EAAO;AAAA,QACL;AAAA,UACE,EAAA,EAAI,aAAA;AAAA,UACJ,IAAA,EAAM,OAAA;AAAA,UACN,MAAA,EAAQ,2BAAA;AAAA,UACR,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,YAAA;AAAA,YACT,IAAA,EAAM;AAAA,cACJ,EAAE,IAAA,EAAM,SAAA,EAAW,IAAA,EAAM,QAAA,EAAS;AAAA,cAClC,EAAE,IAAA,EAAM,SAAA,EAAW,IAAA,EAAM,QAAA,EAAS;AAAA,cAClC,EAAE,IAAA,EAAM,SAAA,EAAW,IAAA,EAAM,QAAA;AAAS;AACpC;AACF;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EACE,mEAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,EAAA,EAAI,aAAA;AAAA,UACJ,IAAA,EAAM,OAAA;AAAA,UACN,MAAA,EAAQ,2BAAA;AAAA,UACR,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,YAAA;AAAA,YACT,IAAA,EAAM;AAAA,cACJ,eAAA;AAAA,cACA,EAAE,IAAA,EAAM,SAAA,EAAW,IAAA,EAAM,QAAA,EAAS;AAAA,cAClC,EAAE,IAAA,EAAM,SAAA,EAAW,IAAA,EAAM,QAAA;AAAS;AACpC;AACF;AACF;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, with a description',\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 description: 'This is a top-level group',\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 description:\n 'Create a group nested within another group using path and 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 'group1/group2',\n { name: 'Group 3', sl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AClC,EAAE,IAAA,EAAM,SAAA,EAAW,IAAA,EAAM,QAAA;AAAS;AACpC;AACF;AACF;AACF,KACD;AAAA;AAEL;;;;"}
package/dist/index.d.ts CHANGED
@@ -76,6 +76,7 @@ declare const createGitlabGroupEnsureExistsAction: (options: {
76
76
  slug: string;
77
77
  })[];
78
78
  token?: string | undefined;
79
+ description?: string | undefined;
79
80
  }, {
80
81
  groupId?: number | undefined;
81
82
  }, "v2">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-backend-module-gitlab",
3
- "version": "0.11.3-next.1",
3
+ "version": "0.11.3-next.2",
4
4
  "backstage": {
5
5
  "role": "backend-plugin-module",
6
6
  "pluginId": "scaffolder",
@@ -56,7 +56,7 @@
56
56
  "@backstage/backend-plugin-api": "1.7.0-next.1",
57
57
  "@backstage/config": "1.3.6",
58
58
  "@backstage/errors": "1.2.7",
59
- "@backstage/integration": "1.20.0-next.1",
59
+ "@backstage/integration": "1.20.0-next.2",
60
60
  "@backstage/plugin-scaffolder-node": "0.12.5-next.1",
61
61
  "@gitbeaker/requester-utils": "^41.2.0",
62
62
  "@gitbeaker/rest": "^41.2.0",
@@ -65,8 +65,8 @@
65
65
  "zod": "^3.25.76"
66
66
  },
67
67
  "devDependencies": {
68
- "@backstage/backend-test-utils": "1.10.5-next.0",
69
- "@backstage/cli": "0.35.4-next.1",
70
- "@backstage/plugin-scaffolder-node-test-utils": "0.3.8-next.0"
68
+ "@backstage/backend-test-utils": "1.11.0-next.1",
69
+ "@backstage/cli": "0.35.4-next.2",
70
+ "@backstage/plugin-scaffolder-node-test-utils": "0.3.8-next.1"
71
71
  }
72
72
  }