@backstage/plugin-scaffolder-backend-module-gerrit 0.2.12-next.0 → 0.2.13-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 +17 -0
- package/dist/actions/gerrit.cjs.js.map +1 -1
- package/dist/actions/gerrit.examples.cjs.js.map +1 -1
- package/dist/actions/gerritReview.cjs.js.map +1 -1
- package/dist/actions/gerritReview.examples.cjs.js.map +1 -1
- package/dist/module.cjs.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-backend-module-gerrit
|
|
2
2
|
|
|
3
|
+
## 0.2.13-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/integration@1.18.0-next.0
|
|
9
|
+
- @backstage/plugin-scaffolder-node@0.11.1-next.0
|
|
10
|
+
- @backstage/backend-plugin-api@1.4.3-next.0
|
|
11
|
+
|
|
12
|
+
## 0.2.12
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @backstage/plugin-scaffolder-node@0.11.0
|
|
18
|
+
- @backstage/backend-plugin-api@1.4.2
|
|
19
|
+
|
|
3
20
|
## 0.2.12-next.0
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gerrit.cjs.js","sources":["../../src/actions/gerrit.ts"],"sourcesContent":["/*\n * Copyright 2022 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 crypto from 'crypto';\nimport { InputError } from '@backstage/errors';\nimport { Config } from '@backstage/config';\nimport {\n GerritIntegrationConfig,\n getGerritRequestOptions,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport {\n createTemplateAction,\n getRepoSourceDirectory,\n initRepoAndPush,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { examples } from './gerrit.examples';\n\nconst createGerritProject = async (\n config: GerritIntegrationConfig,\n options: {\n projectName: string;\n parent: string;\n owner?: string;\n description: string;\n defaultBranch: string;\n },\n): Promise<void> => {\n const { projectName, parent, owner, description, defaultBranch } = options;\n\n const fetchOptions: RequestInit = {\n method: 'PUT',\n body: JSON.stringify({\n parent,\n description,\n branches: [defaultBranch],\n owners: owner ? [owner] : [],\n create_empty_commit: false,\n }),\n headers: {\n ...getGerritRequestOptions(config).headers,\n 'Content-Type': 'application/json',\n },\n };\n const response: Response = await fetch(\n `${config.baseUrl}/a/projects/${encodeURIComponent(projectName)}`,\n fetchOptions,\n );\n if (response.status !== 201) {\n throw new Error(\n `Unable to create repository, ${response.status} ${\n response.statusText\n }, ${await response.text()}`,\n );\n }\n};\n\nconst generateCommitMessage = (\n config: Config,\n commitSubject?: string,\n): string => {\n const changeId = crypto.randomBytes(20).toString('hex');\n const msg = `${\n config.getOptionalString('scaffolder.defaultCommitMessage') || commitSubject\n }\\n\\nChange-Id: I${changeId}`;\n return msg;\n};\n\n/**\n * Creates a new action that initializes a git repository of the content in the workspace\n * and publishes it to a Gerrit instance.\n * @public\n */\nexport function createPublishGerritAction(options: {\n integrations: ScmIntegrationRegistry;\n config: Config;\n}) {\n const { integrations, config } = options;\n\n return createTemplateAction({\n id: 'publish:gerrit',\n supportsDryRun: true,\n description:\n 'Initializes a git repository of the content in the workspace, and publishes it to Gerrit.',\n examples,\n schema: {\n input: {\n repoUrl: z =>\n z.string({\n description: 'Repository Location',\n }),\n description: z =>\n z.string({\n description: 'Repository Description',\n }),\n defaultBranch: z =>\n z\n .string({\n description: `Sets the default branch on the repository. The default value is 'master'`,\n })\n .optional(),\n gitCommitMessage: z =>\n z\n .string({\n description: `Sets the commit message on the repository. The default value is 'initial commit'`,\n })\n .optional(),\n gitAuthorName: z =>\n z\n .string({\n description: `Sets the default author name for the commit. The default value is 'Scaffolder'`,\n })\n .optional(),\n gitAuthorEmail: z =>\n z\n .string({\n description: `Sets the default author email for the commit.`,\n })\n .optional(),\n sourcePath: z =>\n z\n .string({\n description: `Path within the workspace that will be used as the repository root. If omitted, the entire workspace will be published as the repository.`,\n })\n .optional(),\n signCommit: z =>\n z\n .boolean({\n description: 'Sign commit with configured PGP private key',\n })\n .optional(),\n },\n output: {\n remoteUrl: z =>\n z\n .string({\n description: 'A URL to the repository with the provider',\n })\n .optional(),\n repoContentsUrl: z =>\n z\n .string({\n description: 'A URL to the root of the repository',\n })\n .optional(),\n commitHash: z =>\n z\n .string({\n description: 'The git commit hash of the initial commit',\n })\n .optional(),\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n description,\n defaultBranch = 'master',\n gitAuthorName,\n gitAuthorEmail,\n gitCommitMessage = 'initial commit',\n sourcePath,\n signCommit,\n } = ctx.input;\n const { repo, host, owner, workspace } = parseRepoUrl(\n repoUrl,\n integrations,\n );\n\n const integrationConfig = integrations.gerrit.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 if (!workspace) {\n throw new InputError(\n `Invalid URL provider was included in the repo URL to create ${ctx.input.repoUrl}, missing workspace`,\n );\n }\n\n const repoContentsUrl = `${integrationConfig.config.gitilesBaseUrl}/${repo}/+/refs/heads/${defaultBranch}`;\n const remoteUrl = `${integrationConfig.config.cloneUrl}/a/${repo}`;\n const gitName = gitAuthorName\n ? gitAuthorName\n : config.getOptionalString('scaffolder.defaultAuthor.name');\n const gitEmail = gitAuthorEmail\n ? gitAuthorEmail\n : config.getOptionalString('scaffolder.defaultAuthor.email');\n const commitMessage = generateCommitMessage(config, gitCommitMessage);\n\n if (ctx.isDryRun) {\n ctx.logger.info(\n `Dry run arguments: ${{\n gitName,\n gitEmail,\n commitMessage,\n ...ctx.input,\n }}`,\n );\n ctx.output('remoteUrl', remoteUrl);\n ctx.output('commitHash', 'abcd-dry-run-1234');\n ctx.output('repoContentsUrl', repoContentsUrl);\n return;\n }\n\n await createGerritProject(integrationConfig.config, {\n description,\n owner: owner,\n projectName: repo,\n parent: workspace,\n defaultBranch,\n });\n const auth = {\n username: integrationConfig.config.username!,\n password: integrationConfig.config.password!,\n };\n const gitAuthorInfo = {\n name: gitName,\n email: gitEmail,\n };\n\n const signingKey =\n integrationConfig.config.commitSigningKey ??\n config.getOptionalString('scaffolder.defaultCommitSigningKey');\n if (signCommit && !signingKey) {\n throw new Error(\n 'Signing commits is enabled but no signing key is provided in the configuration',\n );\n }\n\n const commitResult = await initRepoAndPush({\n dir: getRepoSourceDirectory(ctx.workspacePath, sourcePath),\n remoteUrl,\n auth,\n defaultBranch,\n logger: ctx.logger,\n commitMessage: generateCommitMessage(config, gitCommitMessage),\n gitAuthorInfo,\n signingKey: signCommit ? signingKey : undefined,\n });\n\n ctx.output('remoteUrl', remoteUrl);\n ctx.output('commitHash', commitResult?.commitHash);\n ctx.output('repoContentsUrl', repoContentsUrl);\n },\n });\n}\n"],"names":["getGerritRequestOptions","crypto","createTemplateAction","examples","parseRepoUrl","InputError","initRepoAndPush","getRepoSourceDirectory"],"mappings":";;;;;;;;;;;;AAgCA,MAAM,mBAAA,GAAsB,OAC1B,MAAA,EACA,OAOkB,KAAA;AAClB,EAAA,MAAM,EAAE,WAAa,EAAA,MAAA,EAAQ,KAAO,EAAA,WAAA,EAAa,eAAkB,GAAA,OAAA;AAEnE,EAAA,MAAM,YAA4B,GAAA;AAAA,IAChC,MAAQ,EAAA,KAAA;AAAA,IACR,IAAA,EAAM,KAAK,SAAU,CAAA;AAAA,MACnB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,GAAI,CAAA,aAAA,EAAe,UAAU,CAAA;AAAA,QACzD,SAAA;AAAA,QACA,IAAA;AAAA,QACA,aAAA;AAAA,QACA,QAAQ,GAAI,CAAA,MAAA;AAAA,QACZ,aAAA,EAAe,qBAAsB,CAAA,MAAA,EAAQ,gBAAgB,CAAA;AAAA,QAC7D,aAAA;AAAA,QACA,UAAA,EAAY,aAAa,UAAa,GAAA,KAAA;AAAA,OACvC,CAAA;AAED,MAAI,GAAA,CAAA,MAAA,CAAO,aAAa,SAAS,CAAA;AACjC,MAAI,GAAA,CAAA,MAAA,CAAO,YAAc,EAAA,YAAA,EAAc,UAAU,CAAA;AACjD,MAAI,GAAA,CAAA,MAAA,CAAO,mBAAmB,eAAe,CAAA;AAAA;AAC/C,GACD,CAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"gerrit.cjs.js","sources":["../../src/actions/gerrit.ts"],"sourcesContent":["/*\n * Copyright 2022 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 crypto from 'crypto';\nimport { InputError } from '@backstage/errors';\nimport { Config } from '@backstage/config';\nimport {\n GerritIntegrationConfig,\n getGerritRequestOptions,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport {\n createTemplateAction,\n getRepoSourceDirectory,\n initRepoAndPush,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { examples } from './gerrit.examples';\n\nconst createGerritProject = async (\n config: GerritIntegrationConfig,\n options: {\n projectName: string;\n parent: string;\n owner?: string;\n description: string;\n defaultBranch: string;\n },\n): Promise<void> => {\n const { projectName, parent, owner, description, defaultBranch } = options;\n\n const fetchOptions: RequestInit = {\n method: 'PUT',\n body: JSON.stringify({\n parent,\n description,\n branches: [defaultBranch],\n owners: owner ? [owner] : [],\n create_empty_commit: false,\n }),\n headers: {\n ...getGerritRequestOptions(config).headers,\n 'Content-Type': 'application/json',\n },\n };\n const response: Response = await fetch(\n `${config.baseUrl}/a/projects/${encodeURIComponent(projectName)}`,\n fetchOptions,\n );\n if (response.status !== 201) {\n throw new Error(\n `Unable to create repository, ${response.status} ${\n response.statusText\n }, ${await response.text()}`,\n );\n }\n};\n\nconst generateCommitMessage = (\n config: Config,\n commitSubject?: string,\n): string => {\n const changeId = crypto.randomBytes(20).toString('hex');\n const msg = `${\n config.getOptionalString('scaffolder.defaultCommitMessage') || commitSubject\n }\\n\\nChange-Id: I${changeId}`;\n return msg;\n};\n\n/**\n * Creates a new action that initializes a git repository of the content in the workspace\n * and publishes it to a Gerrit instance.\n * @public\n */\nexport function createPublishGerritAction(options: {\n integrations: ScmIntegrationRegistry;\n config: Config;\n}) {\n const { integrations, config } = options;\n\n return createTemplateAction({\n id: 'publish:gerrit',\n supportsDryRun: true,\n description:\n 'Initializes a git repository of the content in the workspace, and publishes it to Gerrit.',\n examples,\n schema: {\n input: {\n repoUrl: z =>\n z.string({\n description: 'Repository Location',\n }),\n description: z =>\n z.string({\n description: 'Repository Description',\n }),\n defaultBranch: z =>\n z\n .string({\n description: `Sets the default branch on the repository. The default value is 'master'`,\n })\n .optional(),\n gitCommitMessage: z =>\n z\n .string({\n description: `Sets the commit message on the repository. The default value is 'initial commit'`,\n })\n .optional(),\n gitAuthorName: z =>\n z\n .string({\n description: `Sets the default author name for the commit. The default value is 'Scaffolder'`,\n })\n .optional(),\n gitAuthorEmail: z =>\n z\n .string({\n description: `Sets the default author email for the commit.`,\n })\n .optional(),\n sourcePath: z =>\n z\n .string({\n description: `Path within the workspace that will be used as the repository root. If omitted, the entire workspace will be published as the repository.`,\n })\n .optional(),\n signCommit: z =>\n z\n .boolean({\n description: 'Sign commit with configured PGP private key',\n })\n .optional(),\n },\n output: {\n remoteUrl: z =>\n z\n .string({\n description: 'A URL to the repository with the provider',\n })\n .optional(),\n repoContentsUrl: z =>\n z\n .string({\n description: 'A URL to the root of the repository',\n })\n .optional(),\n commitHash: z =>\n z\n .string({\n description: 'The git commit hash of the initial commit',\n })\n .optional(),\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n description,\n defaultBranch = 'master',\n gitAuthorName,\n gitAuthorEmail,\n gitCommitMessage = 'initial commit',\n sourcePath,\n signCommit,\n } = ctx.input;\n const { repo, host, owner, workspace } = parseRepoUrl(\n repoUrl,\n integrations,\n );\n\n const integrationConfig = integrations.gerrit.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 if (!workspace) {\n throw new InputError(\n `Invalid URL provider was included in the repo URL to create ${ctx.input.repoUrl}, missing workspace`,\n );\n }\n\n const repoContentsUrl = `${integrationConfig.config.gitilesBaseUrl}/${repo}/+/refs/heads/${defaultBranch}`;\n const remoteUrl = `${integrationConfig.config.cloneUrl}/a/${repo}`;\n const gitName = gitAuthorName\n ? gitAuthorName\n : config.getOptionalString('scaffolder.defaultAuthor.name');\n const gitEmail = gitAuthorEmail\n ? gitAuthorEmail\n : config.getOptionalString('scaffolder.defaultAuthor.email');\n const commitMessage = generateCommitMessage(config, gitCommitMessage);\n\n if (ctx.isDryRun) {\n ctx.logger.info(\n `Dry run arguments: ${{\n gitName,\n gitEmail,\n commitMessage,\n ...ctx.input,\n }}`,\n );\n ctx.output('remoteUrl', remoteUrl);\n ctx.output('commitHash', 'abcd-dry-run-1234');\n ctx.output('repoContentsUrl', repoContentsUrl);\n return;\n }\n\n await createGerritProject(integrationConfig.config, {\n description,\n owner: owner,\n projectName: repo,\n parent: workspace,\n defaultBranch,\n });\n const auth = {\n username: integrationConfig.config.username!,\n password: integrationConfig.config.password!,\n };\n const gitAuthorInfo = {\n name: gitName,\n email: gitEmail,\n };\n\n const signingKey =\n integrationConfig.config.commitSigningKey ??\n config.getOptionalString('scaffolder.defaultCommitSigningKey');\n if (signCommit && !signingKey) {\n throw new Error(\n 'Signing commits is enabled but no signing key is provided in the configuration',\n );\n }\n\n const commitResult = await initRepoAndPush({\n dir: getRepoSourceDirectory(ctx.workspacePath, sourcePath),\n remoteUrl,\n auth,\n defaultBranch,\n logger: ctx.logger,\n commitMessage: generateCommitMessage(config, gitCommitMessage),\n gitAuthorInfo,\n signingKey: signCommit ? signingKey : undefined,\n });\n\n ctx.output('remoteUrl', remoteUrl);\n ctx.output('commitHash', commitResult?.commitHash);\n ctx.output('repoContentsUrl', repoContentsUrl);\n },\n });\n}\n"],"names":["getGerritRequestOptions","crypto","createTemplateAction","examples","parseRepoUrl","InputError","initRepoAndPush","getRepoSourceDirectory"],"mappings":";;;;;;;;;;;;AAgCA,MAAM,mBAAA,GAAsB,OAC1B,MAAA,EACA,OAAA,KAOkB;AAClB,EAAA,MAAM,EAAE,WAAA,EAAa,MAAA,EAAQ,KAAA,EAAO,WAAA,EAAa,eAAc,GAAI,OAAA;AAEnE,EAAA,MAAM,YAAA,GAA4B;AAAA,IAChC,MAAA,EAAQ,KAAA;AAAA,IACR,IAAA,EAAM,KAAK,SAAA,CAAU;AAAA,MACnB,MAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAA,EAAU,CAAC,aAAa,CAAA;AAAA,MACxB,MAAA,EAAQ,KAAA,GAAQ,CAAC,KAAK,IAAI,EAAC;AAAA,MAC3B,mBAAA,EAAqB;AAAA,KACtB,CAAA;AAAA,IACD,OAAA,EAAS;AAAA,MACP,GAAGA,mCAAA,CAAwB,MAAM,CAAA,CAAE,OAAA;AAAA,MACnC,cAAA,EAAgB;AAAA;AAClB,GACF;AACA,EAAA,MAAM,WAAqB,MAAM,KAAA;AAAA,IAC/B,GAAG,MAAA,CAAO,OAAO,CAAA,YAAA,EAAe,kBAAA,CAAmB,WAAW,CAAC,CAAA,CAAA;AAAA,IAC/D;AAA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AAA,CAAO,mBAAmB,eAAe,CAAA;AAAA,IAC/C;AAAA,GACD,CAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gerrit.examples.cjs.js","sources":["../../src/actions/gerrit.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 */\n\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description:\n 'Initializes a Gerrit repository of contents in workspace and publish it to Gerrit with default configuration.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit',\n name: 'Publish to Gerrit',\n input: {\n repoUrl: 'gerrit.com?repo=repo&owner=owner',\n },\n },\n ],\n }),\n },\n {\n description: 'Initializes a Gerrit repository with a description.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit',\n name: 'Publish to Gerrit',\n input: {\n repoUrl: 'gerrit.com?repo=repo&owner=owner',\n description: 'Initialize a gerrit repository',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a Gerrit repository with a default Branch, if not set defaults to master',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit',\n name: 'Publish to Gerrit',\n input: {\n repoUrl: 'gerrit.com?repo=repo&owner=owner',\n defaultBranch: 'staging',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a Gerrit repository with an initial commit message, if not set defaults to initial commit',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit',\n name: 'Publish to Gerrit',\n input: {\n repoUrl: 'gerrit.com?repo=repo&owner=owner',\n gitCommitMessage: 'Initial Commit Message',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a Gerrit repository with a repo Author Name, if not set defaults to Scaffolder',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit',\n name: 'Publish to Gerrit',\n input: {\n repoUrl: 'gerrit.com?repo=repo&owner=owner',\n gitAuthorName: 'John Doe',\n },\n },\n ],\n }),\n },\n {\n description: 'Initializes a Gerrit repository with a repo Author Email',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit',\n name: 'Publish to Gerrit',\n input: {\n repoUrl: 'gerrit.com?repo=repo&owner=owner',\n gitAuthorEmail: 'johndoe@email.com',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Path within the workspace that will be used as the repository root. If omitted, the entire workspace will be published as the repository',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit',\n name: 'Publish to Gerrit',\n input: {\n repoUrl: 'gerrit.com?repo=repo&owner=owner',\n sourcePath: 'repository/',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a Gerrit repository with all properties being set',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit',\n name: 'Publish to Gerrit',\n input: {\n repoUrl: 'gerrit.com?repo=repo&owner=owner',\n description: 'Initialize a gerrit repository',\n defaultBranch: 'staging',\n gitCommitMessage: 'Initial Commit Message',\n gitAuthorName: 'John Doe',\n gitAuthorEmail: 'johndoe@email.com',\n sourcePath: 'repository/',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initialize a Gerrit Repository with Custom Default Branch and Commit Message',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit',\n name: 'Publish to Gerrit',\n input: {\n repoUrl: 'gerrit.com?repo=repo&owner=owner',\n defaultBranch: 'feature-branch',\n gitCommitMessage: 'Feature branch initialized',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,
|
|
1
|
+
{"version":3,"file":"gerrit.examples.cjs.js","sources":["../../src/actions/gerrit.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 */\n\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description:\n 'Initializes a Gerrit repository of contents in workspace and publish it to Gerrit with default configuration.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit',\n name: 'Publish to Gerrit',\n input: {\n repoUrl: 'gerrit.com?repo=repo&owner=owner',\n },\n },\n ],\n }),\n },\n {\n description: 'Initializes a Gerrit repository with a description.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit',\n name: 'Publish to Gerrit',\n input: {\n repoUrl: 'gerrit.com?repo=repo&owner=owner',\n description: 'Initialize a gerrit repository',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a Gerrit repository with a default Branch, if not set defaults to master',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit',\n name: 'Publish to Gerrit',\n input: {\n repoUrl: 'gerrit.com?repo=repo&owner=owner',\n defaultBranch: 'staging',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a Gerrit repository with an initial commit message, if not set defaults to initial commit',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit',\n name: 'Publish to Gerrit',\n input: {\n repoUrl: 'gerrit.com?repo=repo&owner=owner',\n gitCommitMessage: 'Initial Commit Message',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a Gerrit repository with a repo Author Name, if not set defaults to Scaffolder',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit',\n name: 'Publish to Gerrit',\n input: {\n repoUrl: 'gerrit.com?repo=repo&owner=owner',\n gitAuthorName: 'John Doe',\n },\n },\n ],\n }),\n },\n {\n description: 'Initializes a Gerrit repository with a repo Author Email',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit',\n name: 'Publish to Gerrit',\n input: {\n repoUrl: 'gerrit.com?repo=repo&owner=owner',\n gitAuthorEmail: 'johndoe@email.com',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Path within the workspace that will be used as the repository root. If omitted, the entire workspace will be published as the repository',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit',\n name: 'Publish to Gerrit',\n input: {\n repoUrl: 'gerrit.com?repo=repo&owner=owner',\n sourcePath: 'repository/',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a Gerrit repository with all properties being set',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit',\n name: 'Publish to Gerrit',\n input: {\n repoUrl: 'gerrit.com?repo=repo&owner=owner',\n description: 'Initialize a gerrit repository',\n defaultBranch: 'staging',\n gitCommitMessage: 'Initial Commit Message',\n gitAuthorName: 'John Doe',\n gitAuthorEmail: 'johndoe@email.com',\n sourcePath: 'repository/',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initialize a Gerrit Repository with Custom Default Branch and Commit Message',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit',\n name: 'Publish to Gerrit',\n input: {\n repoUrl: 'gerrit.com?repo=repo&owner=owner',\n defaultBranch: 'feature-branch',\n gitCommitMessage: 'Feature branch initialized',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO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AA,EAAO;AAAA,YACL,OAAA,EAAS,kCAAA;AAAA,YACT,WAAA,EAAa,gCAAA;AAAA,YACb,aAAA,EAAe,SAAA;AAAA,YACf,gBAAA,EAAkB,wBAAA;AAAA,YAClB,aAAA,EAAe,UAAA;AAAA,YACf,cAAA,EAAgB,mBAAA;AAAA,YAChB,UAAA,EAAY;AAAA;AACd;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EACE,8EAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,EAAA,EAAI,SAAA;AAAA,UACJ,MAAA,EAAQ,gBAAA;AAAA,UACR,IAAA,EAAM,mBAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,kCAAA;AAAA,YACT,aAAA,EAAe,gBAAA;AAAA,YACf,gBAAA,EAAkB;AAAA;AACpB;AACF;AACF,KACD;AAAA;AAEL;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gerritReview.cjs.js","sources":["../../src/actions/gerritReview.ts"],"sourcesContent":["/*\n * Copyright 2022 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 crypto from 'crypto';\nimport { InputError } from '@backstage/errors';\nimport { Config } from '@backstage/config';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport {\n commitAndPushRepo,\n createTemplateAction,\n getRepoSourceDirectory,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { examples } from './gerritReview.examples';\n\nconst generateGerritChangeId = (): string => {\n const changeId = crypto.randomBytes(20).toString('hex');\n return `I${changeId}`;\n};\n\n/**\n * Creates a new action that creates a Gerrit review\n * @public\n */\nexport function createPublishGerritReviewAction(options: {\n integrations: ScmIntegrationRegistry;\n config: Config;\n}) {\n const { integrations, config } = options;\n\n return createTemplateAction({\n id: 'publish:gerrit:review',\n description: 'Creates a new Gerrit review.',\n examples,\n schema: {\n input: {\n repoUrl: z =>\n z.string({\n description: 'Repository Location',\n }),\n branch: z =>\n z\n .string({\n description:\n 'Branch of the repository the review will be created on',\n })\n .optional(),\n sourcePath: z =>\n z\n .string({\n description:\n 'Subdirectory of working directory containing the repository',\n })\n .optional(),\n gitCommitMessage: z =>\n z\n .string({\n description: `Sets the commit message on the repository.`,\n })\n .optional(),\n gitAuthorName: z =>\n z\n .string({\n description: `Sets the default author name for the commit. The default value is 'Scaffolder'`,\n })\n .optional(),\n gitAuthorEmail: z =>\n z\n .string({\n description: `Sets the default author email for the commit.`,\n })\n .optional(),\n signCommit: z =>\n z\n .boolean({\n description: 'Sign commit with configured PGP private key',\n })\n .optional(),\n },\n output: {\n reviewUrl: z =>\n z\n .string({\n description: 'A URL to the review',\n })\n .optional(),\n repoContentsUrl: z =>\n z\n .string({\n description: 'A URL to the root of the repository',\n })\n .optional(),\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n branch = 'master',\n sourcePath,\n gitAuthorName,\n gitAuthorEmail,\n gitCommitMessage,\n signCommit,\n } = ctx.input;\n const { host, repo } = parseRepoUrl(repoUrl, integrations);\n\n if (!gitCommitMessage) {\n throw new InputError(`Missing gitCommitMessage input`);\n }\n\n const integrationConfig = integrations.gerrit.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 auth = {\n username: integrationConfig.config.username!,\n password: integrationConfig.config.password!,\n };\n const gitAuthorInfo = {\n name: gitAuthorName\n ? gitAuthorName\n : config.getOptionalString('scaffolder.defaultAuthor.name'),\n email: gitAuthorEmail\n ? gitAuthorEmail\n : config.getOptionalString('scaffolder.defaultAuthor.email'),\n };\n const signingKey =\n integrationConfig.config.commitSigningKey ??\n config.getOptionalString('scaffolder.defaultCommitSigningKey');\n if (signCommit && !signingKey) {\n throw new Error(\n 'Signing commits is enabled but no signing key is provided in the configuration',\n );\n }\n const changeId = generateGerritChangeId();\n const commitMessage = `${gitCommitMessage}\\n\\nChange-Id: ${changeId}`;\n\n await commitAndPushRepo({\n dir: getRepoSourceDirectory(ctx.workspacePath, sourcePath),\n auth,\n logger: ctx.logger,\n commitMessage,\n gitAuthorInfo,\n branch,\n remoteRef: `refs/for/${branch}`,\n signingKey: signCommit ? signingKey : undefined,\n });\n\n const repoContentsUrl = `${integrationConfig.config.gitilesBaseUrl}/${repo}/+/refs/heads/${branch}`;\n const reviewUrl = `${integrationConfig.config.baseUrl}/#/q/${changeId}`;\n ctx.logger?.info(`Review available on ${reviewUrl}`);\n ctx.output('repoContentsUrl', repoContentsUrl);\n ctx.output('reviewUrl', reviewUrl);\n },\n });\n}\n"],"names":["crypto","createTemplateAction","examples","parseRepoUrl","InputError","commitAndPushRepo","getRepoSourceDirectory"],"mappings":";;;;;;;;;;;AA4BA,MAAM,yBAAyB,MAAc;AAC3C,EAAA,MAAM,WAAWA,
|
|
1
|
+
{"version":3,"file":"gerritReview.cjs.js","sources":["../../src/actions/gerritReview.ts"],"sourcesContent":["/*\n * Copyright 2022 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 crypto from 'crypto';\nimport { InputError } from '@backstage/errors';\nimport { Config } from '@backstage/config';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport {\n commitAndPushRepo,\n createTemplateAction,\n getRepoSourceDirectory,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { examples } from './gerritReview.examples';\n\nconst generateGerritChangeId = (): string => {\n const changeId = crypto.randomBytes(20).toString('hex');\n return `I${changeId}`;\n};\n\n/**\n * Creates a new action that creates a Gerrit review\n * @public\n */\nexport function createPublishGerritReviewAction(options: {\n integrations: ScmIntegrationRegistry;\n config: Config;\n}) {\n const { integrations, config } = options;\n\n return createTemplateAction({\n id: 'publish:gerrit:review',\n description: 'Creates a new Gerrit review.',\n examples,\n schema: {\n input: {\n repoUrl: z =>\n z.string({\n description: 'Repository Location',\n }),\n branch: z =>\n z\n .string({\n description:\n 'Branch of the repository the review will be created on',\n })\n .optional(),\n sourcePath: z =>\n z\n .string({\n description:\n 'Subdirectory of working directory containing the repository',\n })\n .optional(),\n gitCommitMessage: z =>\n z\n .string({\n description: `Sets the commit message on the repository.`,\n })\n .optional(),\n gitAuthorName: z =>\n z\n .string({\n description: `Sets the default author name for the commit. The default value is 'Scaffolder'`,\n })\n .optional(),\n gitAuthorEmail: z =>\n z\n .string({\n description: `Sets the default author email for the commit.`,\n })\n .optional(),\n signCommit: z =>\n z\n .boolean({\n description: 'Sign commit with configured PGP private key',\n })\n .optional(),\n },\n output: {\n reviewUrl: z =>\n z\n .string({\n description: 'A URL to the review',\n })\n .optional(),\n repoContentsUrl: z =>\n z\n .string({\n description: 'A URL to the root of the repository',\n })\n .optional(),\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n branch = 'master',\n sourcePath,\n gitAuthorName,\n gitAuthorEmail,\n gitCommitMessage,\n signCommit,\n } = ctx.input;\n const { host, repo } = parseRepoUrl(repoUrl, integrations);\n\n if (!gitCommitMessage) {\n throw new InputError(`Missing gitCommitMessage input`);\n }\n\n const integrationConfig = integrations.gerrit.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 auth = {\n username: integrationConfig.config.username!,\n password: integrationConfig.config.password!,\n };\n const gitAuthorInfo = {\n name: gitAuthorName\n ? gitAuthorName\n : config.getOptionalString('scaffolder.defaultAuthor.name'),\n email: gitAuthorEmail\n ? gitAuthorEmail\n : config.getOptionalString('scaffolder.defaultAuthor.email'),\n };\n const signingKey =\n integrationConfig.config.commitSigningKey ??\n config.getOptionalString('scaffolder.defaultCommitSigningKey');\n if (signCommit && !signingKey) {\n throw new Error(\n 'Signing commits is enabled but no signing key is provided in the configuration',\n );\n }\n const changeId = generateGerritChangeId();\n const commitMessage = `${gitCommitMessage}\\n\\nChange-Id: ${changeId}`;\n\n await commitAndPushRepo({\n dir: getRepoSourceDirectory(ctx.workspacePath, sourcePath),\n auth,\n logger: ctx.logger,\n commitMessage,\n gitAuthorInfo,\n branch,\n remoteRef: `refs/for/${branch}`,\n signingKey: signCommit ? signingKey : undefined,\n });\n\n const repoContentsUrl = `${integrationConfig.config.gitilesBaseUrl}/${repo}/+/refs/heads/${branch}`;\n const reviewUrl = `${integrationConfig.config.baseUrl}/#/q/${changeId}`;\n ctx.logger?.info(`Review available on ${reviewUrl}`);\n ctx.output('repoContentsUrl', repoContentsUrl);\n ctx.output('reviewUrl', reviewUrl);\n },\n });\n}\n"],"names":["crypto","createTemplateAction","examples","parseRepoUrl","InputError","commitAndPushRepo","getRepoSourceDirectory"],"mappings":";;;;;;;;;;;AA4BA,MAAM,yBAAyB,MAAc;AAC3C,EAAA,MAAM,WAAWA,uBAAA,CAAO,WAAA,CAAY,EAAE,CAAA,CAAE,SAAS,KAAK,CAAA;AACtD,EAAA,OAAO,IAAI,QAAQ,CAAA,CAAA;AACrB,CAAA;AAMO,SAAS,gCAAgC,OAAA,EAG7C;AACD,EAAA,MAAM,EAAE,YAAA,EAAc,MAAA,EAAO,GAAI,OAAA;AAEjC,EAAA,OAAOC,yCAAA,CAAqB;AAAA,IAC1B,EAAA,EAAI,uBAAA;AAAA,IACJ,WAAA,EAAa,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MAAA,MAAMC,sCAAA,CAAkB;AAAA,QACtB,GAAA,EAAKC,2CAAA,CAAuB,GAAA,CAAI,aAAA,EAAe,UAAU,CAAA;AAAA,QACzD,IAAA;AAAA,QACA,QAAQ,GAAA,CAAI,MAAA;AAAA,QACZ,aAAA;AAAA,QACA,aAAA;AAAA,QACA,MAAA;AAAA,QACA,SAAA,EAAW,YAAY,MAAM,CAAA,CAAA;AAAA,QAC7B,UAAA,EAAY,aAAa,UAAA,GAAa;AAAA,OACvC,CAAA;AAED,MAAA,MAAM,eAAA,GAAkB,GAAG,iBAAA,CAAkB,MAAA,CAAO,cAAc,CAAA,CAAA,EAAI,IAAI,iBAAiB,MAAM,CAAA,CAAA;AACjG,MAAA,MAAM,YAAY,CAAA,EAAG,iBAAA,CAAkB,MAAA,CAAO,OAAO,QAAQ,QAAQ,CAAA,CAAA;AACrE,MAAA,GAAA,CAAI,MAAA,EAAQ,IAAA,CAAK,CAAA,oBAAA,EAAuB,SAAS,CAAA,CAAE,CAAA;AACnD,MAAA,GAAA,CAAI,MAAA,CAAO,mBAAmB,eAAe,CAAA;AAC7C,MAAA,GAAA,CAAI,MAAA,CAAO,aAAa,SAAS,CAAA;AAAA,IACnC;AAAA,GACD,CAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gerritReview.examples.cjs.js","sources":["../../src/actions/gerritReview.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 */\n\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Creates a new Gerrit review with minimal options',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit:review',\n name: 'Publish new gerrit review',\n input: {\n repoUrl: 'gerrithost.org?repo=repo&owner=owner',\n gitCommitMessage: 'Initial Commit Message',\n },\n },\n ],\n }),\n },\n {\n description: 'Creates a new Gerrit review with gitAuthorName',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit:review',\n name: 'Publish new gerrit review',\n input: {\n repoUrl: 'gerrithost.org?repo=repo&owner=owner',\n gitCommitMessage: 'Initial Commit Message',\n gitAuthorName: 'Test User',\n },\n },\n ],\n }),\n },\n {\n description: 'Creates a new Gerrit review with gitAuthorEmail',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit:review',\n name: 'Publish new gerrit review',\n input: {\n repoUrl: 'gerrithost.org?repo=repo&owner=owner',\n gitCommitMessage: 'Initial Commit Message',\n gitAuthorName: 'Test User',\n gitAuthorEmail: 'test.user@example.com',\n },\n },\n ],\n }),\n },\n {\n description: 'Creates a new Gerrit review with custom branch',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit:review',\n name: 'Publish new gerrit review',\n input: {\n repoUrl: 'gerrithost.org?repo=repo&owner=owner',\n gitCommitMessage: 'Initial Commit Message',\n branch: 'develop',\n },\n },\n ],\n }),\n },\n {\n description: 'Creates a new Gerrit review with custom sourcePath',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit:review',\n name: 'Publish new gerrit review',\n input: {\n repoUrl: 'gerrithost.org?repo=repo&owner=owner',\n gitCommitMessage: 'Initial Commit Message',\n sourcePath: './src',\n },\n },\n ],\n }),\n },\n {\n description: 'Creates a new Gerrit review with all properties',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit:review',\n name: 'Publish new gerrit review',\n input: {\n repoUrl: 'gerrithost.org?repo=repo&owner=owner',\n gitCommitMessage: 'Initial Commit Message',\n gitAuthorName: 'Test User',\n gitAuthorEmail: 'test.user@example.com',\n branch: 'develop',\n sourcePath: './src',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,
|
|
1
|
+
{"version":3,"file":"gerritReview.examples.cjs.js","sources":["../../src/actions/gerritReview.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 */\n\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Creates a new Gerrit review with minimal options',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit:review',\n name: 'Publish new gerrit review',\n input: {\n repoUrl: 'gerrithost.org?repo=repo&owner=owner',\n gitCommitMessage: 'Initial Commit Message',\n },\n },\n ],\n }),\n },\n {\n description: 'Creates a new Gerrit review with gitAuthorName',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit:review',\n name: 'Publish new gerrit review',\n input: {\n repoUrl: 'gerrithost.org?repo=repo&owner=owner',\n gitCommitMessage: 'Initial Commit Message',\n gitAuthorName: 'Test User',\n },\n },\n ],\n }),\n },\n {\n description: 'Creates a new Gerrit review with gitAuthorEmail',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit:review',\n name: 'Publish new gerrit review',\n input: {\n repoUrl: 'gerrithost.org?repo=repo&owner=owner',\n gitCommitMessage: 'Initial Commit Message',\n gitAuthorName: 'Test User',\n gitAuthorEmail: 'test.user@example.com',\n },\n },\n ],\n }),\n },\n {\n description: 'Creates a new Gerrit review with custom branch',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit:review',\n name: 'Publish new gerrit review',\n input: {\n repoUrl: 'gerrithost.org?repo=repo&owner=owner',\n gitCommitMessage: 'Initial Commit Message',\n branch: 'develop',\n },\n },\n ],\n }),\n },\n {\n description: 'Creates a new Gerrit review with custom sourcePath',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit:review',\n name: 'Publish new gerrit review',\n input: {\n repoUrl: 'gerrithost.org?repo=repo&owner=owner',\n gitCommitMessage: 'Initial Commit Message',\n sourcePath: './src',\n },\n },\n ],\n }),\n },\n {\n description: 'Creates a new Gerrit review with all properties',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gerrit:review',\n name: 'Publish new gerrit review',\n input: {\n repoUrl: 'gerrithost.org?repo=repo&owner=owner',\n gitCommitMessage: 'Initial Commit Message',\n gitAuthorName: 'Test User',\n gitAuthorEmail: 'test.user@example.com',\n branch: 'develop',\n sourcePath: './src',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAAA,GAA8B;AAAA,EACzC;AAAA,IACE,WAAA,EAAa,kDAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,EAAA,EAAI,SAAA;AAAA,UACJ,MAAA,EAAQ,uBAAA;AAAA,UACR,IAAA,EAAM,2BAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,sCAAA;AAAA,YACT,gBAAA,EAAkB;AAAA;AACpB;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EAAa,gDAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,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A,EAAS,sCAAA;AAAA,YACT,gBAAA,EAAkB,wBAAA;AAAA,YAClB,UAAA,EAAY;AAAA;AACd;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EAAa,iDAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,EAAA,EAAI,SAAA;AAAA,UACJ,MAAA,EAAQ,uBAAA;AAAA,UACR,IAAA,EAAM,2BAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,sCAAA;AAAA,YACT,gBAAA,EAAkB,wBAAA;AAAA,YAClB,aAAA,EAAe,WAAA;AAAA,YACf,cAAA,EAAgB,uBAAA;AAAA,YAChB,MAAA,EAAQ,SAAA;AAAA,YACR,UAAA,EAAY;AAAA;AACd;AACF;AACF,KACD;AAAA;AAEL;;;;"}
|
package/dist/module.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.cjs.js","sources":["../src/module.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';\nimport {\n createPublishGerritAction,\n createPublishGerritReviewAction,\n} from './actions';\nimport { ScmIntegrations } from '@backstage/integration';\n\n/**\n * @public\n * The Gerrit Module for the Scaffolder Backend\n */\nexport const gerritModule = createBackendModule({\n pluginId: 'scaffolder',\n moduleId: 'geritt',\n register({ registerInit }) {\n registerInit({\n deps: {\n scaffolder: scaffolderActionsExtensionPoint,\n config: coreServices.rootConfig,\n },\n async init({ scaffolder, config }) {\n const integrations = ScmIntegrations.fromConfig(config);\n scaffolder.addActions(\n createPublishGerritAction({ integrations, config }),\n createPublishGerritReviewAction({ integrations, config }),\n );\n },\n });\n },\n});\n"],"names":["createBackendModule","scaffolderActionsExtensionPoint","coreServices","ScmIntegrations","createPublishGerritAction","createPublishGerritReviewAction"],"mappings":";;;;;;;;AA8BO,MAAM,eAAeA,
|
|
1
|
+
{"version":3,"file":"module.cjs.js","sources":["../src/module.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';\nimport {\n createPublishGerritAction,\n createPublishGerritReviewAction,\n} from './actions';\nimport { ScmIntegrations } from '@backstage/integration';\n\n/**\n * @public\n * The Gerrit Module for the Scaffolder Backend\n */\nexport const gerritModule = createBackendModule({\n pluginId: 'scaffolder',\n moduleId: 'geritt',\n register({ registerInit }) {\n registerInit({\n deps: {\n scaffolder: scaffolderActionsExtensionPoint,\n config: coreServices.rootConfig,\n },\n async init({ scaffolder, config }) {\n const integrations = ScmIntegrations.fromConfig(config);\n scaffolder.addActions(\n createPublishGerritAction({ integrations, config }),\n createPublishGerritReviewAction({ integrations, config }),\n );\n },\n });\n },\n});\n"],"names":["createBackendModule","scaffolderActionsExtensionPoint","coreServices","ScmIntegrations","createPublishGerritAction","createPublishGerritReviewAction"],"mappings":";;;;;;;;AA8BO,MAAM,eAAeA,oCAAA,CAAoB;AAAA,EAC9C,QAAA,EAAU,YAAA;AAAA,EACV,QAAA,EAAU,QAAA;AAAA,EACV,QAAA,CAAS,EAAE,YAAA,EAAa,EAAG;AACzB,IAAA,YAAA,CAAa;AAAA,MACX,IAAA,EAAM;AAAA,QACJ,UAAA,EAAYC,qCAAA;AAAA,QACZ,QAAQC,6BAAA,CAAa;AAAA,OACvB;AAAA,MACA,MAAM,IAAA,CAAK,EAAE,UAAA,EAAY,QAAO,EAAG;AACjC,QAAA,MAAM,YAAA,GAAeC,2BAAA,CAAgB,UAAA,CAAW,MAAM,CAAA;AACtD,QAAA,UAAA,CAAW,UAAA;AAAA,UACTC,gCAAA,CAA0B,EAAE,YAAA,EAAc,MAAA,EAAQ,CAAA;AAAA,UAClDC,4CAAA,CAAgC,EAAE,YAAA,EAAc,MAAA,EAAQ;AAAA,SAC1D;AAAA,MACF;AAAA,KACD,CAAA;AAAA,EACH;AACF,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-scaffolder-backend-module-gerrit",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13-next.0",
|
|
4
4
|
"description": "The gerrit module for @backstage/plugin-scaffolder-backend",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin-module",
|
|
@@ -50,17 +50,17 @@
|
|
|
50
50
|
"test": "backstage-cli package test"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@backstage/backend-plugin-api": "1.4.
|
|
53
|
+
"@backstage/backend-plugin-api": "1.4.3-next.0",
|
|
54
54
|
"@backstage/config": "1.3.3",
|
|
55
55
|
"@backstage/errors": "1.2.7",
|
|
56
|
-
"@backstage/integration": "1.
|
|
57
|
-
"@backstage/plugin-scaffolder-node": "0.11.
|
|
56
|
+
"@backstage/integration": "1.18.0-next.0",
|
|
57
|
+
"@backstage/plugin-scaffolder-node": "0.11.1-next.0",
|
|
58
58
|
"yaml": "^2.0.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@backstage/backend-test-utils": "1.
|
|
62
|
-
"@backstage/cli": "0.
|
|
63
|
-
"@backstage/plugin-scaffolder-node-test-utils": "0.3.
|
|
61
|
+
"@backstage/backend-test-utils": "1.9.0-next.1",
|
|
62
|
+
"@backstage/cli": "0.34.2-next.1",
|
|
63
|
+
"@backstage/plugin-scaffolder-node-test-utils": "0.3.3-next.1",
|
|
64
64
|
"msw": "^1.0.0"
|
|
65
65
|
}
|
|
66
66
|
}
|