@backstage/plugin-scaffolder-backend-module-gitlab 0.2.9-next.2 → 0.2.10-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @backstage/plugin-scaffolder-backend-module-gitlab
2
2
 
3
+ ## 0.2.10-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 26ca97ebaa: Add examples for `gitlab:projectAccessToken:create` scaffolder action & improve related tests
8
+ - Updated dependencies
9
+ - @backstage/plugin-scaffolder-node@0.2.8-next.0
10
+ - @backstage/integration@1.7.1
11
+ - @backstage/config@1.1.1
12
+ - @backstage/errors@1.2.3
13
+
14
+ ## 0.2.9
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+ - @backstage/integration@1.7.1
20
+ - @backstage/errors@1.2.3
21
+ - @backstage/plugin-scaffolder-node@0.2.6
22
+ - @backstage/config@1.1.1
23
+
3
24
  ## 0.2.9-next.2
4
25
 
5
26
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -6,6 +6,11 @@ var pluginScaffolderNode = require('@backstage/plugin-scaffolder-node');
6
6
  var node = require('@gitbeaker/node');
7
7
  var zod = require('zod');
8
8
  var errors = require('@backstage/errors');
9
+ var yaml = require('yaml');
10
+
11
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
+
13
+ var yaml__default = /*#__PURE__*/_interopDefaultLegacy(yaml);
9
14
 
10
15
  const commonGitlabConfig = zod.z.object({
11
16
  repoUrl: zod.z.string({ description: "Repository Location" }),
@@ -144,10 +149,96 @@ const createGitlabProjectDeployTokenAction = (options) => {
144
149
  });
145
150
  };
146
151
 
