@backstage/plugin-scaffolder-backend-module-gitlab 0.5.1-next.0 → 0.6.0-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.
Files changed (52) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/actions/gitlab.cjs.js +374 -0
  3. package/dist/actions/gitlab.cjs.js.map +1 -0
  4. package/dist/actions/gitlab.examples.cjs.js +155 -0
  5. package/dist/actions/gitlab.examples.cjs.js.map +1 -0
  6. package/dist/actions/gitlabGroupEnsureExists.cjs.js +68 -0
  7. package/dist/actions/gitlabGroupEnsureExists.cjs.js.map +1 -0
  8. package/dist/actions/gitlabGroupEnsureExists.examples.cjs.js +78 -0
  9. package/dist/actions/gitlabGroupEnsureExists.examples.cjs.js.map +1 -0
  10. package/dist/actions/gitlabIssueCreate.cjs.js +136 -0
  11. package/dist/actions/gitlabIssueCreate.cjs.js.map +1 -0
  12. package/dist/actions/gitlabIssueCreate.examples.cjs.js +235 -0
  13. package/dist/actions/gitlabIssueCreate.examples.cjs.js.map +1 -0
  14. package/dist/actions/gitlabIssueEdit.cjs.js +163 -0
  15. package/dist/actions/gitlabIssueEdit.cjs.js.map +1 -0
  16. package/dist/actions/gitlabIssueEdit.examples.cjs.js +250 -0
  17. package/dist/actions/gitlabIssueEdit.examples.cjs.js.map +1 -0
  18. package/dist/actions/gitlabMergeRequest.cjs.js +231 -0
  19. package/dist/actions/gitlabMergeRequest.cjs.js.map +1 -0
  20. package/dist/actions/gitlabMergeRequest.examples.cjs.js +134 -0
  21. package/dist/actions/gitlabMergeRequest.examples.cjs.js.map +1 -0
  22. package/dist/actions/gitlabPipelineTrigger.cjs.js +89 -0
  23. package/dist/actions/gitlabPipelineTrigger.cjs.js.map +1 -0
  24. package/dist/actions/gitlabPipelineTrigger.examples.cjs.js +94 -0
  25. package/dist/actions/gitlabPipelineTrigger.examples.cjs.js.map +1 -0
  26. package/dist/actions/gitlabProjectAccessTokenCreate.cjs.js +85 -0
  27. package/dist/actions/gitlabProjectAccessTokenCreate.cjs.js.map +1 -0
  28. package/dist/actions/gitlabProjectAccessTokenCreate.examples.cjs.js +250 -0
  29. package/dist/actions/gitlabProjectAccessTokenCreate.examples.cjs.js.map +1 -0
  30. package/dist/actions/gitlabProjectDeployTokenCreate.cjs.js +58 -0
  31. package/dist/actions/gitlabProjectDeployTokenCreate.cjs.js.map +1 -0
  32. package/dist/actions/gitlabProjectDeployTokenCreate.examples.cjs.js +100 -0
  33. package/dist/actions/gitlabProjectDeployTokenCreate.examples.cjs.js.map +1 -0
  34. package/dist/actions/gitlabProjectVariableCreate.cjs.js +61 -0
  35. package/dist/actions/gitlabProjectVariableCreate.cjs.js.map +1 -0
  36. package/dist/actions/gitlabProjectVariableCreate.examples.cjs.js +151 -0
  37. package/dist/actions/gitlabProjectVariableCreate.examples.cjs.js.map +1 -0
  38. package/dist/actions/gitlabRepoPush.cjs.js +154 -0
  39. package/dist/actions/gitlabRepoPush.cjs.js.map +1 -0
  40. package/dist/actions/gitlabRepoPush.examples.cjs.js +67 -0
  41. package/dist/actions/gitlabRepoPush.examples.cjs.js.map +1 -0
  42. package/dist/actions/helpers.cjs.js +28 -0
  43. package/dist/actions/helpers.cjs.js.map +1 -0
  44. package/dist/commonGitlabConfig.cjs.js +32 -0
  45. package/dist/commonGitlabConfig.cjs.js.map +1 -0
  46. package/dist/index.cjs.js +28 -2929
  47. package/dist/index.cjs.js.map +1 -1
  48. package/dist/module.cjs.js +47 -0
  49. package/dist/module.cjs.js.map +1 -0
  50. package/dist/util.cjs.js +129 -0
  51. package/dist/util.cjs.js.map +1 -0
  52. package/package.json +10 -10
@@ -0,0 +1,231 @@
1
+ 'use strict';
2
+
3
+ var pluginScaffolderNode = require('@backstage/plugin-scaffolder-node');
4
+ var path = require('path');
5
+ var errors = require('@backstage/errors');
6
+ var backendPluginApi = require('@backstage/backend-plugin-api');
7
+ var helpers = require('./helpers.cjs.js');
8
+ var gitlabMergeRequest_examples = require('./gitlabMergeRequest.examples.cjs.js');
9
+
10
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
11
+
12
+ var path__default = /*#__PURE__*/_interopDefaultCompat(path);
13
+
14
+ function getFileAction(fileInfo, remoteFiles, defaultCommitAction) {
15
+ if (!defaultCommitAction || defaultCommitAction === "auto") {
16
+ const filePath = path__default.default.join(fileInfo.targetPath ?? "", fileInfo.file.path);
17
+ return remoteFiles && remoteFiles.some((remoteFile) => remoteFile.path === filePath) ? "update" : "create";
18
+ }
19
+ return defaultCommitAction;
20
+ }
21
+ const createPublishGitlabMergeRequestAction = (options) => {
22
+ const { integrations } = options;
23
+ return pluginScaffolderNode.createTemplateAction({
24
+ id: "publish:gitlab:merge-request",
25
+ examples: gitlabMergeRequest_examples.examples,
26
+ schema: {
27
+ input: {
28
+ required: ["repoUrl", "branchName"],
29
+ type: "object",
30
+ properties: {
31
+ repoUrl: {
32
+ type: "string",
33
+ title: "Repository Location",
34
+ 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`
35
+ },
36
+ /** @deprecated projectID is passed as query parameters in the repoUrl */
37
+ projectid: {
38
+ type: "string",
39
+ title: "projectid",
40
+ description: "Project ID/Name(slug) of the Gitlab Project"
41
+ },
42
+ title: {
43
+ type: "string",
44
+ title: "Merge Request Name",
45
+ description: "The name for the merge request"
46
+ },
47
+ description: {
48
+ type: "string",
49
+ title: "Merge Request Description",
50
+ description: "The description of the merge request"
51
+ },
52
+ branchName: {
53
+ type: "string",
54
+ title: "Source Branch Name",
55
+ description: "The source branch name of the merge request"
56
+ },
57
+ targetBranchName: {
58
+ type: "string",
59
+ title: "Target Branch Name",
60
+ description: "The target branch name of the merge request"
61
+ },
62
+ sourcePath: {
63
+ type: "string",
64
+ title: "Working Subdirectory",
65
+ description: "Subdirectory of working directory to copy changes from"
66
+ },
67
+ targetPath: {
68
+ type: "string",
69
+ title: "Repository Subdirectory",
70
+ description: "Subdirectory of repository to apply changes to"
71
+ },
72
+ token: {
73
+ title: "Authentication Token",
74
+ type: "string",
75
+ description: "The token to use for authorization to GitLab"
76
+ },
77
+ commitAction: {
78
+ title: "Commit action",
79
+ type: "string",
80
+ enum: ["create", "update", "delete", "auto"],
81
+ description: 'The action to be used for git commit. Defaults to auto. "auto" is custom action provide by backstage, (automatic assign create or update action) /!\\ Use more api calls /!\\ *'
82
+ },
83
+ removeSourceBranch: {
84
+ title: "Delete source branch",
85
+ type: "boolean",
86
+ description: "Option to delete source branch once the MR has been merged. Default: false"
87
+ },
88
+ assignee: {
89
+ title: "Merge Request Assignee",
90
+ type: "string",
91
+ description: "User this merge request will be assigned to"
92
+ }
93
+ }
94
+ },
95
+ output: {
96
+ type: "object",
97
+ properties: {
98
+ targetBranchName: {
99
+ title: "Target branch name of the merge request",
100
+ type: "string"
101
+ },
102
+ projectid: {
103
+ title: "Gitlab Project id/Name(slug)",
104
+ type: "string"
105
+ },
106
+ projectPath: {
107
+ title: "Gitlab Project path",
108
+ type: "string"
109
+ },
110
+ mergeRequestUrl: {
111
+ title: "MergeRequest(MR) URL",
112
+ type: "string",
113
+ description: "Link to the merge request in GitLab"
114
+ }
115
+ }
116
+ }
117
+ },
118
+ async handler(ctx) {
119
+ const {
120
+ assignee,
121
+ branchName,
122
+ targetBranchName,
123
+ description,
124
+ repoUrl,
125
+ removeSourceBranch,
126
+ targetPath,
127
+ sourcePath,
128
+ title,
129
+ token
130
+ } = ctx.input;
131
+ const { owner, repo, project } = pluginScaffolderNode.parseRepoUrl(repoUrl, integrations);
132
+ const repoID = project ? project : `${owner}/${repo}`;
133
+ const api = helpers.createGitlabApi({
134
+ integrations,
135
+ token,
136
+ repoUrl
137
+ });
138
+ let assigneeId = void 0;
139
+ if (assignee !== void 0) {
140
+ try {
141
+ const assigneeUser = await api.Users.username(assignee);
142
+ assigneeId = assigneeUser[0].id;
143
+ } catch (e) {
144
+ ctx.logger.warn(
145
+ `Failed to find gitlab user id for ${assignee}: ${e}. Proceeding with MR creation without an assignee.`
146
+ );
147
+ }
148
+ }
149
+ let fileRoot;
150
+ if (sourcePath) {
151
+ fileRoot = backendPluginApi.resolveSafeChildPath(ctx.workspacePath, sourcePath);
152
+ } else if (targetPath) {
153
+ fileRoot = backendPluginApi.resolveSafeChildPath(ctx.workspacePath, targetPath);
154
+ } else {
155
+ fileRoot = ctx.workspacePath;
156
+ }
157
+ const fileContents = await pluginScaffolderNode.serializeDirectoryContents(fileRoot, {
158
+ gitignore: true
159
+ });
160
+ let targetBranch = targetBranchName;
161
+ if (!targetBranch) {
162
+ const projects = await api.Projects.show(repoID);
163
+ const { default_branch: defaultBranch } = projects;
164
+ targetBranch = defaultBranch;
165
+ }
166
+ let remoteFiles = [];
167
+ if (!ctx.input.commitAction || ctx.input.commitAction === "auto") {
168
+ try {
169
+ remoteFiles = await api.Repositories.tree(repoID, {
170
+ ref: targetBranch,
171
+ recursive: true,
172
+ path: targetPath ?? void 0
173
+ });
174
+ } catch (e) {
175
+ ctx.logger.warn(
176
+ `Could not retrieve the list of files for ${repoID} (branch: ${targetBranch}) : ${e}`
177
+ );
178
+ }
179
+ }
180
+ const actions = fileContents.map((file) => ({
181
+ action: getFileAction(
182
+ { file, targetPath },
183
+ remoteFiles,
184
+ ctx.input.commitAction
185
+ ),
186
+ filePath: targetPath ? path__default.default.posix.join(targetPath, file.path) : file.path,
187
+ encoding: "base64",
188
+ content: file.content.toString("base64"),
189
+ execute_filemode: file.executable
190
+ }));
191
+ try {
192
+ await api.Branches.create(repoID, branchName, String(targetBranch));
193
+ } catch (e) {
194
+ throw new errors.InputError(
195
+ `The branch creation failed. Please check that your repo does not already contain a branch named '${branchName}'. ${e}`
196
+ );
197
+ }
198
+ try {
199
+ await api.Commits.create(repoID, branchName, ctx.input.title, actions);
200
+ } catch (e) {
201
+ throw new errors.InputError(
202
+ `Committing the changes to ${branchName} failed. Please check that none of the files created by the template already exists. ${e}`
203
+ );
204
+ }
205
+ try {
206
+ const mergeRequestUrl = await api.MergeRequests.create(
207
+ repoID,
208
+ branchName,
209
+ String(targetBranch),
210
+ title,
211
+ {
212
+ description,
213
+ removeSourceBranch: removeSourceBranch ? removeSourceBranch : false,
214
+ assigneeId
215
+ }
216
+ ).then((mergeRequest) => {
217
+ return mergeRequest.web_url;
218
+ });
219
+ ctx.output("projectid", repoID);
220
+ ctx.output("targetBranchName", targetBranch);
221
+ ctx.output("projectPath", repoID);
222
+ ctx.output("mergeRequestUrl", mergeRequestUrl);
223
+ } catch (e) {
224
+ throw new errors.InputError(`Merge request creation failed${e}`);
225
+ }
226
+ }
227
+ });
228
+ };
229
+
230
+ exports.createPublishGitlabMergeRequestAction = createPublishGitlabMergeRequestAction;
231
+ //# sourceMappingURL=gitlabMergeRequest.cjs.js.map
@@ -0,0 +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 { Types } from '@gitbeaker/core';\nimport path from 'path';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { InputError } from '@backstage/errors';\nimport { resolveSafeChildPath } from '@backstage/backend-plugin-api';\nimport { createGitlabApi } from './helpers';\nimport { examples } from './gitlabMergeRequest.examples';\n\nfunction getFileAction(\n fileInfo: { file: SerializedFile; targetPath: string | undefined },\n remoteFiles: Types.RepositoryTreeSchema[],\n defaultCommitAction: 'create' | 'delete' | 'update' | 'auto' | undefined,\n): 'create' | 'delete' | 'update' {\n if (!defaultCommitAction || defaultCommitAction === 'auto') {\n const filePath = path.join(fileInfo.targetPath ?? '', fileInfo.file.path);\n return remoteFiles &&\n remoteFiles.some(remoteFile => remoteFile.path === filePath)\n ? 'update'\n : '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' | '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: `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 /** @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:\n 'Subdirectory of working directory to copy changes from',\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:\n 'The action to be used for git commit. Defaults to auto. \"auto\" is custom action provide by backstage, (automatic assign create or update action) /!\\\\ Use more api calls /!\\\\ *',\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.username(assignee);\n assigneeId = assigneeUser[0].id;\n } catch (e) {\n ctx.logger.warn(\n `Failed to find gitlab user id for ${assignee}: ${e}. 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\n const { default_branch: defaultBranch } = projects;\n targetBranch = defaultBranch!;\n }\n\n let remoteFiles: Types.RepositoryTreeSchema[] = [];\n if (!ctx.input.commitAction || ctx.input.commitAction === 'auto') {\n try {\n remoteFiles = await api.Repositories.tree(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}) : ${e}`,\n );\n }\n }\n\n const actions: Types.CommitAction[] = fileContents.map(file => ({\n action: getFileAction(\n { file, targetPath },\n remoteFiles,\n ctx.input.commitAction,\n ),\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 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}'. ${e}`,\n );\n }\n\n try {\n await api.Commits.create(repoID, branchName, ctx.input.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. ${e}`,\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: { web_url: string }) => {\n return mergeRequest.web_url;\n });\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(`Merge request creation failed${e}`);\n }\n },\n });\n};\n"],"names":["path","createTemplateAction","examples","parseRepoUrl","createGitlabApi","resolveSafeChildPath","serializeDirectoryContents","InputError"],"mappings":";;;;;;;;;;;;;AA8BA,SAAS,aAAA,CACP,QACA,EAAA,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SAClI,CAAA;AAAA,OACF;AAEA,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,UAAA;AAAA,WACF;AAAA,SACF,CAAE,IAAK,CAAA,CAAC,YAAsC,KAAA;AAC5C,UAAA,OAAO,YAAa,CAAA,OAAA,CAAA;AAAA,SACrB,CAAA,CAAA;AACD,QAAI,GAAA,CAAA,MAAA,CAAO,aAAa,MAAM,CAAA,CAAA;AAC9B,QAAI,GAAA,CAAA,MAAA,CAAO,oBAAoB,YAAY,CAAA,CAAA;AAC3C,QAAI,GAAA,CAAA,MAAA,CAAO,eAAe,MAAM,CAAA,CAAA;AAChC,QAAI,GAAA,CAAA,MAAA,CAAO,mBAAmB,eAAe,CAAA,CAAA;AAAA,eACtC,CAAG,EAAA;AACV,QAAA,MAAM,IAAIA,iBAAA,CAAW,CAAgC,6BAAA,EAAA,CAAC,CAAE,CAAA,CAAA,CAAA;AAAA,OAC1D;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
@@ -0,0 +1,134 @@
1
+ 'use strict';
2
+
3
+ var yaml = require('yaml');
4
+
5
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
6
+
7
+ var yaml__default = /*#__PURE__*/_interopDefaultCompat(yaml);
8
+
9
+ const examples = [
10
+ {
11
+ description: "Create a merge request with a specific assignee",
12
+ example: yaml__default.default.stringify({
13
+ steps: [
14
+ {
15
+ id: "createMergeRequest",
16
+ action: "publish:gitlab:merge-request",
17
+ name: "Create a Merge Request",
18
+ input: {
19
+ repoUrl: "gitlab.com?repo=repo&owner=owner",
20
+ title: "Create my new MR",
21
+ description: "This MR is really good",
22
+ sourcePath: "./path/to/my/changes",
23
+ branchName: "new-mr",
24
+ assignee: "my-assignee"
25
+ }
26
+ }
27
+ ]
28
+ })
29
+ },
30
+ {
31
+ description: "Create a merge request with removal of source branch after merge",
32
+ example: yaml__default.default.stringify({
33
+ steps: [
34
+ {
35
+ id: "createMergeRequest",
36
+ action: "publish:gitlab:merge-request",
37
+ name: "Create a Merge Request",
38
+ input: {
39
+ repoUrl: "gitlab.com?repo=repo&owner=owner",
40
+ title: "Create my new MR",
41
+ description: "This MR is really good",
42
+ sourcePath: "./path/to/my/changes",
43
+ branchName: "new-mr",
44
+ removeSourceBranch: true
45
+ }
46
+ }
47
+ ]
48
+ })
49
+ },
50
+ {
51
+ description: "Create a merge request with a target branch",
52
+ example: yaml__default.default.stringify({
53
+ steps: [
54
+ {
55
+ id: "createMergeRequest",
56
+ action: "publish:gitlab:merge-request",
57
+ name: "Create a Merge Request",
58
+ input: {
59
+ repoUrl: "gitlab.com?repo=repo&owner=owner",
60
+ title: "Create my new MR",
61
+ description: "This MR is really good",
62
+ sourcePath: "./path/to/my/changes",
63
+ branchName: "new-mr",
64
+ targetBranchName: "test",
65
+ targetPath: "Subdirectory"
66
+ }
67
+ }
68
+ ]
69
+ })
70
+ },
71
+ {
72
+ description: "Create a merge request with a commit action as create",
73
+ example: yaml__default.default.stringify({
74
+ steps: [
75
+ {
76
+ id: "createMergeRequest",
77
+ action: "publish:gitlab:merge-request",
78
+ name: "Create a Merge Request",
79
+ input: {
80
+ repoUrl: "gitlab.com?repo=repo&owner=owner",
81
+ title: "Create my new MR",
82
+ branchName: "new-mr",
83
+ description: "MR description",
84
+ commitAction: "create",
85
+ targetPath: "source"
86
+ }
87
+ }
88
+ ]
89
+ })
90
+ },
91
+ {
92
+ description: "Create a merge request with a commit action as delete",
93
+ example: yaml__default.default.stringify({
94
+ steps: [
95
+ {
96
+ id: "createMergeRequest",
97
+ action: "publish:gitlab:merge-request",
98
+ name: "Create a Merge Request",
99
+ input: {
100
+ repoUrl: "gitlab.com?repo=repo&owner=owner",
101
+ title: "Create my new MR",
102
+ branchName: "new-mr",
103
+ description: "MR description",
104
+ commitAction: "delete",
105
+ targetPath: "source"
106
+ }
107
+ }
108
+ ]
109
+ })
110
+ },
111
+ {
112
+ description: "Create a merge request with a commit action as update",
113
+ example: yaml__default.default.stringify({
114
+ steps: [
115
+ {
116
+ id: "createMergeRequest",
117
+ action: "publish:gitlab:merge-request",
118
+ name: "Create a Merge Request",
119
+ input: {
120
+ repoUrl: "gitlab.com?repo=repo&owner=owner",
121
+ title: "Create my new MR",
122
+ branchName: "new-mr",
123
+ description: "MR description",
124
+ commitAction: "update",
125
+ targetPath: "source"
126
+ }
127
+ }
128
+ ]
129
+ })
130
+ }
131
+ ];
132
+
133
+ exports.examples = examples;
134
+ //# sourceMappingURL=gitlabMergeRequest.examples.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlabMergeRequest.examples.cjs.js","sources":["../../src/actions/gitlabMergeRequest.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: 'Create a merge request with a specific assignee',\n example: yaml.stringify({\n steps: [\n {\n id: 'createMergeRequest',\n action: 'publish:gitlab:merge-request',\n name: 'Create a Merge Request',\n input: {\n repoUrl: 'gitlab.com?repo=repo&owner=owner',\n title: 'Create my new MR',\n description: 'This MR is really good',\n sourcePath: './path/to/my/changes',\n branchName: 'new-mr',\n assignee: 'my-assignee',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Create a merge request with removal of source branch after merge',\n example: yaml.stringify({\n steps: [\n {\n id: 'createMergeRequest',\n action: 'publish:gitlab:merge-request',\n name: 'Create a Merge Request',\n input: {\n repoUrl: 'gitlab.com?repo=repo&owner=owner',\n title: 'Create my new MR',\n description: 'This MR is really good',\n sourcePath: './path/to/my/changes',\n branchName: 'new-mr',\n removeSourceBranch: true,\n },\n },\n ],\n }),\n },\n {\n description: 'Create a merge request with a target branch',\n example: yaml.stringify({\n steps: [\n {\n id: 'createMergeRequest',\n action: 'publish:gitlab:merge-request',\n name: 'Create a Merge Request',\n input: {\n repoUrl: 'gitlab.com?repo=repo&owner=owner',\n title: 'Create my new MR',\n description: 'This MR is really good',\n sourcePath: './path/to/my/changes',\n branchName: 'new-mr',\n targetBranchName: 'test',\n targetPath: 'Subdirectory',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a merge request with a commit action as create',\n example: yaml.stringify({\n steps: [\n {\n id: 'createMergeRequest',\n action: 'publish:gitlab:merge-request',\n name: 'Create a Merge Request',\n input: {\n repoUrl: 'gitlab.com?repo=repo&owner=owner',\n title: 'Create my new MR',\n branchName: 'new-mr',\n description: 'MR description',\n commitAction: 'create',\n targetPath: 'source',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a merge request with a commit action as delete',\n example: yaml.stringify({\n steps: [\n {\n id: 'createMergeRequest',\n action: 'publish:gitlab:merge-request',\n name: 'Create a Merge Request',\n input: {\n repoUrl: 'gitlab.com?repo=repo&owner=owner',\n title: 'Create my new MR',\n branchName: 'new-mr',\n description: 'MR description',\n commitAction: 'delete',\n targetPath: 'source',\n },\n },\n ],\n }),\n },\n {\n description: 'Create a merge request with a commit action as update',\n example: yaml.stringify({\n steps: [\n {\n id: 'createMergeRequest',\n action: 'publish:gitlab:merge-request',\n name: 'Create a Merge Request',\n input: {\n repoUrl: 'gitlab.com?repo=repo&owner=owner',\n title: 'Create my new MR',\n branchName: 'new-mr',\n description: 'MR description',\n commitAction: 'update',\n targetPath: 'source',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAkBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,iDAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,oBAAA;AAAA,UACJ,MAAQ,EAAA,8BAAA;AAAA,UACR,IAAM,EAAA,wBAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,kCAAA;AAAA,YACT,KAAO,EAAA,kBAAA;AAAA,YACP,WAAa,EAAA,wBAAA;AAAA,YACb,UAAY,EAAA,sBAAA;AAAA,YACZ,UAAY,EAAA,QAAA;AAAA,YACZ,QAAU,EAAA,aAAA;AAAA,WACZ;AAAA,SACF;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AAAA,EACA;AAAA,IACE,WACE,EAAA,kEAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,oBAAA;AAAA,UACJ,MAAQ,EAAA,8BAAA;AAAA,UACR,IAAM,EAAA,wBAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,kCAAA;AAAA,YACT,KAAO,EAAA,kBAAA;AAAA,YACP,WAAa,EAAA,wBAAA;AAAA,YACb,UAAY,EAAA,sBAAA;AAAA,YACZ,UAAY,EAAA,QAAA;AAAA,YACZ,kBAAoB,EAAA,IAAA;AAAA,WACtB;AAAA,SACF;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,6CAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,oBAAA;AAA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QAAA;AAAA,WACd;AAAA,SACF;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,uDAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,oBAAA;AAAA,UACJ,MAAQ,EAAA,8BAAA;AAAA,UACR,IAAM,EAAA,wBAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,kCAAA;AAAA,YACT,KAAO,EAAA,kBAAA;AAAA,YACP,UAAY,EAAA,QAAA;AAAA,YACZ,WAAa,EAAA,gBAAA;AAAA,YACb,YAAc,EAAA,QAAA;AAAA,YACd,UAAY,EAAA,QAAA;AAAA,WACd;AAAA,SACF;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AACF;;;;"}
@@ -0,0 +1,89 @@
1
+ 'use strict';
2
+
3
+ var errors = require('@backstage/errors');
4
+ var pluginScaffolderNode = require('@backstage/plugin-scaffolder-node');
5
+ var zod = require('zod');
6
+ var commonGitlabConfig = require('../commonGitlabConfig.cjs.js');
7
+ var util = require('../util.cjs.js');
8
+ var gitlabPipelineTrigger_examples = require('./gitlabPipelineTrigger.examples.cjs.js');
9
+
10
+ const pipelineInputProperties = zod.z.object({
11
+ projectId: zod.z.number().describe("Project Id"),
12
+ tokenDescription: zod.z.string().describe("Pipeline token description"),
13
+ branch: zod.z.string().describe("Project branch"),
14
+ variables: zod.z.record(zod.z.string(), zod.z.string()).optional().describe(
15
+ "A object/record of key-valued strings containing the pipeline variables."
16
+ )
17
+ });
18
+ const pipelineOutputProperties = zod.z.object({
19
+ pipelineUrl: zod.z.string({ description: "Pipeline Url" })
20
+ });
21
+ const createTriggerGitlabPipelineAction = (options) => {
22
+ const { integrations } = options;
23
+ return pluginScaffolderNode.createTemplateAction({
24
+ id: "gitlab:pipeline:trigger",
25
+ description: "Triggers a GitLab Pipeline.",
26
+ examples: gitlabPipelineTrigger_examples.examples,
27
+ schema: {
28
+ input: commonGitlabConfig.default.merge(pipelineInputProperties),
29
+ output: pipelineOutputProperties
30
+ },
31
+ async handler(ctx) {
32
+ let pipelineTokenResponse = null;
33
+ const { repoUrl, projectId, tokenDescription, token, branch, variables } = commonGitlabConfig.default.merge(pipelineInputProperties).parse(ctx.input);
34
+ const { host } = util.parseRepoUrl(repoUrl, integrations);
35
+ const api = util.getClient({ host, integrations, token });
36
+ try {
37
+ pipelineTokenResponse = await api.PipelineTriggerTokens.create(
38
+ projectId,
39
+ tokenDescription
40
+ );
41
+ if (!pipelineTokenResponse.token) {
42
+ ctx.logger.error("Failed to create pipeline token.");
43
+ return;
44
+ }
45
+ ctx.logger.info(
46
+ `Pipeline token id ${pipelineTokenResponse.id} created.`
47
+ );
48
+ const pipelineTriggerResponse = await api.PipelineTriggerTokens.trigger(
49
+ projectId,
50
+ branch,
51
+ pipelineTokenResponse.token,
52
+ { variables }
53
+ );
54
+ if (!pipelineTriggerResponse.id) {
55
+ ctx.logger.error("Failed to trigger pipeline.");
56
+ return;
57
+ }
58
+ ctx.logger.info(`Pipeline id ${pipelineTriggerResponse.id} triggered.`);
59
+ ctx.output("pipelineUrl", pipelineTriggerResponse.web_url);
60
+ } catch (error) {
61
+ if (error instanceof zod.z.ZodError) {
62
+ throw new errors.InputError(`Validation error: ${error.message}`, {
63
+ validationErrors: error.errors
64
+ });
65
+ }
66
+ throw new errors.InputError(`Failed to trigger Pipeline: ${error.message}`);
67
+ } finally {
68
+ if (pipelineTokenResponse && pipelineTokenResponse.id) {
69
+ try {
70
+ await api.PipelineTriggerTokens.remove(
71
+ projectId,
72
+ pipelineTokenResponse.id
73
+ );
74
+ ctx.logger.info(
75
+ `Deleted pipeline token ${pipelineTokenResponse.id}.`
76
+ );
77
+ } catch (error) {
78
+ ctx.logger.error(
79
+ `Failed to delete pipeline token id ${pipelineTokenResponse.id}.`
80
+ );
81
+ }
82
+ }
83
+ }
84
+ }
85
+ });
86
+ };
87
+
88
+ exports.createTriggerGitlabPipelineAction = createTriggerGitlabPipelineAction;
89
+ //# sourceMappingURL=gitlabPipelineTrigger.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlabPipelineTrigger.cjs.js","sources":["../../src/actions/gitlabPipelineTrigger.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 */\n\nimport { InputError } from '@backstage/errors';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport {\n ExpandedPipelineSchema,\n PipelineTriggerTokenSchema,\n} from '@gitbeaker/rest';\nimport { z } from 'zod';\nimport commonGitlabConfig from '../commonGitlabConfig';\nimport { getClient, parseRepoUrl } from '../util';\nimport { examples } from './gitlabPipelineTrigger.examples';\n\nconst pipelineInputProperties = z.object({\n projectId: z.number().describe('Project Id'),\n tokenDescription: z.string().describe('Pipeline token description'),\n branch: z.string().describe('Project branch'),\n variables: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'A object/record of key-valued strings containing the pipeline variables.',\n ),\n});\n\nconst pipelineOutputProperties = z.object({\n pipelineUrl: z.string({ description: 'Pipeline Url' }),\n});\n\n/**\n * Creates a `gitlab:pipeline:trigger` Scaffolder action.\n *\n * @param options - Templating configuration.\n * @public\n */\nexport const createTriggerGitlabPipelineAction = (options: {\n integrations: ScmIntegrationRegistry;\n}) => {\n const { integrations } = options;\n return createTemplateAction({\n id: 'gitlab:pipeline:trigger',\n description: 'Triggers a GitLab Pipeline.',\n examples,\n schema: {\n input: commonGitlabConfig.merge(pipelineInputProperties),\n output: pipelineOutputProperties,\n },\n async handler(ctx) {\n let pipelineTokenResponse: PipelineTriggerTokenSchema | null = null;\n\n const { repoUrl, projectId, tokenDescription, token, branch, variables } =\n commonGitlabConfig.merge(pipelineInputProperties).parse(ctx.input);\n\n const { host } = parseRepoUrl(repoUrl, integrations);\n const api = getClient({ host, integrations, token });\n\n try {\n // Create a pipeline token\n pipelineTokenResponse = (await api.PipelineTriggerTokens.create(\n projectId,\n tokenDescription,\n )) as PipelineTriggerTokenSchema;\n\n if (!pipelineTokenResponse.token) {\n ctx.logger.error('Failed to create pipeline token.');\n return;\n }\n ctx.logger.info(\n `Pipeline token id ${pipelineTokenResponse.id} created.`,\n );\n\n // Use the pipeline token to trigger the pipeline in the project\n const pipelineTriggerResponse =\n (await api.PipelineTriggerTokens.trigger(\n projectId,\n branch,\n pipelineTokenResponse.token,\n { variables },\n )) as ExpandedPipelineSchema;\n\n if (!pipelineTriggerResponse.id) {\n ctx.logger.error('Failed to trigger pipeline.');\n return;\n }\n\n ctx.logger.info(`Pipeline id ${pipelineTriggerResponse.id} triggered.`);\n\n ctx.output('pipelineUrl', pipelineTriggerResponse.web_url);\n } catch (error: any) {\n if (error instanceof z.ZodError) {\n // Handling Zod validation errors\n throw new InputError(`Validation error: ${error.message}`, {\n validationErrors: error.errors,\n });\n }\n // Handling other errors\n throw new InputError(`Failed to trigger Pipeline: ${error.message}`);\n } finally {\n // Delete the pipeline token if it was created\n if (pipelineTokenResponse && pipelineTokenResponse.id) {\n try {\n await api.PipelineTriggerTokens.remove(\n projectId,\n pipelineTokenResponse.id,\n );\n ctx.logger.info(\n `Deleted pipeline token ${pipelineTokenResponse.id}.`,\n );\n } catch (error: any) {\n ctx.logger.error(\n `Failed to delete pipeline token id ${pipelineTokenResponse.id}.`,\n );\n }\n }\n }\n },\n });\n};\n"],"names":["z","createTemplateAction","examples","commonGitlabConfig","parseRepoUrl","getClient","InputError"],"mappings":";;;;;;;;;AA4BA,MAA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;AAAA,YACzD,kBAAkB,KAAM,CAAA,MAAA;AAAA,WACzB,CAAA,CAAA;AAAA,SACH;AAEA,QAAA,MAAM,IAAIA,iBAAA,CAAW,CAA+B,4BAAA,EAAA,KAAA,CAAM,OAAO,CAAE,CAAA,CAAA,CAAA;AAAA,OACnE,SAAA;AAEA,QAAI,IAAA,qBAAA,IAAyB,sBAAsB,EAAI,EAAA;AACrD,UAAI,IAAA;AACF,YAAA,MAAM,IAAI,qBAAsB,CAAA,MAAA;AAAA,cAC9B,SAAA;AAAA,cACA,qBAAsB,CAAA,EAAA;AAAA,aACxB,CAAA;AACA,YAAA,GAAA,CAAI,MAAO,CAAA,IAAA;AAAA,cACT,CAAA,uBAAA,EAA0B,sBAAsB,EAAE,CAAA,CAAA,CAAA;AAAA,aACpD,CAAA;AAAA,mBACO,KAAY,EAAA;AACnB,YAAA,GAAA,CAAI,MAAO,CAAA,KAAA;AAAA,cACT,CAAA,mCAAA,EAAsC,sBAAsB,EAAE,CAAA,CAAA,CAAA;AAAA,aAChE,CAAA;AAAA,WACF;AAAA,SACF;AAAA,OACF;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
@@ -0,0 +1,94 @@
1
+ 'use strict';
2
+
3
+ var yaml = require('yaml');
4
+ var commonGitlabConfig = require('../commonGitlabConfig.cjs.js');
5
+
6
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
7
+
8
+ var yaml__default = /*#__PURE__*/_interopDefaultCompat(yaml);
9
+
10
+ const examples = [
11
+ {
12
+ description: "Trigger a GitLab Project Pipeline",
13
+ example: yaml__default.default.stringify({
14
+ steps: [
15
+ {
16
+ id: "triggerPipeline",
17
+ name: "Trigger Project Pipeline",
18
+ action: "gitlab:pipeline:trigger",
19
+ input: {
20
+ ...commonGitlabConfig.commonGitlabConfigExample,
21
+ projectId: 12,
22
+ tokenDescription: "This is the text that will appear in the pipeline token",
23
+ token: "glpt-xxxxxxxxxxxx",
24
+ branch: "main",
25
+ variables: { var_one: "one", var_two: "two" }
26
+ }
27
+ }
28
+ ]
29
+ })
30
+ },
31
+ {
32
+ description: "Trigger a GitLab Project Pipeline with No Variables",
33
+ example: yaml__default.default.stringify({
34
+ steps: [
35
+ {
36
+ id: "triggerPipeline",
37
+ name: "Trigger Project Pipeline",
38
+ action: "gitlab:pipeline:trigger",
39
+ input: {
40
+ ...commonGitlabConfig.commonGitlabConfigExample,
41
+ projectId: 12,
42
+ tokenDescription: "This is the text that will appear in the pipeline token",
43
+ token: "glpt-xxxxxxxxxxxx",
44
+ branch: "main",
45
+ variables: {}
46
+ }
47
+ }
48
+ ]
49
+ })
50
+ },
51
+ {
52
+ description: "Trigger a GitLab Project Pipeline with Single Variables",
53
+ example: yaml__default.default.stringify({
54
+ steps: [
55
+ {
56
+ id: "triggerPipeline",
57
+ name: "Trigger Project Pipeline",
58
+ action: "gitlab:pipeline:trigger",
59
+ input: {
60
+ ...commonGitlabConfig.commonGitlabConfigExample,
61
+ projectId: 12,
62
+ tokenDescription: "This is the text that will appear in the pipeline token",
63
+ token: "glpt-xxxxxxxxxxxx",
64
+ branch: "main",
65
+ variables: { var_one: "one" }
66
+ }
67
+ }
68
+ ]
69
+ })
70
+ },
71
+ {
72
+ description: "Trigger a GitLab Project Pipeline with Multiple Variables",
73
+ example: yaml__default.default.stringify({
74
+ steps: [
75
+ {
76
+ id: "triggerPipeline",
77
+ name: "Trigger Project Pipeline",
78
+ action: "gitlab:pipeline:trigger",
79
+ input: {
80
+ ...commonGitlabConfig.commonGitlabConfigExample,
81
+ projectId: 12,
82
+ tokenDescription: "This is the text that will appear in the pipeline token",
83
+ token: "glpt-xxxxxxxxxxxx",
84
+ branch: "main",
85
+ variables: { var_one: "one", var_two: "two", var_three: "three" }
86
+ }
87
+ }
88
+ ]
89
+ })
90
+ }
91
+ ];
92
+
93
+ exports.examples = examples;
94
+ //# sourceMappingURL=gitlabPipelineTrigger.examples.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlabPipelineTrigger.examples.cjs.js","sources":["../../src/actions/gitlabPipelineTrigger.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';\nimport { commonGitlabConfigExample } from '../commonGitlabConfig';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Trigger a GitLab Project Pipeline',\n example: yaml.stringify({\n steps: [\n {\n id: 'triggerPipeline',\n name: 'Trigger Project Pipeline',\n action: 'gitlab:pipeline:trigger',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n tokenDescription:\n 'This is the text that will appear in the pipeline token',\n token: 'glpt-xxxxxxxxxxxx',\n branch: 'main',\n variables: { var_one: 'one', var_two: 'two' },\n },\n },\n ],\n }),\n },\n {\n description: 'Trigger a GitLab Project Pipeline with No Variables',\n example: yaml.stringify({\n steps: [\n {\n id: 'triggerPipeline',\n name: 'Trigger Project Pipeline',\n action: 'gitlab:pipeline:trigger',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n tokenDescription:\n 'This is the text that will appear in the pipeline token',\n token: 'glpt-xxxxxxxxxxxx',\n branch: 'main',\n variables: {},\n },\n },\n ],\n }),\n },\n {\n description: 'Trigger a GitLab Project Pipeline with Single Variables',\n example: yaml.stringify({\n steps: [\n {\n id: 'triggerPipeline',\n name: 'Trigger Project Pipeline',\n action: 'gitlab:pipeline:trigger',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n tokenDescription:\n 'This is the text that will appear in the pipeline token',\n token: 'glpt-xxxxxxxxxxxx',\n branch: 'main',\n variables: { var_one: 'one' },\n },\n },\n ],\n }),\n },\n {\n description: 'Trigger a GitLab Project Pipeline with Multiple Variables',\n example: yaml.stringify({\n steps: [\n {\n id: 'triggerPipeline',\n name: 'Trigger Project Pipeline',\n action: 'gitlab:pipeline:trigger',\n input: {\n ...commonGitlabConfigExample,\n projectId: 12,\n tokenDescription:\n 'This is the text that will appear in the pipeline token',\n token: 'glpt-xxxxxxxxxxxx',\n branch: 'main',\n variables: { var_one: 'one', var_two: 'two', var_three: 'three' },\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml","commonGitlabConfigExample"],"mappings":";;;;;;;;;AAmBO,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,iBAAA;AAAA,UACJ,IAAM,EAAA,0BAAA;AAAA,UACN,MAAQ,EAAA,yBAAA;AAAA,UACR,KAAO,EAAA;AAAA,YACL,GAAGC,4CAAA;AAAA,YACH,SAAW,EAAA,EAAA;AAAA,YACX,gBACE,EAAA,yDAAA;AAAA,YACF,KAAO,EAAA,mBAAA;AAAA,YACP,MAAQ,EAAA,MAAA;AAAA,YACR,SAAW,EAAA,EAAE,OAAS,EAAA,KAAA,EAAO,SAAS,KAAM,EAAA;AAAA,WAC9C;AAAA,SACF;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,qDAAA;AAAA,IACb,OAAA,EAASD,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,iBAAA;AAAA,UACJ,IAAM,EAAA,0BAAA;AAAA,UACN,MAAQ,EAAA,yBAAA;AAAA,UACR,KAAO,EAAA;AAAA,YACL,GAAGC,4CAAA;AAAA,YACH,SAAW,EA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