152
+ const examples = [
153
+ {
154
+ description: "Create a GitLab project access token with minimal options.",
155
+ example: yaml__default["default"].stringify({
156
+ steps: [
157
+ {
158
+ id: "createAccessToken",
159
+ action: "gitlab:projectAccessToken:create",
160
+ name: "Create GitLab Project Access Token",
161
+ input: {
162
+ repoUrl: "gitlab.com?repo=repo&owner=owner",
163
+ projectId: "456"
164
+ }
165
+ }
166
+ ]
167
+ })
168
+ },
169
+ {
170
+ description: "Create a GitLab project access token with custom scopes.",
171
+ example: yaml__default["default"].stringify({
172
+ steps: [
173
+ {
174
+ id: "createAccessToken",
175
+ action: "gitlab:projectAccessToken:create",
176
+ name: "Create GitLab Project Access Token",
177
+ input: {
178
+ repoUrl: "gitlab.com?repo=repo&owner=owner",
179
+ projectId: "789",
180
+ scopes: ["read_registry", "write_repository"]
181
+ }
182
+ }
183
+ ]
184
+ })
185
+ },
186
+ {
187
+ description: "Create a GitLab project access token with a specified name.",
188
+ example: yaml__default["default"].stringify({
189
+ steps: [
190
+ {
191
+ id: "createAccessToken",
192
+ action: "gitlab:projectAccessToken:create",
193
+ name: "Create GitLab Project Access Token",
194
+ input: {
195
+ repoUrl: "gitlab.com?repo=repo&owner=owner",
196
+ projectId: "101112",
197
+ name: "my-custom-token"
198
+ }
199
+ }
200
+ ]
201
+ })
202
+ },
203
+ {
204
+ description: "Create a GitLab project access token with a numeric project ID.",
205
+ example: yaml__default["default"].stringify({
206
+ steps: [
207
+ {
208
+ id: "createAccessToken",
209
+ action: "gitlab:projectAccessToken:create",
210
+ name: "Create GitLab Project Access Token",
211
+ input: {
212
+ repoUrl: "gitlab.com?repo=repo&owner=owner",
213
+ projectId: 42
214
+ }
215
+ }
216
+ ]
217
+ })
218
+ },
219
+ {
220
+ description: "Create a GitLab project access token using specific GitLab integrations.",
221
+ example: yaml__default["default"].stringify({
222
+ steps: [
223
+ {
224
+ id: "createAccessToken",
225
+ action: "gitlab:projectAccessToken:create",
226
+ name: "Create GitLab Project Access Token",
227
+ input: {
228
+ repoUrl: "gitlab.com?repo=repo&owner=owner",
229
+ projectId: "123"
230
+ }
231
+ }
232
+ ]
233
+ })
234
+ }
235
+ ];
236
+
147
237
  const createGitlabProjectAccessTokenAction = (options) => {
148
238
  const { integrations } = options;
149
239
  return pluginScaffolderNode.createTemplateAction({
150
240
  id: "gitlab:projectAccessToken:create",
241
+ examples,
151
242
  schema: {
152
243
  input: commonGitlabConfig.merge(
153
244
  zod.z.object({
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/commonGitlabConfig.ts","../src/util.ts","../src/actions/createGitlabGroupEnsureExistsAction.ts","../src/actions/createGitlabProjectDeployTokenAction.ts","../src/actions/createGitlabProjectAccessTokenAction.ts","../src/actions/createGitlabProjectVariableAction.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 { z } from 'zod';\n\nconst commonGitlabConfig = z.object({\n repoUrl: z.string({ description: 'Repository Location' }),\n token: z\n .string({ description: 'The token to use for authorization to GitLab' })\n .optional(),\n});\n\nexport default commonGitlabConfig;\n","/*\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 { InputError } from '@backstage/errors';\nimport {\n GitLabIntegration,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport { z } from 'zod';\nimport commonGitlabConfig from './commonGitlabConfig';\n\nexport const parseRepoHost = (repoUrl: string): string => {\n let parsed;\n try {\n parsed = new URL(`https://${repoUrl}`);\n } catch (error) {\n throw new InputError(\n `Invalid repo URL passed to publisher, got ${repoUrl}, ${error}`,\n );\n }\n return parsed.host;\n};\n\nexport const getToken = (\n config: z.infer<typeof commonGitlabConfig>,\n integrations: ScmIntegrationRegistry,\n): { token: string; integrationConfig: GitLabIntegration } => {\n const host = parseRepoHost(config.repoUrl);\n const integrationConfig = integrations.gitlab.byHost(host);\n\n if (!integrationConfig) {\n throw new InputError(\n `No matching integration configuration for host ${host}, please check your integrations config`,\n );\n }\n\n const token = config.token || integrationConfig.config.token!;\n const tokenType = config.token ? 'oauthToken' : 'token';\n\n if (tokenType === 'oauthToken') {\n throw new InputError(`OAuth Token is currently not supported`);\n }\n\n return { token: token, integrationConfig: integrationConfig };\n};\n","/*\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 { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { Gitlab } from '@gitbeaker/node';\nimport { GroupSchema } from '@gitbeaker/core/dist/types/resources/Groups';\nimport commonGitlabConfig from '../commonGitlabConfig';\nimport { getToken } from '../util';\nimport { z } from 'zod';\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 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 { path } = ctx.input;\n const { token, integrationConfig } = getToken(ctx.input, integrations);\n\n const api = new Gitlab({\n host: integrationConfig.config.baseUrl,\n token: token,\n });\n\n let currentPath: string | null = null;\n let parent: GroupSchema | 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 parent = await api.Groups.create(\n pathElement,\n pathElement,\n parent\n ? {\n parent_id: parent.id,\n }\n : {},\n );\n } else {\n parent = subGroup;\n }\n currentPath = fullPath;\n }\n if (parent !== null) {\n ctx.output('groupId', parent?.id);\n }\n },\n });\n};\n","/*\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 { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { Gitlab } from '@gitbeaker/node';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { DeployTokenScope } from '@gitbeaker/core/dist/types/templates/ResourceDeployTokens';\nimport commonGitlabConfig from '../commonGitlabConfig';\nimport { getToken } from '../util';\nimport { InputError } from '@backstage/errors';\nimport { z } from 'zod';\n\n/**\n * Creates a `gitlab:projectDeployToken:create` Scaffolder action.\n *\n * @param options - Templating configuration.\n * @public\n */\nexport const createGitlabProjectDeployTokenAction = (options: {\n integrations: ScmIntegrationRegistry;\n}) => {\n const { integrations } = options;\n return createTemplateAction({\n id: 'gitlab:projectDeployToken:create',\n schema: {\n input: commonGitlabConfig.merge(\n z.object({\n projectId: z.union([z.number(), z.string()], {\n description: 'Project ID',\n }),\n name: z.string({ description: 'Deploy Token Name' }),\n username: z\n .string({ description: 'Deploy Token Username' })\n .optional(),\n scopes: z.array(z.string(), { description: 'Scopes' }).optional(),\n }),\n ),\n output: z.object({\n deploy_token: z.string({ description: 'Deploy Token' }),\n user: z.string({ description: 'User' }),\n }),\n },\n async handler(ctx) {\n ctx.logger.info(`Creating Token for Project \"${ctx.input.projectId}\"`);\n const { projectId, name, username, scopes } = ctx.input;\n const { token, integrationConfig } = getToken(ctx.input, integrations);\n\n const api = new Gitlab({\n host: integrationConfig.config.baseUrl,\n token: token,\n });\n\n const deployToken = await api.ProjectDeployTokens.add(\n projectId,\n name,\n scopes as DeployTokenScope[],\n {\n username: username,\n },\n );\n\n if (!deployToken.hasOwnProperty('token')) {\n throw new InputError(`No deploy_token given from gitlab instance`);\n }\n\n ctx.output('deploy_token', deployToken.token as string);\n ctx.output('user', deployToken.username);\n },\n });\n};\n","/*\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 { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport commonGitlabConfig from '../commonGitlabConfig';\nimport { getToken } from '../util';\nimport { z } from 'zod';\n\n/**\n * Creates a `gitlab:projectAccessToken:create` Scaffolder action.\n *\n * @param options - Templating configuration.\n * @public\n */\nexport const createGitlabProjectAccessTokenAction = (options: {\n integrations: ScmIntegrationRegistry;\n}) => {\n const { integrations } = options;\n return createTemplateAction({\n id: 'gitlab:projectAccessToken:create',\n schema: {\n input: commonGitlabConfig.merge(\n z.object({\n projectId: z.union([z.number(), z.string()], {\n description: 'Project ID',\n }),\n name: z.string({ description: 'Deploy Token Name' }).optional(),\n accessLevel: z\n .number({ description: 'Access Level of the Token' })\n .optional(),\n scopes: z.array(z.string(), { description: 'Scopes' }).optional(),\n }),\n ),\n output: z.object({\n access_token: z.string({ description: 'Access Token' }),\n }),\n },\n async handler(ctx) {\n ctx.logger.info(`Creating Token for Project \"${ctx.input.projectId}\"`);\n const { projectId, name, accessLevel, scopes } = ctx.input;\n const { token, integrationConfig } = getToken(ctx.input, integrations);\n\n const response = await fetch(\n `${integrationConfig.config.baseUrl}/api/v4/projects/${projectId}/access_tokens`,\n {\n method: 'POST', // *GET, POST, PUT, DELETE, etc.\n headers: {\n 'PRIVATE-TOKEN': token,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n name: name,\n scopes: scopes,\n access_level: accessLevel,\n }),\n },\n );\n\n const result = await response.json();\n\n ctx.output('access_token', result.token);\n },\n });\n};\n","/*\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 { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { Gitlab } from '@gitbeaker/node';\nimport { getToken } from '../util';\nimport commonGitlabConfig from '../commonGitlabConfig';\nimport { z } from 'zod';\n\n/**\n * Creates a `gitlab:projectVariable:create` Scaffolder action.\n *\n * @param options - Templating configuration.\n * @public\n */\nexport const createGitlabProjectVariableAction = (options: {\n integrations: ScmIntegrationRegistry;\n}) => {\n const { integrations } = options;\n return createTemplateAction({\n id: 'gitlab:projectVariable:create',\n schema: {\n input: commonGitlabConfig.merge(\n z.object({\n projectId: z.union([z.number(), z.string()], {\n description: 'Project ID',\n }),\n key: z\n .string({\n description:\n 'The key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed',\n })\n .regex(/^[A-Za-z0-9_]{1,255}$/),\n value: z.string({ description: 'The value of a variable' }),\n variableType: z.string({\n description: 'Variable Type (env_var or file)',\n }),\n variableProtected: z\n .boolean({ description: 'Whether the variable is protected' })\n .default(false)\n .optional(),\n masked: z\n .boolean({ description: 'Whether the variable is masked' })\n .default(false)\n .optional(),\n raw: z\n .boolean({ description: 'Whether the variable is expandable' })\n .default(false)\n .optional(),\n environmentScope: z\n .string({ description: 'The environment_scope of the variable' })\n .default('*')\n .optional(),\n }),\n ),\n },\n async handler(ctx) {\n const {\n projectId,\n key,\n value,\n variableType,\n variableProtected = false,\n masked = false,\n raw = false,\n environmentScope = '*',\n } = ctx.input;\n const { token, integrationConfig } = getToken(ctx.input, integrations);\n\n const api = new Gitlab({\n host: integrationConfig.config.baseUrl,\n token: token,\n });\n\n await api.ProjectVariables.create(projectId, {\n key: key,\n value: value,\n variable_type: variableType,\n protected: variableProtected,\n masked: masked,\n raw: raw,\n environment_scope: environmentScope,\n });\n },\n });\n};\n"],"names":["z","InputError","createTemplateAction","Gitlab"],"mappings":";;;;;;;;;AAkBA,MAAM,kBAAA,GAAqBA,MAAE,MAAO,CAAA;AAAA,EAClC,SAASA,KAAE,CAAA,MAAA,CAAO,EAAE,WAAA,EAAa,uBAAuB,CAAA;AAAA,EACxD,KAAA,EAAOA,MACJ,MAAO,C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A,QACA,KAAA;AAAA,QACA,YAAA;AAAA,QACA,iBAAoB,GAAA,KAAA;AAAA,QACpB,MAAS,GAAA,KAAA;AAAA,QACT,GAAM,GAAA,KAAA;AAAA,QACN,gBAAmB,GAAA,GAAA;AAAA,UACjB,GAAI,CAAA,KAAA,CAAA;AACR,MAAA,MAAM,EAAE,KAAO,EAAA,iBAAA,KAAsB,QAAS,CAAA,GAAA,CAAI,OAAO,YAAY,CAAA,CAAA;AAErE,MAAM,MAAA,GAAA,GAAM,IAAIG,WAAO,CAAA;AAAA,QACrB,IAAA,EAAM,kBAAkB,MAAO,CAAA,OAAA;AAAA,QAC/B,KAAA;AAAA,OACD,CAAA,CAAA;AAED,MAAM,MAAA,GAAA,CAAI,gBAAiB,CAAA,MAAA,CAAO,SAAW,EAAA;AAAA,QAC3C,GAAA;AAAA,QACA,KAAA;AAAA,QACA,aAAe,EAAA,YAAA;AAAA,QACf,SAAW,EAAA,iBAAA;AAAA,QACX,MAAA;AAAA,QACA,GAAA;AAAA,QACA,iBAAmB,EAAA,gBAAA;AAAA,OACpB,CAAA,CAAA;AAAA,KACH;AAAA,GACD,CAAA,CAAA;AACH;;;;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/commonGitlabConfig.ts","../src/util.ts","../src/actions/createGitlabGroupEnsureExistsAction.ts","../src/actions/createGitlabProjectDeployTokenAction.ts","../src/actions/createGitlabProjectAccessTokenAction.examples.ts","../src/actions/createGitlabProjectAccessTokenAction.ts","../src/actions/createGitlabProjectVariableAction.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 { z } from 'zod';\n\nconst commonGitlabConfig = z.object({\n repoUrl: z.string({ description: 'Repository Location' }),\n token: z\n .string({ description: 'The token to use for authorization to GitLab' })\n .optional(),\n});\n\nexport default commonGitlabConfig;\n","/*\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 { InputError } from '@backstage/errors';\nimport {\n GitLabIntegration,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport { z } from 'zod';\nimport commonGitlabConfig from './commonGitlabConfig';\n\nexport const parseRepoHost = (repoUrl: string): string => {\n let parsed;\n try {\n parsed = new URL(`https://${repoUrl}`);\n } catch (error) {\n throw new InputError(\n `Invalid repo URL passed to publisher, got ${repoUrl}, ${error}`,\n );\n }\n return parsed.host;\n};\n\nexport const getToken = (\n config: z.infer<typeof commonGitlabConfig>,\n integrations: ScmIntegrationRegistry,\n): { token: string; integrationConfig: GitLabIntegration } => {\n const host = parseRepoHost(config.repoUrl);\n const integrationConfig = integrations.gitlab.byHost(host);\n\n if (!integrationConfig) {\n throw new InputError(\n `No matching integration configuration for host ${host}, please check your integrations config`,\n );\n }\n\n const token = config.token || integrationConfig.config.token!;\n const tokenType = config.token ? 'oauthToken' : 'token';\n\n if (tokenType === 'oauthToken') {\n throw new InputError(`OAuth Token is currently not supported`);\n }\n\n return { token: token, integrationConfig: integrationConfig };\n};\n","/*\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 { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { Gitlab } from '@gitbeaker/node';\nimport { GroupSchema } from '@gitbeaker/core/dist/types/resources/Groups';\nimport commonGitlabConfig from '../commonGitlabConfig';\nimport { getToken } from '../util';\nimport { z } from 'zod';\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 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 { path } = ctx.input;\n const { token, integrationConfig } = getToken(ctx.input, integrations);\n\n const api = new Gitlab({\n host: integrationConfig.config.baseUrl,\n token: token,\n });\n\n let currentPath: string | null = null;\n let parent: GroupSchema | 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 parent = await api.Groups.create(\n pathElement,\n pathElement,\n parent\n ? {\n parent_id: parent.id,\n }\n : {},\n );\n } else {\n parent = subGroup;\n }\n currentPath = fullPath;\n }\n if (parent !== null) {\n ctx.output('groupId', parent?.id);\n }\n },\n });\n};\n","/*\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 { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { Gitlab } from '@gitbeaker/node';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { DeployTokenScope } from '@gitbeaker/core/dist/types/templates/ResourceDeployTokens';\nimport commonGitlabConfig from '../commonGitlabConfig';\nimport { getToken } from '../util';\nimport { InputError } from '@backstage/errors';\nimport { z } from 'zod';\n\n/**\n * Creates a `gitlab:projectDeployToken:create` Scaffolder action.\n *\n * @param options - Templating configuration.\n * @public\n */\nexport const createGitlabProjectDeployTokenAction = (options: {\n integrations: ScmIntegrationRegistry;\n}) => {\n const { integrations } = options;\n return createTemplateAction({\n id: 'gitlab:projectDeployToken:create',\n schema: {\n input: commonGitlabConfig.merge(\n z.object({\n projectId: z.union([z.number(), z.string()], {\n description: 'Project ID',\n }),\n name: z.string({ description: 'Deploy Token Name' }),\n username: z\n .string({ description: 'Deploy Token Username' })\n .optional(),\n scopes: z.array(z.string(), { description: 'Scopes' }).optional(),\n }),\n ),\n output: z.object({\n deploy_token: z.string({ description: 'Deploy Token' }),\n user: z.string({ description: 'User' }),\n }),\n },\n async handler(ctx) {\n ctx.logger.info(`Creating Token for Project \"${ctx.input.projectId}\"`);\n const { projectId, name, username, scopes } = ctx.input;\n const { token, integrationConfig } = getToken(ctx.input, integrations);\n\n const api = new Gitlab({\n host: integrationConfig.config.baseUrl,\n token: token,\n });\n\n const deployToken = await api.ProjectDeployTokens.add(\n projectId,\n name,\n scopes as DeployTokenScope[],\n {\n username: username,\n },\n );\n\n if (!deployToken.hasOwnProperty('token')) {\n throw new InputError(`No deploy_token given from gitlab instance`);\n }\n\n ctx.output('deploy_token', deployToken.token as string);\n ctx.output('user', deployToken.username);\n },\n });\n};\n","/*\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: 'Create a GitLab project access token with minimal options.',\n example: yaml.stringify({\n steps: [\n {\n id: 'createAccessToken',\n action: 'gitlab:projectAccessToken:create',\n name: 'Create GitLab Project Access Token',\n input: {\n repoUrl: 'gitlab.com?repo=repo&owner=owner',\n projectId: '456',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a GitLab project access token with custom scopes.',\n example: yaml.stringify({\n steps: [\n {\n id: 'createAccessToken',\n action: 'gitlab:projectAccessToken:create',\n name: 'Create GitLab Project Access Token',\n input: {\n repoUrl: 'gitlab.com?repo=repo&owner=owner',\n projectId: '789',\n scopes: ['read_registry', 'write_repository'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a GitLab project access token with a specified name.',\n example: yaml.stringify({\n steps: [\n {\n id: 'createAccessToken',\n action: 'gitlab:projectAccessToken:create',\n name: 'Create GitLab Project Access Token',\n input: {\n repoUrl: 'gitlab.com?repo=repo&owner=owner',\n projectId: '101112',\n name: 'my-custom-token',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Create a GitLab project access token with a numeric project ID.',\n example: yaml.stringify({\n steps: [\n {\n id: 'createAccessToken',\n action: 'gitlab:projectAccessToken:create',\n name: 'Create GitLab Project Access Token',\n input: {\n repoUrl: 'gitlab.com?repo=repo&owner=owner',\n projectId: 42,\n },\n },\n ],\n }),\n },\n {\n description:\n 'Create a GitLab project access token using specific GitLab integrations.',\n example: yaml.stringify({\n steps: [\n {\n id: 'createAccessToken',\n action: 'gitlab:projectAccessToken:create',\n name: 'Create GitLab Project Access Token',\n input: {\n repoUrl: 'gitlab.com?repo=repo&owner=owner',\n projectId: '123',\n },\n },\n ],\n }),\n },\n];\n","/*\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 { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport commonGitlabConfig from '../commonGitlabConfig';\nimport { getToken } from '../util';\nimport { z } from 'zod';\nimport { examples } from './createGitlabProjectAccessTokenAction.examples';\n\n/**\n * Creates a `gitlab:projectAccessToken:create` Scaffolder action.\n *\n * @param options - Templating configuration.\n * @public\n */\nexport const createGitlabProjectAccessTokenAction = (options: {\n integrations: ScmIntegrationRegistry;\n}) => {\n const { integrations } = options;\n return createTemplateAction({\n id: 'gitlab:projectAccessToken:create',\n examples,\n schema: {\n input: commonGitlabConfig.merge(\n z.object({\n projectId: z.union([z.number(), z.string()], {\n description: 'Project ID',\n }),\n name: z.string({ description: 'Deploy Token Name' }).optional(),\n accessLevel: z\n .number({ description: 'Access Level of the Token' })\n .optional(),\n scopes: z.array(z.string(), { description: 'Scopes' }).optional(),\n }),\n ),\n output: z.object({\n access_token: z.string({ description: 'Access Token' }),\n }),\n },\n async handler(ctx) {\n ctx.logger.info(`Creating Token for Project \"${ctx.input.projectId}\"`);\n const { projectId, name, accessLevel, scopes } = ctx.input;\n const { token, integrationConfig } = getToken(ctx.input, integrations);\n\n const response = await fetch(\n `${integrationConfig.config.baseUrl}/api/v4/projects/${projectId}/access_tokens`,\n {\n method: 'POST', // *GET, POST, PUT, DELETE, etc.\n headers: {\n 'PRIVATE-TOKEN': token,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n name: name,\n scopes: scopes,\n access_level: accessLevel,\n }),\n },\n );\n\n const result = await response.json();\n\n ctx.output('access_token', result.token);\n },\n });\n};\n","/*\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 { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { Gitlab } from '@gitbeaker/node';\nimport { getToken } from '../util';\nimport commonGitlabConfig from '../commonGitlabConfig';\nimport { z } from 'zod';\n\n/**\n * Creates a `gitlab:projectVariable:create` Scaffolder action.\n *\n * @param options - Templating configuration.\n * @public\n */\nexport const createGitlabProjectVariableAction = (options: {\n integrations: ScmIntegrationRegistry;\n}) => {\n const { integrations } = options;\n return createTemplateAction({\n id: 'gitlab:projectVariable:create',\n schema: {\n input: commonGitlabConfig.merge(\n z.object({\n projectId: z.union([z.number(), z.string()], {\n description: 'Project ID',\n }),\n key: z\n .string({\n description:\n 'The key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed',\n })\n .regex(/^[A-Za-z0-9_]{1,255}$/),\n value: z.string({ description: 'The value of a variable' }),\n variableType: z.string({\n description: 'Variable Type (env_var or file)',\n }),\n variableProtected: z\n .boolean({ description: 'Whether the variable is protected' })\n .default(false)\n .optional(),\n masked: z\n .boolean({ description: 'Whether the variable is masked' })\n .default(false)\n .optional(),\n raw: z\n .boolean({ description: 'Whether the variable is expandable' })\n .default(false)\n .optional(),\n environmentScope: z\n .string({ description: 'The environment_scope of the variable' })\n .default('*')\n .optional(),\n }),\n ),\n },\n async handler(ctx) {\n const {\n projectId,\n key,\n value,\n variableType,\n variableProtected = false,\n masked = false,\n raw = false,\n environmentScope = '*',\n } = ctx.input;\n const { token, integrationConfig } = getToken(ctx.input, integrations);\n\n const api = new Gitlab({\n host: integrationConfig.config.baseUrl,\n token: token,\n });\n\n await api.ProjectVariables.create(projectId, {\n key: key,\n value: value,\n variable_type: variableType,\n protected: variableProtected,\n masked: masked,\n raw: raw,\n environment_scope: environmentScope,\n });\n },\n });\n};\n"],"names":["z","InputError","createTemplateAction","Gitlab","yaml"],"mappings":";;;;;;;;;;;;;;AAkBA,MAAM,kBAAA,GAAqBA,MAAE,MAAO,CAAA;AAAA,EAClC,SAASA,KAAE,CAAA,MAAA,CAAO,EAAE,WAAA,EAAa,uBAAuB,CAAA;AAAA,EACxD,KAAA,EAAOA,MACJ,MAAO,CAAA,EAAE,aAAa,8CAA+C,EAAC,EACtE,QAAS,EAAA;AACd,CAAC,CAAA;;ACCY,MAAA,aAAA,GAAgB,CAAC,OAA4B,KAAA;AACxD,EAAI,IAAA,MAAA,CAAA;AACJ,EAAI,IAAA;AACF,IAAA,MAAA,GAAS,IAAI,GAAA,CAAI,CAAW,QAAA,EAAA,OAAO,CAAE,CAAA,CAAA,CAAA;AAAA,WAC9B,KAAO,EAAA;AACd,IAAA,MAAM,IAAIC,iBAAA;AAAA,MACR,CAAA,0CAAA,EAA6C,OAAO,CAAA,EAAA,EAAK,KAAK,CAAA,CAAA;AAAA,KAChE,CAAA;AAAA,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A;AAAA,UACZ,gBAAA,EAAkBA,KACf,CAAA,MAAA,CAAO,EAAE,WAAA,EAAa,uCAAwC,EAAC,CAC/D,CAAA,OAAA,CAAQ,GAAG,CAAA,CACX,QAAS,EAAA;AAAA,SACb,CAAA;AAAA,OACH;AAAA,KACF;AAAA,IACA,MAAM,QAAQ,GAAK,EAAA;AACjB,MAAM,MAAA;AAAA,QACJ,SAAA;AAAA,QACA,GAAA;AAAA,QACA,KAAA;AAAA,QACA,YAAA;AAAA,QACA,iBAAoB,GAAA,KAAA;AAAA,QACpB,MAAS,GAAA,KAAA;AAAA,QACT,GAAM,GAAA,KAAA;AAAA,QACN,gBAAmB,GAAA,GAAA;AAAA,UACjB,GAAI,CAAA,KAAA,CAAA;AACR,MAAA,MAAM,EAAE,KAAO,EAAA,iBAAA,KAAsB,QAAS,CAAA,GAAA,CAAI,OAAO,YAAY,CAAA,CAAA;AAErE,MAAM,MAAA,GAAA,GAAM,IAAIG,WAAO,CAAA;AAAA,QACrB,IAAA,EAAM,kBAAkB,MAAO,CAAA,OAAA;AAAA,QAC/B,KAAA;AAAA,OACD,CAAA,CAAA;AAED,MAAM,MAAA,GAAA,CAAI,gBAAiB,CAAA,MAAA,CAAO,SAAW,EAAA;AAAA,QAC3C,GAAA;AAAA,QACA,KAAA;AAAA,QACA,aAAe,EAAA,YAAA;AAAA,QACf,SAAW,EAAA,iBAAA;AAAA,QACX,MAAA;AAAA,QACA,GAAA;AAAA,QACA,iBAAmB,EAAA,gBAAA;AAAA,OACpB,CAAA,CAAA;AAAA,KACH;AAAA,GACD,CAAA,CAAA;AACH;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-backend-module-gitlab",
3
- "version": "0.2.9-next.2",
3
+ "version": "0.2.10-next.0",
4
4
  "main": "dist/index.cjs.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "Apache-2.0",
@@ -31,17 +31,18 @@
31
31
  "postpack": "backstage-cli package postpack"
32
32
  },
33
33
  "dependencies": {
34
- "@backstage/config": "^1.1.1-next.0",
35
- "@backstage/errors": "^1.2.3-next.0",
36
- "@backstage/integration": "^1.7.1-next.1",
37
- "@backstage/plugin-scaffolder-node": "^0.2.6-next.2",
34
+ "@backstage/config": "^1.1.1",
35
+ "@backstage/errors": "^1.2.3",
36
+ "@backstage/integration": "^1.7.1",
37
+ "@backstage/plugin-scaffolder-node": "^0.2.8-next.0",
38
38
  "@gitbeaker/node": "^35.8.0",
39
+ "yaml": "^2.0.0",
39
40
  "zod": "^3.21.4"
40
41
  },
41
42
  "devDependencies": {
42
- "@backstage/backend-common": "^0.19.8-next.2",
43
- "@backstage/cli": "^0.23.0-next.2",
44
- "@backstage/core-app-api": "^1.11.0-next.2"
43
+ "@backstage/backend-common": "^0.19.9-next.0",
44
+ "@backstage/cli": "^0.24.0-next.0",
45
+ "@backstage/core-app-api": "^1.11.1-next.0"
45
46
  },
46
47
  "files": [
47
48
  "dist"