@backstage/plugin-scaffolder-backend-module-bitbucket-cloud 0.2.2-next.0 → 0.2.2-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/dist/actions/bitbucketCloud.cjs.js.map +1 -1
- package/dist/actions/bitbucketCloud.examples.cjs.js.map +1 -1
- package/dist/actions/bitbucketCloudPipelinesRun.cjs.js.map +1 -1
- package/dist/actions/bitbucketCloudPipelinesRun.examples.cjs.js.map +1 -1
- package/dist/actions/bitbucketCloudPullRequest.cjs.js +0 -6
- package/dist/actions/bitbucketCloudPullRequest.cjs.js.map +1 -1
- package/dist/actions/bitbucketCloudPullRequest.examples.cjs.js.map +1 -1
- package/dist/actions/helpers.cjs.js.map +1 -1
- package/dist/actions/inputProperties.cjs.js.map +1 -1
- package/dist/autocomplete/autocomplete.cjs.js.map +1 -1
- package/dist/module.cjs.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-backend-module-bitbucket-cloud
|
|
2
2
|
|
|
3
|
+
## 0.2.2-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/backend-plugin-api@1.0.2-next.2
|
|
9
|
+
- @backstage/config@1.2.0
|
|
10
|
+
- @backstage/errors@1.2.4
|
|
11
|
+
- @backstage/integration@1.15.1
|
|
12
|
+
- @backstage/plugin-bitbucket-cloud-common@0.2.24
|
|
13
|
+
- @backstage/plugin-scaffolder-node@0.5.1-next.2
|
|
14
|
+
|
|
15
|
+
## 0.2.2-next.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 9cf827c: Fix double branch creation in `public:bitbucket{Cloud,Server}:pull-request`
|
|
20
|
+
This resulted in the following error when using the actions:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
AlreadyExistsError: Failed to create branch at create-test because it already exists.
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The issue was original introduced in d103a48fa306d745599dc0c793668c9e6a479d32
|
|
27
|
+
|
|
28
|
+
- Updated dependencies
|
|
29
|
+
- @backstage/backend-plugin-api@1.0.2-next.1
|
|
30
|
+
- @backstage/config@1.2.0
|
|
31
|
+
- @backstage/errors@1.2.4
|
|
32
|
+
- @backstage/integration@1.15.1
|
|
33
|
+
- @backstage/plugin-bitbucket-cloud-common@0.2.24
|
|
34
|
+
- @backstage/plugin-scaffolder-node@0.5.1-next.1
|
|
35
|
+
|
|
3
36
|
## 0.2.2-next.0
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitbucketCloud.cjs.js","sources":["../../src/actions/bitbucketCloud.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 { InputError } from '@backstage/errors';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport {\n createTemplateAction,\n initRepoAndPush,\n getRepoSourceDirectory,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport fetch, { Response, RequestInit } from 'node-fetch';\n\nimport { Config } from '@backstage/config';\nimport { getAuthorizationHeader } from './helpers';\nimport { examples } from './bitbucketCloud.examples';\n\nconst createRepository = async (opts: {\n workspace: string;\n project: string;\n repo: string;\n description?: string;\n repoVisibility: 'private' | 'public';\n mainBranch: string;\n authorization: string;\n apiBaseUrl: string;\n}) => {\n const {\n workspace,\n project,\n repo,\n description,\n repoVisibility,\n mainBranch,\n authorization,\n apiBaseUrl,\n } = opts;\n\n const options: RequestInit = {\n method: 'POST',\n body: JSON.stringify({\n scm: 'git',\n description: description,\n is_private: repoVisibility === 'private',\n project: { key: project },\n }),\n headers: {\n Authorization: authorization,\n 'Content-Type': 'application/json',\n },\n };\n\n let response: Response;\n try {\n response = await fetch(\n `${apiBaseUrl}/repositories/${workspace}/${repo}`,\n options,\n );\n } catch (e) {\n throw new Error(`Unable to create repository, ${e}`);\n }\n\n if (response.status !== 200) {\n throw new Error(\n `Unable to create repository, ${response.status} ${\n response.statusText\n }, ${await response.text()}`,\n );\n }\n\n const r = await response.json();\n let remoteUrl = '';\n for (const link of r.links.clone) {\n if (link.name === 'https') {\n remoteUrl = link.href;\n }\n }\n\n // \"mainbranch.name\" cannot be set neither at create nor update of the repo\n // the first pushed branch will be set as \"main branch\" then\n const repoContentsUrl = `${r.links.html.href}/src/${mainBranch}`;\n return { remoteUrl, repoContentsUrl };\n};\n\n/**\n * Creates a new action that initializes a git repository of the content in the workspace\n * and publishes it to Bitbucket Cloud.\n * @public\n */\nexport function createPublishBitbucketCloudAction(options: {\n integrations: ScmIntegrationRegistry;\n config: Config;\n}) {\n const { integrations, config } = options;\n\n return createTemplateAction<{\n repoUrl: string;\n description?: string;\n defaultBranch?: string;\n repoVisibility?: 'private' | 'public';\n gitCommitMessage?: string;\n sourcePath?: string;\n token?: string;\n }>({\n id: 'publish:bitbucketCloud',\n examples,\n description:\n 'Initializes a git repository of the content in the workspace, and publishes it to Bitbucket Cloud.',\n schema: {\n input: {\n type: 'object',\n required: ['repoUrl'],\n properties: {\n repoUrl: {\n title: 'Repository Location',\n type: 'string',\n },\n description: {\n title: 'Repository Description',\n type: 'string',\n },\n repoVisibility: {\n title: 'Repository Visibility',\n type: 'string',\n enum: ['private', 'public'],\n },\n defaultBranch: {\n title: 'Default Branch',\n type: 'string',\n description: `Sets the default branch on the repository. The default value is 'master'`,\n },\n gitCommitMessage: {\n title: 'Git Commit Message',\n type: 'string',\n description: `Sets the commit message on the repository. The default value is 'initial commit'`,\n },\n sourcePath: {\n title: 'Source Path',\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 type: 'string',\n },\n token: {\n title: 'Authentication Token',\n type: 'string',\n description:\n 'The token to use for authorization to BitBucket Cloud',\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n remoteUrl: {\n title: 'A URL to the repository with the provider',\n type: 'string',\n },\n repoContentsUrl: {\n title: 'A URL to the root of the repository',\n type: 'string',\n },\n commitHash: {\n title: 'The git commit hash of the initial commit',\n type: 'string',\n },\n },\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n description,\n defaultBranch = 'master',\n gitCommitMessage,\n repoVisibility = 'private',\n } = ctx.input;\n\n const { workspace, project, repo, host } = parseRepoUrl(\n repoUrl,\n integrations,\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 if (!project) {\n throw new InputError(\n `Invalid URL provider was included in the repo URL to create ${ctx.input.repoUrl}, missing project`,\n );\n }\n\n const integrationConfig = integrations.bitbucketCloud.byHost(host);\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 authorization = getAuthorizationHeader(\n ctx.input.token ? { token: ctx.input.token } : integrationConfig.config,\n );\n\n const apiBaseUrl = integrationConfig.config.apiBaseUrl;\n\n const { remoteUrl, repoContentsUrl } = await createRepository({\n authorization,\n workspace: workspace || '',\n project,\n repo,\n repoVisibility,\n mainBranch: defaultBranch,\n description,\n apiBaseUrl,\n });\n\n const gitAuthorInfo = {\n name: config.getOptionalString('scaffolder.defaultAuthor.name'),\n email: config.getOptionalString('scaffolder.defaultAuthor.email'),\n };\n\n let auth;\n\n if (ctx.input.token) {\n auth = {\n username: 'x-token-auth',\n password: ctx.input.token,\n };\n } else {\n if (\n !integrationConfig.config.username ||\n !integrationConfig.config.appPassword\n ) {\n throw new Error(\n 'Credentials for Bitbucket Cloud integration required for this action.',\n );\n }\n\n auth = {\n username: integrationConfig.config.username,\n password: integrationConfig.config.appPassword,\n };\n }\n\n const commitResult = await initRepoAndPush({\n dir: getRepoSourceDirectory(ctx.workspacePath, ctx.input.sourcePath),\n remoteUrl,\n auth,\n defaultBranch,\n logger: ctx.logger,\n commitMessage:\n gitCommitMessage ||\n config.getOptionalString('scaffolder.defaultCommitMessage'),\n gitAuthorInfo,\n });\n\n ctx.output('commitHash', commitResult?.commitHash);\n ctx.output('remoteUrl', remoteUrl);\n ctx.output('repoContentsUrl', repoContentsUrl);\n },\n });\n}\n"],"names":["fetch","createTemplateAction","examples","parseRepoUrl","InputError","getAuthorizationHeader","initRepoAndPush","getRepoSourceDirectory"],"mappings":";;;;;;;;;;;;AA8BA,MAAM,gBAAA,GAAmB,OAAO,IAS1B,KAAA;AACJ,EAAM,MAAA;AAAA,IACJ,SAAA;AAAA,IACA,OAAA;AAAA,IACA,IAAA;AAAA,IACA,WAAA;AAAA,IACA,cAAA;AAAA,IACA,UAAA;AAAA,IACA,aAAA;AAAA,IACA,UAAA;AAAA,GACE,GAAA,IAAA,CAAA;AAEJ,EAAA,MAAM,OAAuB,GAAA;AAAA,IAC3B,MAAQ,EAAA,MAAA;AAAA,IACR,IAAA,EAAM,KAAK,SAAU,CAAA;AAAA,MACnB,GAAK,EAAA,KAAA;AAAA,MACL,WAAA;AAAA,MACA,YAAY,cAAmB,KAAA,SAAA;AAAA,MAC/B,OAAA,EAAS,EAAE,GAAA,EAAK,OAAQ,EAAA;AAAA,KACzB,CAAA;AAAA,IACD,OAAS,EAAA;AAAA,MACP,aAAe,EAAA,aAAA;AAAA,MACf,cAAgB,EAAA,kBAAA;AAAA,KAClB;AAAA,GACF,CAAA;AAEA,EAAI,IAAA,QAAA,CAAA;AACJ,EAAI,IAAA;AACF,IAAA,QAAA,GAAW,MAAMA,sBAAA;AAAA,M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AI,CAAA,MAAA;AAAA,QACZ,aACE,EAAA,gBAAA,IACA,MAAO,CAAA,iBAAA,CAAkB,iCAAiC,CAAA;AAAA,QAC5D,aAAA;AAAA,OACD,CAAA,CAAA;AAED,MAAI,GAAA,CAAA,MAAA,CAAO,YAAc,EAAA,YAAA,EAAc,UAAU,CAAA,CAAA;AACjD,MAAI,GAAA,CAAA,MAAA,CAAO,aAAa,SAAS,CAAA,CAAA;AACjC,MAAI,GAAA,CAAA,MAAA,CAAO,mBAAmB,eAAe,CAAA,CAAA;AAAA,KAC/C;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"bitbucketCloud.cjs.js","sources":["../../src/actions/bitbucketCloud.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 { InputError } from '@backstage/errors';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport {\n createTemplateAction,\n initRepoAndPush,\n getRepoSourceDirectory,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport fetch, { Response, RequestInit } from 'node-fetch';\n\nimport { Config } from '@backstage/config';\nimport { getAuthorizationHeader } from './helpers';\nimport { examples } from './bitbucketCloud.examples';\n\nconst createRepository = async (opts: {\n workspace: string;\n project: string;\n repo: string;\n description?: string;\n repoVisibility: 'private' | 'public';\n mainBranch: string;\n authorization: string;\n apiBaseUrl: string;\n}) => {\n const {\n workspace,\n project,\n repo,\n description,\n repoVisibility,\n mainBranch,\n authorization,\n apiBaseUrl,\n } = opts;\n\n const options: RequestInit = {\n method: 'POST',\n body: JSON.stringify({\n scm: 'git',\n description: description,\n is_private: repoVisibility === 'private',\n project: { key: project },\n }),\n headers: {\n Authorization: authorization,\n 'Content-Type': 'application/json',\n },\n };\n\n let response: Response;\n try {\n response = await fetch(\n `${apiBaseUrl}/repositories/${workspace}/${repo}`,\n options,\n );\n } catch (e) {\n throw new Error(`Unable to create repository, ${e}`);\n }\n\n if (response.status !== 200) {\n throw new Error(\n `Unable to create repository, ${response.status} ${\n response.statusText\n }, ${await response.text()}`,\n );\n }\n\n const r = await response.json();\n let remoteUrl = '';\n for (const link of r.links.clone) {\n if (link.name === 'https') {\n remoteUrl = link.href;\n }\n }\n\n // \"mainbranch.name\" cannot be set neither at create nor update of the repo\n // the first pushed branch will be set as \"main branch\" then\n const repoContentsUrl = `${r.links.html.href}/src/${mainBranch}`;\n return { remoteUrl, repoContentsUrl };\n};\n\n/**\n * Creates a new action that initializes a git repository of the content in the workspace\n * and publishes it to Bitbucket Cloud.\n * @public\n */\nexport function createPublishBitbucketCloudAction(options: {\n integrations: ScmIntegrationRegistry;\n config: Config;\n}) {\n const { integrations, config } = options;\n\n return createTemplateAction<{\n repoUrl: string;\n description?: string;\n defaultBranch?: string;\n repoVisibility?: 'private' | 'public';\n gitCommitMessage?: string;\n sourcePath?: string;\n token?: string;\n }>({\n id: 'publish:bitbucketCloud',\n examples,\n description:\n 'Initializes a git repository of the content in the workspace, and publishes it to Bitbucket Cloud.',\n schema: {\n input: {\n type: 'object',\n required: ['repoUrl'],\n properties: {\n repoUrl: {\n title: 'Repository Location',\n type: 'string',\n },\n description: {\n title: 'Repository Description',\n type: 'string',\n },\n repoVisibility: {\n title: 'Repository Visibility',\n type: 'string',\n enum: ['private', 'public'],\n },\n defaultBranch: {\n title: 'Default Branch',\n type: 'string',\n description: `Sets the default branch on the repository. The default value is 'master'`,\n },\n gitCommitMessage: {\n title: 'Git Commit Message',\n type: 'string',\n description: `Sets the commit message on the repository. The default value is 'initial commit'`,\n },\n sourcePath: {\n title: 'Source Path',\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 type: 'string',\n },\n token: {\n title: 'Authentication Token',\n type: 'string',\n description:\n 'The token to use for authorization to BitBucket Cloud',\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n remoteUrl: {\n title: 'A URL to the repository with the provider',\n type: 'string',\n },\n repoContentsUrl: {\n title: 'A URL to the root of the repository',\n type: 'string',\n },\n commitHash: {\n title: 'The git commit hash of the initial commit',\n type: 'string',\n },\n },\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n description,\n defaultBranch = 'master',\n gitCommitMessage,\n repoVisibility = 'private',\n } = ctx.input;\n\n const { workspace, project, repo, host } = parseRepoUrl(\n repoUrl,\n integrations,\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 if (!project) {\n throw new InputError(\n `Invalid URL provider was included in the repo URL to create ${ctx.input.repoUrl}, missing project`,\n );\n }\n\n const integrationConfig = integrations.bitbucketCloud.byHost(host);\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 authorization = getAuthorizationHeader(\n ctx.input.token ? { token: ctx.input.token } : integrationConfig.config,\n );\n\n const apiBaseUrl = integrationConfig.config.apiBaseUrl;\n\n const { remoteUrl, repoContentsUrl } = await createRepository({\n authorization,\n workspace: workspace || '',\n project,\n repo,\n repoVisibility,\n mainBranch: defaultBranch,\n description,\n apiBaseUrl,\n });\n\n const gitAuthorInfo = {\n name: config.getOptionalString('scaffolder.defaultAuthor.name'),\n email: config.getOptionalString('scaffolder.defaultAuthor.email'),\n };\n\n let auth;\n\n if (ctx.input.token) {\n auth = {\n username: 'x-token-auth',\n password: ctx.input.token,\n };\n } else {\n if (\n !integrationConfig.config.username ||\n !integrationConfig.config.appPassword\n ) {\n throw new Error(\n 'Credentials for Bitbucket Cloud integration required for this action.',\n );\n }\n\n auth = {\n username: integrationConfig.config.username,\n password: integrationConfig.config.appPassword,\n };\n }\n\n const commitResult = await initRepoAndPush({\n dir: getRepoSourceDirectory(ctx.workspacePath, ctx.input.sourcePath),\n remoteUrl,\n auth,\n defaultBranch,\n logger: ctx.logger,\n commitMessage:\n gitCommitMessage ||\n config.getOptionalString('scaffolder.defaultCommitMessage'),\n gitAuthorInfo,\n });\n\n ctx.output('commitHash', commitResult?.commitHash);\n ctx.output('remoteUrl', remoteUrl);\n ctx.output('repoContentsUrl', repoContentsUrl);\n },\n });\n}\n"],"names":["fetch","createTemplateAction","examples","parseRepoUrl","InputError","getAuthorizationHeader","initRepoAndPush","getRepoSourceDirectory"],"mappings":";;;;;;;;;;;;AA8BA,MAAM,gBAAA,GAAmB,OAAO,IAS1B,KAAA;AACJ,EAAM,MAAA;AAAA,IACJ,SAAA;AAAA,IACA,OAAA;AAAA,IACA,IAAA;AAAA,IACA,WAAA;AAAA,IACA,cAAA;AAAA,IACA,UAAA;AAAA,IACA,aAAA;AAAA,IACA;AAAA,GACE,GAAA,IAAA;AAEJ,EAAA,MAAM,OAAuB,GAAA;AAAA,IAC3B,MAAQ,EAAA,MAAA;AAAA,IACR,IAAA,EAAM,KAAK,SAAU,CAAA;AAAA,MACnB,GAAK,EAAA,KAAA;AAAA,MACL,WAAA;AAAA,MACA,YAAY,cAAmB,KAAA,SAAA;AAAA,MAC/B,OAAA,EAAS,EAAE,GAAA,EAAK,OAAQ;AAAA,KACzB,CAAA;AAAA,IACD,OAAS,EAAA;AAAA,MACP,aAAe,EAAA,aAAA;AAAA,MACf,cAAgB,EAAA;AAAA;AAClB,GACF;AAEA,EAAI,IAAA,QAAA;AACJ,EAAI,IAAA;AACF,IAAA,QAAA,GAAW,MAAMA,sBAAA;AAAA,MACf,CAAG,EAAA,UAAU,CAAiB,cAAA,EAAA,SAAS,IAAI,IAAI,CAAA,CAAA;AAAA,MAC/C;AAAA,KACF;AAAA,WACO,CAAG,EAAA;AACV,IAAA,MAAM,IAAI,KAAA,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A,CAAkB,gCAAgC;AAAA,OAClE;AAEA,MAAI,IAAA,IAAA;AAEJ,MAAI,IAAA,GAAA,CAAI,MAAM,KAAO,EAAA;AACnB,QAAO,IAAA,GAAA;AAAA,UACL,QAAU,EAAA,cAAA;AAAA,UACV,QAAA,EAAU,IAAI,KAAM,CAAA;AAAA,SACtB;AAAA,OACK,MAAA;AACL,QAAA,IACE,CAAC,iBAAkB,CAAA,MAAA,CAAO,YAC1B,CAAC,iBAAA,CAAkB,OAAO,WAC1B,EAAA;AACA,UAAA,MAAM,IAAI,KAAA;AAAA,YACR;AAAA,WACF;AAAA;AAGF,QAAO,IAAA,GAAA;AAAA,UACL,QAAA,EAAU,kBAAkB,MAAO,CAAA,QAAA;AAAA,UACnC,QAAA,EAAU,kBAAkB,MAAO,CAAA;AAAA,SACrC;AAAA;AAGF,MAAM,MAAA,YAAA,GAAe,MAAMC,oCAAgB,CAAA;AAAA,QACzC,KAAKC,2CAAuB,CAAA,GAAA,CAAI,aAAe,EAAA,GAAA,CAAI,MAAM,UAAU,CAAA;AAAA,QACnE,SAAA;AAAA,QACA,IAAA;AAAA,QACA,aAAA;AAAA,QACA,QAAQ,GAAI,CAAA,MAAA;AAAA,QACZ,aACE,EAAA,gBAAA,IACA,MAAO,CAAA,iBAAA,CAAkB,iCAAiC,CAAA;AAAA,QAC5D;AAAA,OACD,CAAA;AAED,MAAI,GAAA,CAAA,MAAA,CAAO,YAAc,EAAA,YAAA,EAAc,UAAU,CAAA;AACjD,MAAI,GAAA,CAAA,MAAA,CAAO,aAAa,SAAS,CAAA;AACjC,MAAI,GAAA,CAAA,MAAA,CAAO,mBAAmB,eAAe,CAAA;AAAA;AAC/C,GACD,CAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitbucketCloud.examples.cjs.js","sources":["../../src/actions/bitbucketCloud.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 git repository with the content in the workspace, and publishes it to Bitbucket Cloud with the default configuration.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:bitbucketCloud',\n name: 'Publish to Bitbucket Cloud',\n input: {\n repoUrl:\n 'bitbucket.org?repo=repo&workspace=workspace&project=project',\n },\n },\n ],\n }),\n },\n {\n description: 'Initializes a Bitbucket Cloud repository with a description.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:bitbucketCloud',\n name: 'Publish to Bitbucket Cloud',\n input: {\n repoUrl:\n 'bitbucket.org?repo=repo&workspace=workspace&project=project',\n description: 'Initialize a git repository',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a Bitbucket Cloud repository with public repo visibility, if not set defaults to private',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:bitbucketCloud',\n name: 'Publish to Bitbucket Cloud',\n input: {\n repoUrl:\n 'bitbucket.org?repo=repo&workspace=workspace&project=project',\n repoVisibility: 'public',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a Bitbucket Cloud repository with a default Branch, if not set defaults to master',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:bitbucketCloud',\n name: 'Publish to Bitbucket Cloud',\n input: {\n repoUrl:\n 'bitbucket.org?repo=repo&workspace=workspace&project=project',\n defaultBranch: 'main',\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:bitbucketCloud',\n name: 'Publish to Bitbucket Cloud',\n input: {\n repoUrl:\n 'bitbucket.org?repo=repo&workspace=workspace&project=project',\n sourcePath: './repoRoot',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a Bitbucket Cloud repository with a custom authentication token',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:bitbucketCloud',\n name: 'Publish to Bitbucket Cloud',\n input: {\n repoUrl:\n 'bitbucket.org?repo=repo&workspace=workspace&project=project',\n token: 'your-custom-auth-token',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a Bitbucket Cloud repository with all proporties being set',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:bitbucketCloud',\n name: 'Publish to Bitbucket Cloud',\n input: {\n repoUrl:\n 'bitbucket.org?repo=repo&workspace=workspace&project=project',\n description: 'Initialize a git repository',\n repoVisibility: 'public',\n defaultBranch: 'main',\n token: 'your-custom-auth-token',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WACE,EAAA,qIAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,SAAA;AAAA,UACJ,MAAQ,EAAA,wBAAA;AAAA,UACR,IAAM,EAAA,4BAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OACE,EAAA
|
|
1
|
+
{"version":3,"file":"bitbucketCloud.examples.cjs.js","sources":["../../src/actions/bitbucketCloud.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 git repository with the content in the workspace, and publishes it to Bitbucket Cloud with the default configuration.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:bitbucketCloud',\n name: 'Publish to Bitbucket Cloud',\n input: {\n repoUrl:\n 'bitbucket.org?repo=repo&workspace=workspace&project=project',\n },\n },\n ],\n }),\n },\n {\n description: 'Initializes a Bitbucket Cloud repository with a description.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:bitbucketCloud',\n name: 'Publish to Bitbucket Cloud',\n input: {\n repoUrl:\n 'bitbucket.org?repo=repo&workspace=workspace&project=project',\n description: 'Initialize a git repository',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a Bitbucket Cloud repository with public repo visibility, if not set defaults to private',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:bitbucketCloud',\n name: 'Publish to Bitbucket Cloud',\n input: {\n repoUrl:\n 'bitbucket.org?repo=repo&workspace=workspace&project=project',\n repoVisibility: 'public',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a Bitbucket Cloud repository with a default Branch, if not set defaults to master',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:bitbucketCloud',\n name: 'Publish to Bitbucket Cloud',\n input: {\n repoUrl:\n 'bitbucket.org?repo=repo&workspace=workspace&project=project',\n defaultBranch: 'main',\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:bitbucketCloud',\n name: 'Publish to Bitbucket Cloud',\n input: {\n repoUrl:\n 'bitbucket.org?repo=repo&workspace=workspace&project=project',\n sourcePath: './repoRoot',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a Bitbucket Cloud repository with a custom authentication token',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:bitbucketCloud',\n name: 'Publish to Bitbucket Cloud',\n input: {\n repoUrl:\n 'bitbucket.org?repo=repo&workspace=workspace&project=project',\n token: 'your-custom-auth-token',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a Bitbucket Cloud repository with all proporties being set',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:bitbucketCloud',\n name: 'Publish to Bitbucket Cloud',\n input: {\n repoUrl:\n 'bitbucket.org?repo=repo&workspace=workspace&project=project',\n description: 'Initialize a git repository',\n repoVisibility: 'public',\n defaultBranch: 'main',\n token: 'your-custom-auth-token',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WACE,EAAA,qIAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,SAAA;AAAA,UACJ,MAAQ,EAAA,wBAAA;AAAA,UACR,IAAM,EAAA,4BAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OACE,EAAA;AAAA;AACJ;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,8DAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,SAAA;AAAA,UACJ,MAAQ,EAAA,wBAAA;AAAA,UACR,IAAM,EAAA,4BAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OACE,EAAA,6DAAA;AAAA,YACF,WAAa,EAAA;AAAA;AACf;AACF;AACF,KACD;AAA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,YACF,KAAO,EAAA;AAAA;AACT;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WACE,EAAA,wEAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,SAAA;AAAA,UACJ,MAAQ,EAAA,wBAAA;AAAA,UACR,IAAM,EAAA,4BAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OACE,EAAA,6DAAA;AAAA,YACF,WAAa,EAAA,6BAAA;AAAA,YACb,cAAgB,EAAA,QAAA;AAAA,YAChB,aAAe,EAAA,MAAA;AAAA,YACf,KAAO,EAAA;AAAA;AACT;AACF;AACF,KACD;AAAA;AAEL;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitbucketCloudPipelinesRun.cjs.js","sources":["../../src/actions/bitbucketCloudPipelinesRun.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 { examples } from './bitbucketCloudPipelinesRun.examples';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport fetch, { Response } from 'node-fetch';\nimport * as inputProps from './inputProperties';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { getAuthorizationHeader } from './helpers';\n\nconst id = 'bitbucket:pipelines:run';\n/**\n * Creates a new action that triggers a run of a bitbucket pipeline\n *\n * @public\n */\nexport const createBitbucketPipelinesRunAction = (options: {\n integrations: ScmIntegrationRegistry;\n}) => {\n const { integrations } = options;\n return createTemplateAction<{\n workspace: string;\n repo_slug: string;\n body?: object;\n token?: string;\n }>({\n id,\n description: 'Run a bitbucket cloud pipeline',\n examples,\n schema: {\n input: {\n type: 'object',\n required: ['workspace', 'repo_slug'],\n properties: {\n workspace: inputProps.workspace,\n repo_slug: inputProps.repo_slug,\n body: inputProps.pipelinesRunBody,\n token: inputProps.token,\n },\n },\n output: {\n type: 'object',\n properties: {\n buildNumber: {\n title: 'Build number',\n type: 'number',\n },\n repoUrl: {\n title: 'A URL to the pipeline repositry',\n type: 'string',\n },\n repoContentsUrl: {\n title: 'A URL to the pipeline',\n type: 'string',\n },\n },\n },\n },\n supportsDryRun: false,\n async handler(ctx) {\n const { workspace, repo_slug, body, token } = ctx.input;\n const host = 'bitbucket.org';\n const integrationConfig = integrations.bitbucketCloud.byHost(host);\n\n const authorization = getAuthorizationHeader(\n token ? { token } : integrationConfig!.config,\n );\n let response: Response;\n try {\n response = await fetch(\n `https://api.bitbucket.org/2.0/repositories/${workspace}/${repo_slug}/pipelines`,\n {\n method: 'POST',\n headers: {\n Authorization: authorization,\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(body) ?? {},\n },\n );\n } catch (e) {\n throw new Error(`Unable to run pipeline, ${e}`);\n }\n\n if (response.status !== 201) {\n throw new Error(\n `Unable to run pipeline, ${response.status} ${\n response.statusText\n }, ${await response.text()}`,\n );\n }\n\n const responseObject = await response.json();\n\n ctx.output('buildNumber', responseObject.build_number);\n ctx.output('repoUrl', responseObject.repository.links.html.href);\n ctx.output(\n 'pipelinesUrl',\n `${responseObject.repository.links.html.href}/pipelines`,\n );\n },\n });\n};\n"],"names":["createTemplateAction","examples","inputProps.workspace","inputProps.repo_slug","inputProps.pipelinesRunBody","inputProps.token","getAuthorizationHeader","fetch"],"mappings":";;;;;;;;;;;;AAuBA,MAAM,EAAK,GAAA,yBAAA
|
|
1
|
+
{"version":3,"file":"bitbucketCloudPipelinesRun.cjs.js","sources":["../../src/actions/bitbucketCloudPipelinesRun.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 { examples } from './bitbucketCloudPipelinesRun.examples';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport fetch, { Response } from 'node-fetch';\nimport * as inputProps from './inputProperties';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { getAuthorizationHeader } from './helpers';\n\nconst id = 'bitbucket:pipelines:run';\n/**\n * Creates a new action that triggers a run of a bitbucket pipeline\n *\n * @public\n */\nexport const createBitbucketPipelinesRunAction = (options: {\n integrations: ScmIntegrationRegistry;\n}) => {\n const { integrations } = options;\n return createTemplateAction<{\n workspace: string;\n repo_slug: string;\n body?: object;\n token?: string;\n }>({\n id,\n description: 'Run a bitbucket cloud pipeline',\n examples,\n schema: {\n input: {\n type: 'object',\n required: ['workspace', 'repo_slug'],\n properties: {\n workspace: inputProps.workspace,\n repo_slug: inputProps.repo_slug,\n body: inputProps.pipelinesRunBody,\n token: inputProps.token,\n },\n },\n output: {\n type: 'object',\n properties: {\n buildNumber: {\n title: 'Build number',\n type: 'number',\n },\n repoUrl: {\n title: 'A URL to the pipeline repositry',\n type: 'string',\n },\n repoContentsUrl: {\n title: 'A URL to the pipeline',\n type: 'string',\n },\n },\n },\n },\n supportsDryRun: false,\n async handler(ctx) {\n const { workspace, repo_slug, body, token } = ctx.input;\n const host = 'bitbucket.org';\n const integrationConfig = integrations.bitbucketCloud.byHost(host);\n\n const authorization = getAuthorizationHeader(\n token ? { token } : integrationConfig!.config,\n );\n let response: Response;\n try {\n response = await fetch(\n `https://api.bitbucket.org/2.0/repositories/${workspace}/${repo_slug}/pipelines`,\n {\n method: 'POST',\n headers: {\n Authorization: authorization,\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(body) ?? {},\n },\n );\n } catch (e) {\n throw new Error(`Unable to run pipeline, ${e}`);\n }\n\n if (response.status !== 201) {\n throw new Error(\n `Unable to run pipeline, ${response.status} ${\n response.statusText\n }, ${await response.text()}`,\n );\n }\n\n const responseObject = await response.json();\n\n ctx.output('buildNumber', responseObject.build_number);\n ctx.output('repoUrl', responseObject.repository.links.html.href);\n ctx.output(\n 'pipelinesUrl',\n `${responseObject.repository.links.html.href}/pipelines`,\n );\n },\n });\n};\n"],"names":["createTemplateAction","examples","inputProps.workspace","inputProps.repo_slug","inputProps.pipelinesRunBody","inputProps.token","getAuthorizationHeader","fetch"],"mappings":";;;;;;;;;;;;AAuBA,MAAM,EAAK,GAAA,yBAAA;AAME,MAAA,iCAAA,GAAoC,CAAC,OAE5C,KAAA;AACJ,EAAM,MAAA,EAAE,cAAiB,GAAA,OAAA;AACzB,EAAA,OAAOA,yCAKJ,CAAA;AAAA,IACD,EAAA;AAAA,IACA,WAAa,EAAA,gCAAA;AAAA,cACbC,4CAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,IAAM,EAAA,QAAA;AAAA,QACN,QAAA,EAAU,CAAC,WAAA,EAAa,WAAW,CAAA;AAAA,QACnC,UAAY,EAAA;AAAA,UACV,WAAWC,yBAAW;AAAA,UACtB,WAAWC,yBAAW;AAAA,UACtB,MAAMC,gCAAW;AAAA,UACjB,OAAOC;AAAW;AACpB,OACF;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,IAAM,EAAA,QAAA;AAAA,QACN,UAAY,EAAA;AAAA,UACV,WAAa,EAAA;AAAA,YACX,KAAO,EAAA,cAAA;AAAA,YACP,IAAM,EAAA;AAAA,WACR;AAAA,UACA,OAAS,EAAA;AAAA,YACP,KAAO,EAAA,iCAAA;AAAA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AAM,CAAA;AAAA,SAC5B;AAAA;AAGF,MAAM,MAAA,cAAA,GAAiB,MAAM,QAAA,CAAS,IAAK,EAAA;AAE3C,MAAI,GAAA,CAAA,MAAA,CAAO,aAAe,EAAA,cAAA,CAAe,YAAY,CAAA;AACrD,MAAA,GAAA,CAAI,OAAO,SAAW,EAAA,cAAA,CAAe,UAAW,CAAA,KAAA,CAAM,KAAK,IAAI,CAAA;AAC/D,MAAI,GAAA,CAAA,MAAA;AAAA,QACF,cAAA;AAAA,QACA,CAAG,EAAA,cAAA,CAAe,UAAW,CAAA,KAAA,CAAM,KAAK,IAAI,CAAA,UAAA;AAAA,OAC9C;AAAA;AACF,GACD,CAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitbucketCloudPipelinesRun.examples.cjs.js","sources":["../../src/actions/bitbucketCloudPipelinesRun.examples.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 { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Trigger a pipeline for a branch',\n example: yaml.stringify({\n steps: [\n {\n action: 'bitbucket:pipelines:run',\n id: 'run-bitbucket-pipeline',\n name: 'Run an example bitbucket pipeline',\n input: {\n workspace: 'test-workspace',\n repo_slug: 'test-repo-slug',\n body: {\n target: {\n ref_type: 'branch',\n type: 'pipeline_ref_target',\n ref_name: 'master',\n },\n },\n },\n },\n ],\n }),\n },\n {\n description: 'Trigger a pipeline for a commit on a branch',\n example: yaml.stringify({\n steps: [\n {\n action: 'bitbucket:pipelines:run',\n id: 'run-bitbucket-pipeline',\n name: 'Run an example bitbucket pipeline',\n input: {\n workspace: 'test-workspace',\n repo_slug: 'test-repo-slug',\n body: {\n target: {\n commit: {\n type: 'commit',\n hash: 'ce5b7431602f7cbba007062eeb55225c6e18e956',\n },\n ref_type: 'branch',\n type: 'pipeline_ref_target',\n ref_name: 'master',\n },\n },\n },\n },\n ],\n }),\n },\n {\n description: 'Trigger a specific pipeline definition for a commit',\n example: yaml.stringify({\n steps: [\n {\n action: 'bitbucket:pipelines:run',\n id: 'run-bitbucket-pipeline',\n name: 'Run an example bitbucket pipeline',\n input: {\n workspace: 'test-workspace',\n repo_slug: 'test-repo-slug',\n body: {\n target: {\n commit: {\n type: 'commit',\n hash: 'a3c4e02c9a3755eccdc3764e6ea13facdf30f923',\n },\n selector: {\n type: 'custom',\n pattern: 'Deploy to production',\n },\n type: 'pipeline_commit_target',\n },\n },\n },\n },\n ],\n }),\n },\n {\n description:\n 'Trigger a specific pipeline definition for a commit on a branch or tag',\n example: yaml.stringify({\n steps: [\n {\n action: 'bitbucket:pipelines:run',\n id: 'run-bitbucket-pipeline',\n name: 'Run an example bitbucket pipeline',\n input: {\n workspace: 'test-workspace',\n repo_slug: 'test-repo-slug',\n body: {\n target: {\n commit: {\n type: 'commit',\n hash: 'a3c4e02c9a3755eccdc3764e6ea13facdf30f923',\n },\n selector: {\n type: 'custom',\n pattern: 'Deploy to production',\n },\n type: 'pipeline_ref_target',\n ref_name: 'master',\n ref_type: 'branch',\n },\n },\n },\n },\n ],\n }),\n },\n {\n description: 'Trigger a custom pipeline with variables',\n example: yaml.stringify({\n steps: [\n {\n action: 'bitbucket:pipelines:run',\n id: 'run-bitbucket-pipeline',\n name: 'Run an example bitbucket pipeline',\n input: {\n workspace: 'test-workspace',\n repo_slug: 'test-repo-slug',\n body: {\n target: {\n type: 'pipeline_ref_target',\n ref_name: 'master',\n ref_type: 'branch',\n selector: {\n type: 'custom',\n pattern: 'Deploy to production',\n },\n },\n variables: [\n { key: 'var1key', value: 'var1value', secured: true },\n {\n key: 'var2key',\n value: 'var2value',\n },\n ],\n },\n },\n },\n ],\n }),\n },\n {\n description: 'Trigger a pull request pipeline',\n example: yaml.stringify({\n steps: [\n {\n action: 'bitbucket:pipelines:run',\n id: 'run-bitbucket-pipeline',\n name: 'Run an example bitbucket pipeline',\n input: {\n workspace: 'test-workspace',\n repo_slug: 'test-repo-slug',\n body: {\n target: {\n type: 'pipeline_pullrequest_target',\n source: 'pull-request-branch',\n destination: 'master',\n destination_commit: {\n hash: '9f848b7',\n },\n commit: {\n hash: '1a372fc',\n },\n pull_request: {\n id: '3',\n },\n selector: {\n type: 'pull-requests',\n pattern: '**',\n },\n },\n },\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,iCAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,yBAAA;AAAA,UACR,EAAI,EAAA,wBAAA;AAAA,UACJ,IAAM,EAAA,mCAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,SAAW,EAAA,gBAAA;AAAA,YACX,SAAW,EAAA,gBAAA;AAAA,YACX,IAAM,EAAA;AAAA,cACJ,MAAQ,EAAA;AAAA,gBACN,QAAU,EAAA,QAAA;AAAA,gBACV,IAAM,EAAA,qBAAA;AAAA,gBACN,QAAU,EAAA
|
|
1
|
+
{"version":3,"file":"bitbucketCloudPipelinesRun.examples.cjs.js","sources":["../../src/actions/bitbucketCloudPipelinesRun.examples.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 { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Trigger a pipeline for a branch',\n example: yaml.stringify({\n steps: [\n {\n action: 'bitbucket:pipelines:run',\n id: 'run-bitbucket-pipeline',\n name: 'Run an example bitbucket pipeline',\n input: {\n workspace: 'test-workspace',\n repo_slug: 'test-repo-slug',\n body: {\n target: {\n ref_type: 'branch',\n type: 'pipeline_ref_target',\n ref_name: 'master',\n },\n },\n },\n },\n ],\n }),\n },\n {\n description: 'Trigger a pipeline for a commit on a branch',\n example: yaml.stringify({\n steps: [\n {\n action: 'bitbucket:pipelines:run',\n id: 'run-bitbucket-pipeline',\n name: 'Run an example bitbucket pipeline',\n input: {\n workspace: 'test-workspace',\n repo_slug: 'test-repo-slug',\n body: {\n target: {\n commit: {\n type: 'commit',\n hash: 'ce5b7431602f7cbba007062eeb55225c6e18e956',\n },\n ref_type: 'branch',\n type: 'pipeline_ref_target',\n ref_name: 'master',\n },\n },\n },\n },\n ],\n }),\n },\n {\n description: 'Trigger a specific pipeline definition for a commit',\n example: yaml.stringify({\n steps: [\n {\n action: 'bitbucket:pipelines:run',\n id: 'run-bitbucket-pipeline',\n name: 'Run an example bitbucket pipeline',\n input: {\n workspace: 'test-workspace',\n repo_slug: 'test-repo-slug',\n body: {\n target: {\n commit: {\n type: 'commit',\n hash: 'a3c4e02c9a3755eccdc3764e6ea13facdf30f923',\n },\n selector: {\n type: 'custom',\n pattern: 'Deploy to production',\n },\n type: 'pipeline_commit_target',\n },\n },\n },\n },\n ],\n }),\n },\n {\n description:\n 'Trigger a specific pipeline definition for a commit on a branch or tag',\n example: yaml.stringify({\n steps: [\n {\n action: 'bitbucket:pipelines:run',\n id: 'run-bitbucket-pipeline',\n name: 'Run an example bitbucket pipeline',\n input: {\n workspace: 'test-workspace',\n repo_slug: 'test-repo-slug',\n body: {\n target: {\n commit: {\n type: 'commit',\n hash: 'a3c4e02c9a3755eccdc3764e6ea13facdf30f923',\n },\n selector: {\n type: 'custom',\n pattern: 'Deploy to production',\n },\n type: 'pipeline_ref_target',\n ref_name: 'master',\n ref_type: 'branch',\n },\n },\n },\n },\n ],\n }),\n },\n {\n description: 'Trigger a custom pipeline with variables',\n example: yaml.stringify({\n steps: [\n {\n action: 'bitbucket:pipelines:run',\n id: 'run-bitbucket-pipeline',\n name: 'Run an example bitbucket pipeline',\n input: {\n workspace: 'test-workspace',\n repo_slug: 'test-repo-slug',\n body: {\n target: {\n type: 'pipeline_ref_target',\n ref_name: 'master',\n ref_type: 'branch',\n selector: {\n type: 'custom',\n pattern: 'Deploy to production',\n },\n },\n variables: [\n { key: 'var1key', value: 'var1value', secured: true },\n {\n key: 'var2key',\n value: 'var2value',\n },\n ],\n },\n },\n },\n ],\n }),\n },\n {\n description: 'Trigger a pull request pipeline',\n example: yaml.stringify({\n steps: [\n {\n action: 'bitbucket:pipelines:run',\n id: 'run-bitbucket-pipeline',\n name: 'Run an example bitbucket pipeline',\n input: {\n workspace: 'test-workspace',\n repo_slug: 'test-repo-slug',\n body: {\n target: {\n type: 'pipeline_pullrequest_target',\n source: 'pull-request-branch',\n destination: 'master',\n destination_commit: {\n hash: '9f848b7',\n },\n commit: {\n hash: '1a372fc',\n },\n pull_request: {\n id: '3',\n },\n selector: {\n type: 'pull-requests',\n pattern: '**',\n },\n },\n },\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,iCAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,yBAAA;AAAA,UACR,EAAI,EA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|
logger: ctx.logger,
|
|
302
302
|
ref: sourceBranch
|
|
303
303
|
});
|
|
304
|
-
await pluginScaffolderNode.createBranch({
|
|
305
|
-
dir: tempDir,
|
|
306
|
-
auth,
|
|
307
|
-
logger: ctx.logger,
|
|
308
|
-
ref: sourceBranch
|
|
309
|
-
});
|
|
310
304
|
fs__default.default.cpSync(sourceDir, tempDir, {
|
|
311
305
|
recursive: true,
|
|
312
306
|
filter: (path) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitbucketCloudPullRequest.cjs.js","sources":["../../src/actions/bitbucketCloudPullRequest.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { InputError } from '@backstage/errors';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport {\n createTemplateAction,\n getRepoSourceDirectory,\n commitAndPushBranch,\n addFiles,\n createBranch as createGitBranch,\n cloneRepo,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport fetch, { RequestInit, Response } from 'node-fetch';\nimport { Config } from '@backstage/config';\nimport fs from 'fs-extra';\nimport { getAuthorizationHeader } from './helpers';\nimport { examples } from './bitbucketCloudPullRequest.examples';\n\nconst createPullRequest = async (opts: {\n workspace: string;\n repo: string;\n title: string;\n description?: string;\n targetBranch: string;\n sourceBranch: string;\n authorization: string;\n apiBaseUrl: string;\n}) => {\n const {\n workspace,\n repo,\n title,\n description,\n targetBranch,\n sourceBranch,\n authorization,\n apiBaseUrl,\n } = opts;\n\n let response: Response;\n const data: RequestInit = {\n method: 'POST',\n body: JSON.stringify({\n title: title,\n summary: {\n raw: description,\n },\n state: 'OPEN',\n source: {\n branch: {\n name: sourceBranch,\n },\n },\n destination: {\n branch: {\n name: targetBranch,\n },\n },\n }),\n headers: {\n Authorization: authorization,\n 'Content-Type': 'application/json',\n },\n };\n\n try {\n response = await fetch(\n `${apiBaseUrl}/repositories/${workspace}/${repo}/pullrequests`,\n data,\n );\n } catch (e) {\n throw new Error(`Unable to create pull-reqeusts, ${e}`);\n }\n\n if (response.status !== 201) {\n throw new Error(\n `Unable to create pull requests, ${response.status} ${\n response.statusText\n }, ${await response.text()}`,\n );\n }\n\n const r = await response.json();\n return r.links.html.href;\n};\n\nconst findBranches = async (opts: {\n workspace: string;\n repo: string;\n branchName: string;\n authorization: string;\n apiBaseUrl: string;\n}) => {\n const { workspace, repo, branchName, authorization, apiBaseUrl } = opts;\n\n let response: Response;\n const options: RequestInit = {\n method: 'GET',\n headers: {\n Authorization: authorization,\n 'Content-Type': 'application/json',\n },\n };\n\n try {\n response = await fetch(\n `${apiBaseUrl}/repositories/${workspace}/${repo}/refs/branches?q=${encodeURIComponent(\n `name = \"${branchName}\"`,\n )}`,\n options,\n );\n } catch (e) {\n throw new Error(`Unable to get branches, ${e}`);\n }\n\n if (response.status !== 200) {\n throw new Error(\n `Unable to get branches, ${response.status} ${\n response.statusText\n }, ${await response.text()}`,\n );\n }\n\n const r = await response.json();\n\n return r.values[0];\n};\nconst createBranch = async (opts: {\n workspace: string;\n repo: string;\n branchName: string;\n authorization: string;\n apiBaseUrl: string;\n startBranch: string;\n}) => {\n const {\n workspace,\n repo,\n branchName,\n authorization,\n apiBaseUrl,\n startBranch,\n } = opts;\n\n let response: Response;\n const options: RequestInit = {\n method: 'POST',\n body: JSON.stringify({\n name: branchName,\n target: {\n hash: startBranch,\n },\n }),\n headers: {\n Authorization: authorization,\n 'Content-Type': 'application/json',\n },\n };\n\n try {\n response = await fetch(\n `${apiBaseUrl}/repositories/${workspace}/${repo}/refs/branches`,\n options,\n );\n } catch (e) {\n throw new Error(`Unable to create branch, ${e}`);\n }\n\n if (response.status !== 201) {\n throw new Error(\n `Unable to create branch, ${response.status} ${\n response.statusText\n }, ${await response.text()}`,\n );\n }\n\n return await response.json();\n};\nconst getDefaultBranch = async (opts: {\n workspace: string;\n repo: string;\n authorization: string;\n apiBaseUrl: string;\n}): Promise<string> => {\n const { workspace, repo, authorization, apiBaseUrl } = opts;\n let response: Response;\n\n const options: RequestInit = {\n method: 'GET',\n headers: {\n Authorization: authorization,\n 'Content-Type': 'application/json',\n },\n };\n\n try {\n response = await fetch(\n `${apiBaseUrl}/repositories/${workspace}/${repo}`,\n options,\n );\n } catch (error) {\n throw error;\n }\n\n const { mainbranch } = await response.json();\n const defaultBranch = mainbranch.name;\n if (!defaultBranch) {\n throw new Error(`Could not fetch default branch for ${workspace}/${repo}`);\n }\n return defaultBranch;\n};\n/**\n * Creates a Bitbucket Cloud Pull Request action.\n * @public\n */\nexport function createPublishBitbucketCloudPullRequestAction(options: {\n integrations: ScmIntegrationRegistry;\n config: Config;\n}) {\n const { integrations, config } = options;\n\n return createTemplateAction<{\n repoUrl: string;\n title: string;\n description?: string;\n targetBranch?: string;\n sourceBranch: string;\n token?: string;\n gitAuthorName?: string;\n gitAuthorEmail?: string;\n }>({\n id: 'publish:bitbucketCloud:pull-request',\n examples,\n schema: {\n input: {\n type: 'object',\n required: ['repoUrl', 'title', 'sourceBranch'],\n properties: {\n repoUrl: {\n title: 'Repository Location',\n type: 'string',\n },\n title: {\n title: 'Pull Request title',\n type: 'string',\n description: 'The title for the pull request',\n },\n description: {\n title: 'Pull Request Description',\n type: 'string',\n description: 'The description of the pull request',\n },\n targetBranch: {\n title: 'Target Branch',\n type: 'string',\n description: `Branch of repository to apply changes to. The default value is 'master'`,\n },\n sourceBranch: {\n title: 'Source Branch',\n type: 'string',\n description: 'Branch of repository to copy changes from',\n },\n token: {\n title: 'Authorization Token',\n type: 'string',\n description:\n 'The token to use for authorization to BitBucket Cloud',\n },\n gitAuthorName: {\n title: 'Author Name',\n type: 'string',\n description: `Sets the author name for the commit. The default value is 'Scaffolder'`,\n },\n gitAuthorEmail: {\n title: 'Author Email',\n type: 'string',\n description: `Sets the author email for the commit.`,\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n pullRequestUrl: {\n title: 'A URL to the pull request with the provider',\n type: 'string',\n },\n },\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n title,\n description,\n targetBranch,\n sourceBranch,\n gitAuthorName,\n gitAuthorEmail,\n } = ctx.input;\n\n const { workspace, repo, host } = parseRepoUrl(repoUrl, integrations);\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 integrationConfig = integrations.bitbucketCloud.byHost(host);\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 authorization = getAuthorizationHeader(\n ctx.input.token ? { token: ctx.input.token } : integrationConfig.config,\n );\n\n const apiBaseUrl = integrationConfig.config.apiBaseUrl;\n\n let finalTargetBranch = targetBranch;\n if (!finalTargetBranch) {\n finalTargetBranch = await getDefaultBranch({\n workspace,\n repo,\n authorization,\n apiBaseUrl,\n });\n }\n\n const sourceBranchRef = await findBranches({\n workspace,\n repo,\n branchName: sourceBranch,\n authorization,\n apiBaseUrl,\n });\n\n if (!sourceBranchRef) {\n // create branch\n ctx.logger.info(\n `source branch not found -> creating branch named: ${sourceBranch}`,\n );\n\n await createBranch({\n workspace,\n repo,\n branchName: sourceBranch,\n authorization,\n apiBaseUrl,\n startBranch: finalTargetBranch,\n });\n\n const remoteUrl = `https://${host}/${workspace}/${repo}.git`;\n\n let auth;\n\n if (ctx.input.token) {\n auth = {\n username: 'x-token-auth',\n password: ctx.input.token,\n };\n } else {\n if (\n !integrationConfig.config.username ||\n !integrationConfig.config.appPassword\n ) {\n throw new Error(\n 'Credentials for Bitbucket Cloud integration required for this action.',\n );\n }\n\n auth = {\n username: integrationConfig.config.username,\n password: integrationConfig.config.appPassword,\n };\n }\n\n const gitAuthorInfo = {\n name:\n gitAuthorName ||\n config.getOptionalString('scaffolder.defaultAuthor.name'),\n email:\n gitAuthorEmail ||\n config.getOptionalString('scaffolder.defaultAuthor.email'),\n };\n\n const tempDir = await ctx.createTemporaryDirectory();\n const sourceDir = getRepoSourceDirectory(ctx.workspacePath, undefined);\n await cloneRepo({\n url: remoteUrl,\n dir: tempDir,\n auth,\n logger: ctx.logger,\n ref: sourceBranch,\n });\n\n await createGitBranch({\n dir: tempDir,\n auth,\n logger: ctx.logger,\n ref: sourceBranch,\n });\n\n // copy files\n fs.cpSync(sourceDir, tempDir, {\n recursive: true,\n filter: path => {\n return !(path.indexOf('.git') > -1);\n },\n });\n\n await addFiles({\n dir: tempDir,\n auth,\n logger: ctx.logger,\n filepath: '.',\n });\n\n await commitAndPushBranch({\n dir: tempDir,\n auth,\n logger: ctx.logger,\n commitMessage:\n description ??\n config.getOptionalString('scaffolder.defaultCommitMessage') ??\n '',\n gitAuthorInfo,\n branch: sourceBranch,\n });\n }\n\n const pullRequestUrl = await createPullRequest({\n workspace,\n repo,\n title,\n description,\n targetBranch: finalTargetBranch,\n sourceBranch,\n authorization,\n apiBaseUrl,\n });\n\n ctx.output('pullRequestUrl', pullRequestUrl);\n },\n });\n}\n"],"names":["fetch","createTemplateAction","examples","parseRepoUrl","InputError","getAuthorizationHeader","getRepoSourceDirectory","cloneRepo","createGitBranch","fs","addFiles","commitAndPushBranch"],"mappings":";;;;;;;;;;;;;;AAiCA,MAAM,iBAAA,GAAoB,OAAO,IAS3B,KAAA;AACJ,EAAM,MAAA;AAAA,IACJ,SAAA;AAAA,IACA,IAAA;AAAA,IACA,KAAA;AAAA,IACA,WAAA;AAAA,IACA,YAAA;AAAA,IACA,YAAA;AAAA,IACA,aAAA;AAAA,IACA,UAAA;AAAA,GACE,GAAA,IAAA,CAAA;AAEJ,EAAI,IAAA,QAAA,CAAA;AACJ,EAAA,MAAM,IAAoB,G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A;AAAA,QACA,aAAA;AAAA,QACA,UAAA;AAAA,OACD,CAAA,CAAA;AAED,MAAI,GAAA,CAAA,MAAA,CAAO,kBAAkB,cAAc,CAAA,CAAA;AAAA,KAC7C;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"bitbucketCloudPullRequest.cjs.js","sources":["../../src/actions/bitbucketCloudPullRequest.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { InputError } from '@backstage/errors';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport {\n createTemplateAction,\n getRepoSourceDirectory,\n commitAndPushBranch,\n addFiles,\n cloneRepo,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport fetch, { RequestInit, Response } from 'node-fetch';\nimport { Config } from '@backstage/config';\nimport fs from 'fs-extra';\nimport { getAuthorizationHeader } from './helpers';\nimport { examples } from './bitbucketCloudPullRequest.examples';\n\nconst createPullRequest = async (opts: {\n workspace: string;\n repo: string;\n title: string;\n description?: string;\n targetBranch: string;\n sourceBranch: string;\n authorization: string;\n apiBaseUrl: string;\n}) => {\n const {\n workspace,\n repo,\n title,\n description,\n targetBranch,\n sourceBranch,\n authorization,\n apiBaseUrl,\n } = opts;\n\n let response: Response;\n const data: RequestInit = {\n method: 'POST',\n body: JSON.stringify({\n title: title,\n summary: {\n raw: description,\n },\n state: 'OPEN',\n source: {\n branch: {\n name: sourceBranch,\n },\n },\n destination: {\n branch: {\n name: targetBranch,\n },\n },\n }),\n headers: {\n Authorization: authorization,\n 'Content-Type': 'application/json',\n },\n };\n\n try {\n response = await fetch(\n `${apiBaseUrl}/repositories/${workspace}/${repo}/pullrequests`,\n data,\n );\n } catch (e) {\n throw new Error(`Unable to create pull-reqeusts, ${e}`);\n }\n\n if (response.status !== 201) {\n throw new Error(\n `Unable to create pull requests, ${response.status} ${\n response.statusText\n }, ${await response.text()}`,\n );\n }\n\n const r = await response.json();\n return r.links.html.href;\n};\n\nconst findBranches = async (opts: {\n workspace: string;\n repo: string;\n branchName: string;\n authorization: string;\n apiBaseUrl: string;\n}) => {\n const { workspace, repo, branchName, authorization, apiBaseUrl } = opts;\n\n let response: Response;\n const options: RequestInit = {\n method: 'GET',\n headers: {\n Authorization: authorization,\n 'Content-Type': 'application/json',\n },\n };\n\n try {\n response = await fetch(\n `${apiBaseUrl}/repositories/${workspace}/${repo}/refs/branches?q=${encodeURIComponent(\n `name = \"${branchName}\"`,\n )}`,\n options,\n );\n } catch (e) {\n throw new Error(`Unable to get branches, ${e}`);\n }\n\n if (response.status !== 200) {\n throw new Error(\n `Unable to get branches, ${response.status} ${\n response.statusText\n }, ${await response.text()}`,\n );\n }\n\n const r = await response.json();\n\n return r.values[0];\n};\nconst createBranch = async (opts: {\n workspace: string;\n repo: string;\n branchName: string;\n authorization: string;\n apiBaseUrl: string;\n startBranch: string;\n}) => {\n const {\n workspace,\n repo,\n branchName,\n authorization,\n apiBaseUrl,\n startBranch,\n } = opts;\n\n let response: Response;\n const options: RequestInit = {\n method: 'POST',\n body: JSON.stringify({\n name: branchName,\n target: {\n hash: startBranch,\n },\n }),\n headers: {\n Authorization: authorization,\n 'Content-Type': 'application/json',\n },\n };\n\n try {\n response = await fetch(\n `${apiBaseUrl}/repositories/${workspace}/${repo}/refs/branches`,\n options,\n );\n } catch (e) {\n throw new Error(`Unable to create branch, ${e}`);\n }\n\n if (response.status !== 201) {\n throw new Error(\n `Unable to create branch, ${response.status} ${\n response.statusText\n }, ${await response.text()}`,\n );\n }\n\n return await response.json();\n};\nconst getDefaultBranch = async (opts: {\n workspace: string;\n repo: string;\n authorization: string;\n apiBaseUrl: string;\n}): Promise<string> => {\n const { workspace, repo, authorization, apiBaseUrl } = opts;\n let response: Response;\n\n const options: RequestInit = {\n method: 'GET',\n headers: {\n Authorization: authorization,\n 'Content-Type': 'application/json',\n },\n };\n\n try {\n response = await fetch(\n `${apiBaseUrl}/repositories/${workspace}/${repo}`,\n options,\n );\n } catch (error) {\n throw error;\n }\n\n const { mainbranch } = await response.json();\n const defaultBranch = mainbranch.name;\n if (!defaultBranch) {\n throw new Error(`Could not fetch default branch for ${workspace}/${repo}`);\n }\n return defaultBranch;\n};\n/**\n * Creates a Bitbucket Cloud Pull Request action.\n * @public\n */\nexport function createPublishBitbucketCloudPullRequestAction(options: {\n integrations: ScmIntegrationRegistry;\n config: Config;\n}) {\n const { integrations, config } = options;\n\n return createTemplateAction<{\n repoUrl: string;\n title: string;\n description?: string;\n targetBranch?: string;\n sourceBranch: string;\n token?: string;\n gitAuthorName?: string;\n gitAuthorEmail?: string;\n }>({\n id: 'publish:bitbucketCloud:pull-request',\n examples,\n schema: {\n input: {\n type: 'object',\n required: ['repoUrl', 'title', 'sourceBranch'],\n properties: {\n repoUrl: {\n title: 'Repository Location',\n type: 'string',\n },\n title: {\n title: 'Pull Request title',\n type: 'string',\n description: 'The title for the pull request',\n },\n description: {\n title: 'Pull Request Description',\n type: 'string',\n description: 'The description of the pull request',\n },\n targetBranch: {\n title: 'Target Branch',\n type: 'string',\n description: `Branch of repository to apply changes to. The default value is 'master'`,\n },\n sourceBranch: {\n title: 'Source Branch',\n type: 'string',\n description: 'Branch of repository to copy changes from',\n },\n token: {\n title: 'Authorization Token',\n type: 'string',\n description:\n 'The token to use for authorization to BitBucket Cloud',\n },\n gitAuthorName: {\n title: 'Author Name',\n type: 'string',\n description: `Sets the author name for the commit. The default value is 'Scaffolder'`,\n },\n gitAuthorEmail: {\n title: 'Author Email',\n type: 'string',\n description: `Sets the author email for the commit.`,\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n pullRequestUrl: {\n title: 'A URL to the pull request with the provider',\n type: 'string',\n },\n },\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n title,\n description,\n targetBranch,\n sourceBranch,\n gitAuthorName,\n gitAuthorEmail,\n } = ctx.input;\n\n const { workspace, repo, host } = parseRepoUrl(repoUrl, integrations);\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 integrationConfig = integrations.bitbucketCloud.byHost(host);\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 authorization = getAuthorizationHeader(\n ctx.input.token ? { token: ctx.input.token } : integrationConfig.config,\n );\n\n const apiBaseUrl = integrationConfig.config.apiBaseUrl;\n\n let finalTargetBranch = targetBranch;\n if (!finalTargetBranch) {\n finalTargetBranch = await getDefaultBranch({\n workspace,\n repo,\n authorization,\n apiBaseUrl,\n });\n }\n\n const sourceBranchRef = await findBranches({\n workspace,\n repo,\n branchName: sourceBranch,\n authorization,\n apiBaseUrl,\n });\n\n if (!sourceBranchRef) {\n // create branch\n ctx.logger.info(\n `source branch not found -> creating branch named: ${sourceBranch}`,\n );\n\n await createBranch({\n workspace,\n repo,\n branchName: sourceBranch,\n authorization,\n apiBaseUrl,\n startBranch: finalTargetBranch,\n });\n\n const remoteUrl = `https://${host}/${workspace}/${repo}.git`;\n\n let auth;\n\n if (ctx.input.token) {\n auth = {\n username: 'x-token-auth',\n password: ctx.input.token,\n };\n } else {\n if (\n !integrationConfig.config.username ||\n !integrationConfig.config.appPassword\n ) {\n throw new Error(\n 'Credentials for Bitbucket Cloud integration required for this action.',\n );\n }\n\n auth = {\n username: integrationConfig.config.username,\n password: integrationConfig.config.appPassword,\n };\n }\n\n const gitAuthorInfo = {\n name:\n gitAuthorName ||\n config.getOptionalString('scaffolder.defaultAuthor.name'),\n email:\n gitAuthorEmail ||\n config.getOptionalString('scaffolder.defaultAuthor.email'),\n };\n\n const tempDir = await ctx.createTemporaryDirectory();\n const sourceDir = getRepoSourceDirectory(ctx.workspacePath, undefined);\n await cloneRepo({\n url: remoteUrl,\n dir: tempDir,\n auth,\n logger: ctx.logger,\n ref: sourceBranch,\n });\n\n // copy files\n fs.cpSync(sourceDir, tempDir, {\n recursive: true,\n filter: path => {\n return !(path.indexOf('.git') > -1);\n },\n });\n\n await addFiles({\n dir: tempDir,\n auth,\n logger: ctx.logger,\n filepath: '.',\n });\n\n await commitAndPushBranch({\n dir: tempDir,\n auth,\n logger: ctx.logger,\n commitMessage:\n description ??\n config.getOptionalString('scaffolder.defaultCommitMessage') ??\n '',\n gitAuthorInfo,\n branch: sourceBranch,\n });\n }\n\n const pullRequestUrl = await createPullRequest({\n workspace,\n repo,\n title,\n description,\n targetBranch: finalTargetBranch,\n sourceBranch,\n authorization,\n apiBaseUrl,\n });\n\n ctx.output('pullRequestUrl', pullRequestUrl);\n },\n });\n}\n"],"names":["fetch","createTemplateAction","examples","parseRepoUrl","InputError","getAuthorizationHeader","getRepoSourceDirectory","cloneRepo","fs","addFiles","commitAndPushBranch"],"mappings":";;;;;;;;;;;;;;AAgCA,MAAM,iBAAA,GAAoB,OAAO,IAS3B,KAAA;AACJ,EAAM,MAAA;AAAA,IACJ,SAAA;AAAA,IACA,IAAA;AAAA,IACA,KAAA;AAAA,IACA,WAAA;AAAA,IACA,YAAA;AAAA,IACA,YAAA;AAAA,IACA,aAAA;AAAA,IACA;AAAA,GACE,GAAA,IAAA;AAEJ,EAAI,IAAA,QAAA;AACJ,EAAA,MAAM,IAAoB,GAAA;AAAA,IACxB,MAAQ,EAAA,MAAA;AAAA,IACR,IAAA,EAAM,KAAK,SAAU,CAAA;AAAA,MACnB,KAAA;AAAA,MACA,OAAS,EAAA;AAAA,QACP,GAAK,EAAA;AAAA,OACP;AAAA,MACA,KAAO,EAAA,MAAA;AAAA,MACP,MAAQ,EAAA;AAAA,QACN,MAAQ,EAAA;AAAA,UACN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ACA,WAAA;AAAA,QACA,YAAc,EAAA,iBAAA;AAAA,QACd,YAAA;AAAA,QACA,aAAA;AAAA,QACA;AAAA,OACD,CAAA;AAED,MAAI,GAAA,CAAA,MAAA,CAAO,kBAAkB,cAAc,CAAA;AAAA;AAC7C,GACD,CAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitbucketCloudPullRequest.examples.cjs.js","sources":["../../src/actions/bitbucketCloudPullRequest.examples.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description:\n 'Creating pull request on bitbucket cloud with required fields',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:bitbucketCloud:pull-request',\n id: 'publish-bitbucket-cloud-pull-request-minimal',\n name: 'Creating pull request on bitbucket cloud',\n input: {\n repoUrl:\n 'bitbucket.org?workspace=workspace&project=project&repo=repo',\n title: 'My pull request',\n sourceBranch: 'my-feature-branch',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Creating pull request on bitbucket cloud with custom descriptions',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:bitbucketCloud:pull-request',\n id: 'publish-bitbucket-cloud-pull-request-minimal',\n name: 'Creating pull request on bitbucket cloud',\n input: {\n repoUrl:\n 'bitbucket.org?workspace=workspace&project=project&repo=repo',\n title: 'My pull request',\n sourceBranch: 'my-feature-branch',\n description: 'This is a detailed description of my pull request',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Creating pull request on bitbucket cloud with different target branch',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:bitbucketCloud:pull-request',\n id: 'publish-bitbucket-cloud-pull-request-target-branch',\n name: 'Creating pull request on bitbucket cloud',\n input: {\n repoUrl:\n 'bitbucket.org?workspace=workspace&project=project&repo=repo',\n title: 'My pull request',\n sourceBranch: 'my-feature-branch',\n targetBranch: 'development',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Creating pull request on bitbucket cloud with authorization token',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:bitbucketCloud:pull-request',\n id: 'publish-bitbucket-cloud-pull-request-minimal',\n name: 'Creating pull request on bitbucket cloud',\n input: {\n repoUrl:\n 'bitbucket.org?workspace=workspace&project=project&repo=repo',\n title: 'My pull request',\n sourceBranch: 'my-feature-branch',\n token: 'my-auth-token',\n },\n },\n ],\n }),\n },\n {\n description: 'Creating pull request on bitbucket cloud with all fields',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:bitbucketCloud:pull-request',\n id: 'publish-bitbucket-cloud-pull-request-minimal',\n name: 'Creating pull request on bitbucket cloud',\n input: {\n repoUrl:\n 'bitbucket.org?workspace=workspace&project=project&repo=repo',\n title: 'My pull request',\n sourceBranch: 'my-feature-branch',\n targetBranch: 'development',\n description: 'This is a detailed description of my pull request',\n token: 'my-auth-token',\n gitAuthorName: 'test-user',\n gitAuthorEmail: 'test-user@sample.com',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WACE,EAAA,+DAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,qCAAA;AAAA,UACR,EAAI,EAAA,8CAAA;AAAA,UACJ,IAAM,EAAA,0CAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OACE,EAAA,6DAAA;AAAA,YACF,KAAO,EAAA,iBAAA;AAAA,YACP,YAAc,EAAA
|
|
1
|
+
{"version":3,"file":"bitbucketCloudPullRequest.examples.cjs.js","sources":["../../src/actions/bitbucketCloudPullRequest.examples.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description:\n 'Creating pull request on bitbucket cloud with required fields',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:bitbucketCloud:pull-request',\n id: 'publish-bitbucket-cloud-pull-request-minimal',\n name: 'Creating pull request on bitbucket cloud',\n input: {\n repoUrl:\n 'bitbucket.org?workspace=workspace&project=project&repo=repo',\n title: 'My pull request',\n sourceBranch: 'my-feature-branch',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Creating pull request on bitbucket cloud with custom descriptions',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:bitbucketCloud:pull-request',\n id: 'publish-bitbucket-cloud-pull-request-minimal',\n name: 'Creating pull request on bitbucket cloud',\n input: {\n repoUrl:\n 'bitbucket.org?workspace=workspace&project=project&repo=repo',\n title: 'My pull request',\n sourceBranch: 'my-feature-branch',\n description: 'This is a detailed description of my pull request',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Creating pull request on bitbucket cloud with different target branch',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:bitbucketCloud:pull-request',\n id: 'publish-bitbucket-cloud-pull-request-target-branch',\n name: 'Creating pull request on bitbucket cloud',\n input: {\n repoUrl:\n 'bitbucket.org?workspace=workspace&project=project&repo=repo',\n title: 'My pull request',\n sourceBranch: 'my-feature-branch',\n targetBranch: 'development',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Creating pull request on bitbucket cloud with authorization token',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:bitbucketCloud:pull-request',\n id: 'publish-bitbucket-cloud-pull-request-minimal',\n name: 'Creating pull request on bitbucket cloud',\n input: {\n repoUrl:\n 'bitbucket.org?workspace=workspace&project=project&repo=repo',\n title: 'My pull request',\n sourceBranch: 'my-feature-branch',\n token: 'my-auth-token',\n },\n },\n ],\n }),\n },\n {\n description: 'Creating pull request on bitbucket cloud with all fields',\n example: yaml.stringify({\n steps: [\n {\n action: 'publish:bitbucketCloud:pull-request',\n id: 'publish-bitbucket-cloud-pull-request-minimal',\n name: 'Creating pull request on bitbucket cloud',\n input: {\n repoUrl:\n 'bitbucket.org?workspace=workspace&project=project&repo=repo',\n title: 'My pull request',\n sourceBranch: 'my-feature-branch',\n targetBranch: 'development',\n description: 'This is a detailed description of my pull request',\n token: 'my-auth-token',\n gitAuthorName: 'test-user',\n gitAuthorEmail: 'test-user@sample.com',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WACE,EAAA,+DAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,MAAQ,EAAA,qCAAA;AAAA,UACR,EAAI,EAAA,8CAAA;AAAA,UACJ,IAAM,EAAA,0CAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OACE,EAAA,6DAAA;AAAA,YACF,KAAO,EAAA,iBAAA;AAAA,YACP,YAAc,EAAA;AAAA;AAChB;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WACE,EAAA,mEAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MAC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AAA,UACJ,IAAM,EAAA,0CAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OACE,EAAA,6DAAA;AAAA,YACF,KAAO,EAAA,iBAAA;AAAA,YACP,YAAc,EAAA,mBAAA;AAAA,YACd,YAAc,EAAA,aAAA;AAAA,YACd,WAAa,EAAA,mDAAA;AAAA,YACb,KAAO,EAAA,eAAA;AAAA,YACP,aAAe,EAAA,WAAA;AAAA,YACf,cAAgB,EAAA;AAAA;AAClB;AACF;AACF,KACD;AAAA;AAEL;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.cjs.js","sources":["../../src/actions/helpers.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\nexport const getAuthorizationHeader = (config: {\n username?: string;\n appPassword?: string;\n token?: string;\n}) => {\n if (config.username && config.appPassword) {\n const buffer = Buffer.from(\n `${config.username}:${config.appPassword}`,\n 'utf8',\n );\n\n return `Basic ${buffer.toString('base64')}`;\n }\n\n if (config.token) {\n return `Bearer ${config.token}`;\n }\n\n throw new Error(\n `Authorization has not been provided for Bitbucket Cloud. Please add either username + appPassword to the Integrations config or a user login auth token`,\n );\n};\n"],"names":[],"mappings":";;AAgBa,MAAA,sBAAA,GAAyB,CAAC,MAIjC,KAAA;AACJ,EAAI,IAAA,MAAA,CAAO,QAAY,IAAA,MAAA,CAAO,WAAa,EAAA;AACzC,IAAA,MAAM,SAAS,MAAO,CAAA,IAAA;AAAA,MACpB,CAAG,EAAA,MAAA,CAAO,QAAQ,CAAA,CAAA,EAAI,OAAO,WAAW,CAAA,CAAA;AAAA,MACxC
|
|
1
|
+
{"version":3,"file":"helpers.cjs.js","sources":["../../src/actions/helpers.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\nexport const getAuthorizationHeader = (config: {\n username?: string;\n appPassword?: string;\n token?: string;\n}) => {\n if (config.username && config.appPassword) {\n const buffer = Buffer.from(\n `${config.username}:${config.appPassword}`,\n 'utf8',\n );\n\n return `Basic ${buffer.toString('base64')}`;\n }\n\n if (config.token) {\n return `Bearer ${config.token}`;\n }\n\n throw new Error(\n `Authorization has not been provided for Bitbucket Cloud. Please add either username + appPassword to the Integrations config or a user login auth token`,\n );\n};\n"],"names":[],"mappings":";;AAgBa,MAAA,sBAAA,GAAyB,CAAC,MAIjC,KAAA;AACJ,EAAI,IAAA,MAAA,CAAO,QAAY,IAAA,MAAA,CAAO,WAAa,EAAA;AACzC,IAAA,MAAM,SAAS,MAAO,CAAA,IAAA;AAAA,MACpB,CAAG,EAAA,MAAA,CAAO,QAAQ,CAAA,CAAA,EAAI,OAAO,WAAW,CAAA,CAAA;AAAA,MACxC;AAAA,KACF;AAEA,IAAA,OAAO,CAAS,MAAA,EAAA,MAAA,CAAO,QAAS,CAAA,QAAQ,CAAC,CAAA,CAAA;AAAA;AAG3C,EAAA,IAAI,OAAO,KAAO,EAAA;AAChB,IAAO,OAAA,CAAA,OAAA,EAAU,OAAO,KAAK,CAAA,CAAA;AAAA;AAG/B,EAAA,MAAM,IAAI,KAAA;AAAA,IACR,CAAA,uJAAA;AAAA,GACF;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputProperties.cjs.js","sources":["../../src/actions/inputProperties.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\nconst workspace = {\n title: 'Workspace',\n description: `The workspace name`,\n type: 'string',\n};\n\nconst repo_slug = {\n title: 'Repository name',\n description: 'The repository name',\n type: 'string',\n};\n\nconst ref_type = {\n title: 'ref_type',\n type: 'string',\n};\n\nconst type = {\n title: 'type',\n type: 'string',\n};\n\nconst ref_name = {\n title: 'ref_name',\n type: 'string',\n};\nconst source = {\n title: 'source',\n type: 'string',\n};\nconst destination = {\n title: 'destination',\n type: 'string',\n};\nconst hash = {\n title: 'hash',\n type: 'string',\n};\n\nconst pattern = {\n title: 'pattern',\n type: 'string',\n};\n\nconst id = {\n title: 'id',\n type: 'string',\n};\n\nconst key = {\n title: 'key',\n type: 'string',\n};\nconst value = {\n title: 'value',\n type: 'string',\n};\nconst secured = {\n title: 'secured',\n type: 'boolean',\n};\n\nconst token = {\n title: 'Authentication Token',\n type: 'string',\n description: 'The token to use for authorization to BitBucket Cloud',\n};\n\nconst destination_commit = {\n title: 'destination_commit',\n type: 'object',\n properties: {\n hash,\n },\n};\n\nconst commit = {\n title: 'commit',\n type: 'object',\n properties: {\n type,\n hash,\n },\n};\n\nconst selector = {\n title: 'selector',\n type: 'object',\n properties: {\n type,\n pattern,\n },\n};\n\nconst pull_request = {\n title: 'pull_request',\n type: 'object',\n properties: {\n id,\n },\n};\n\nconst pipelinesRunBody = {\n title: 'Request Body',\n description:\n 'Request body properties: see Bitbucket Cloud Rest API documentation for more details',\n type: 'object',\n properties: {\n target: {\n title: 'target',\n type: 'object',\n properties: {\n ref_type,\n type,\n ref_name,\n source,\n destination,\n destination_commit,\n commit,\n selector,\n pull_request,\n },\n },\n variables: {\n title: 'variables',\n type: 'array',\n items: {\n type: 'object',\n properties: {\n key,\n value,\n secured,\n },\n },\n },\n },\n};\n\nexport { workspace, repo_slug, pipelinesRunBody, token };\n"],"names":[],"mappings":";;AAgBA,MAAM,SAAY,GAAA;AAAA,EAChB,KAAO,EAAA,WAAA;AAAA,EACP,WAAa,EAAA,CAAA,kBAAA,CAAA;AAAA,EACb,IAAM,EAAA
|
|
1
|
+
{"version":3,"file":"inputProperties.cjs.js","sources":["../../src/actions/inputProperties.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\nconst workspace = {\n title: 'Workspace',\n description: `The workspace name`,\n type: 'string',\n};\n\nconst repo_slug = {\n title: 'Repository name',\n description: 'The repository name',\n type: 'string',\n};\n\nconst ref_type = {\n title: 'ref_type',\n type: 'string',\n};\n\nconst type = {\n title: 'type',\n type: 'string',\n};\n\nconst ref_name = {\n title: 'ref_name',\n type: 'string',\n};\nconst source = {\n title: 'source',\n type: 'string',\n};\nconst destination = {\n title: 'destination',\n type: 'string',\n};\nconst hash = {\n title: 'hash',\n type: 'string',\n};\n\nconst pattern = {\n title: 'pattern',\n type: 'string',\n};\n\nconst id = {\n title: 'id',\n type: 'string',\n};\n\nconst key = {\n title: 'key',\n type: 'string',\n};\nconst value = {\n title: 'value',\n type: 'string',\n};\nconst secured = {\n title: 'secured',\n type: 'boolean',\n};\n\nconst token = {\n title: 'Authentication Token',\n type: 'string',\n description: 'The token to use for authorization to BitBucket Cloud',\n};\n\nconst destination_commit = {\n title: 'destination_commit',\n type: 'object',\n properties: {\n hash,\n },\n};\n\nconst commit = {\n title: 'commit',\n type: 'object',\n properties: {\n type,\n hash,\n },\n};\n\nconst selector = {\n title: 'selector',\n type: 'object',\n properties: {\n type,\n pattern,\n },\n};\n\nconst pull_request = {\n title: 'pull_request',\n type: 'object',\n properties: {\n id,\n },\n};\n\nconst pipelinesRunBody = {\n title: 'Request Body',\n description:\n 'Request body properties: see Bitbucket Cloud Rest API documentation for more details',\n type: 'object',\n properties: {\n target: {\n title: 'target',\n type: 'object',\n properties: {\n ref_type,\n type,\n ref_name,\n source,\n destination,\n destination_commit,\n commit,\n selector,\n pull_request,\n },\n },\n variables: {\n title: 'variables',\n type: 'array',\n items: {\n type: 'object',\n properties: {\n key,\n value,\n secured,\n },\n },\n },\n },\n};\n\nexport { workspace, repo_slug, pipelinesRunBody, token };\n"],"names":[],"mappings":";;AAgBA,MAAM,SAAY,GAAA;AAAA,EAChB,KAAO,EAAA,WAAA;AAAA,EACP,WAAa,EAAA,CAAA,kBAAA,CAAA;AAAA,EACb,IAAM,EAAA;AACR;AAEA,MAAM,SAAY,GAAA;AAAA,EAChB,KAAO,EAAA,iBAAA;AAAA,EACP,WAAa,EAAA,qBAAA;AAAA,EACb,IAAM,EAAA;AACR;AAEA,MAAM,QAAW,GAAA;AAAA,EACf,KAAO,EAAA,UAAA;AAAA,EACP,IAAM,EAAA;AACR,CAAA;AAEA,MAAM,IAAO,GAAA;AAAA,EACX,KAAO,EAAA,MAAA;AAAA,EACP,IAAM,EAAA;AACR,CAAA;AAEA,MAAM,QAAW,GAAA;AAAA,EACf,KAAO,EAAA,UAAA;AAAA,EACP,IAAM,EAAA;AACR,CAAA;AACA,MAAM,MAAS,GAAA;AAAA,EACb,KAAO,EAAA,QAAA;AAAA,EACP,IAAM,EAAA;AACR,CAA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M,EAAA,QAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV;AAAA;AAEJ,CAAA;AAEA,MAAM,gBAAmB,GAAA;AAAA,EACvB,KAAO,EAAA,cAAA;AAAA,EACP,WACE,EAAA,sFAAA;AAAA,EACF,IAAM,EAAA,QAAA;AAAA,EACN,UAAY,EAAA;AAAA,IACV,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA,QAAA;AAAA,MACP,IAAM,EAAA,QAAA;AAAA,MACN,UAAY,EAAA;AAAA,QACV,QAAA;AAAA,QACA,IAAA;AAAA,QACA,QAAA;AAAA,QACA,MAAA;AAAA,QACA,WAAA;AAAA,QACA,kBAAA;AAAA,QACA,MAAA;AAAA,QACA,QAAA;AAAA,QACA;AAAA;AACF,KACF;AAAA,IACA,SAAW,EAAA;AAAA,MACT,KAAO,EAAA,WAAA;AAAA,MACP,IAAM,EAAA,OAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,IAAM,EAAA,QAAA;AAAA,QACN,UAAY,EAAA;AAAA,UACV,GAAA;AAAA,UACA,KAAA;AAAA,UACA;AAAA;AACF;AACF;AACF;AAEJ;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.cjs.js","sources":["../../src/autocomplete/autocomplete.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { InputError } from '@backstage/errors';\nimport { BitbucketCloudClient } from '@backstage/plugin-bitbucket-cloud-common';\n\nexport async function handleAutocompleteRequest({\n resource,\n token,\n context,\n}: {\n resource: string;\n token: string;\n context: Record<string, string>;\n}): Promise<{ results: { title: string }[] }> {\n const client = BitbucketCloudClient.fromConfig({\n host: 'bitbucket.org',\n apiBaseUrl: 'https://api.bitbucket.org/2.0',\n token,\n });\n\n switch (resource) {\n case 'workspaces': {\n const results: { title: string }[] = [];\n\n for await (const page of client.listWorkspaces().iteratePages()) {\n const slugs = [...page.values!].map(p => ({ title: p.slug! }));\n results.push(...slugs);\n }\n\n return { results };\n }\n case 'projects': {\n if (!context.workspace)\n throw new InputError('Missing workspace context parameter');\n\n const results: { title: string }[] = [];\n\n for await (const page of client\n .listProjectsByWorkspace(context.workspace)\n .iteratePages()) {\n const keys = [...page.values!].map(p => ({ title: p.key! }));\n results.push(...keys);\n }\n\n return { results };\n }\n case 'repositories': {\n if (!context.workspace || !context.project)\n throw new InputError(\n 'Missing workspace and/or project context parameter',\n );\n\n const results: { title: string }[] = [];\n\n for await (const page of client\n .listRepositoriesByWorkspace(context.workspace, {\n q: `project.key=\"${context.project}\"`,\n })\n .iteratePages()) {\n const slugs = [...page.values!].map(p => ({ title: p.slug! }));\n results.push(...slugs);\n }\n\n return { results };\n }\n case 'branches': {\n if (!context.workspace || !context.repository)\n throw new InputError(\n 'Missing workspace and/or repository context parameter',\n );\n\n const results: { title: string }[] = [];\n\n for await (const page of client\n .listBranchesByRepository(context.repository, context.workspace)\n .iteratePages()) {\n const names = [...page.values!].map(p => ({ title: p.name! }));\n results.push(...names);\n }\n\n return { results };\n }\n default:\n throw new InputError(`Invalid resource: ${resource}`);\n }\n}\n"],"names":["BitbucketCloudClient","InputError"],"mappings":";;;;;AAmBA,eAAsB,yBAA0B,CAAA;AAAA,EAC9C,QAAA;AAAA,EACA,KAAA;AAAA,EACA
|
|
1
|
+
{"version":3,"file":"autocomplete.cjs.js","sources":["../../src/autocomplete/autocomplete.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { InputError } from '@backstage/errors';\nimport { BitbucketCloudClient } from '@backstage/plugin-bitbucket-cloud-common';\n\nexport async function handleAutocompleteRequest({\n resource,\n token,\n context,\n}: {\n resource: string;\n token: string;\n context: Record<string, string>;\n}): Promise<{ results: { title: string }[] }> {\n const client = BitbucketCloudClient.fromConfig({\n host: 'bitbucket.org',\n apiBaseUrl: 'https://api.bitbucket.org/2.0',\n token,\n });\n\n switch (resource) {\n case 'workspaces': {\n const results: { title: string }[] = [];\n\n for await (const page of client.listWorkspaces().iteratePages()) {\n const slugs = [...page.values!].map(p => ({ title: p.slug! }));\n results.push(...slugs);\n }\n\n return { results };\n }\n case 'projects': {\n if (!context.workspace)\n throw new InputError('Missing workspace context parameter');\n\n const results: { title: string }[] = [];\n\n for await (const page of client\n .listProjectsByWorkspace(context.workspace)\n .iteratePages()) {\n const keys = [...page.values!].map(p => ({ title: p.key! }));\n results.push(...keys);\n }\n\n return { results };\n }\n case 'repositories': {\n if (!context.workspace || !context.project)\n throw new InputError(\n 'Missing workspace and/or project context parameter',\n );\n\n const results: { title: string }[] = [];\n\n for await (const page of client\n .listRepositoriesByWorkspace(context.workspace, {\n q: `project.key=\"${context.project}\"`,\n })\n .iteratePages()) {\n const slugs = [...page.values!].map(p => ({ title: p.slug! }));\n results.push(...slugs);\n }\n\n return { results };\n }\n case 'branches': {\n if (!context.workspace || !context.repository)\n throw new InputError(\n 'Missing workspace and/or repository context parameter',\n );\n\n const results: { title: string }[] = [];\n\n for await (const page of client\n .listBranchesByRepository(context.repository, context.workspace)\n .iteratePages()) {\n const names = [...page.values!].map(p => ({ title: p.name! }));\n results.push(...names);\n }\n\n return { results };\n }\n default:\n throw new InputError(`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,OAAO,EAAE,OAAQ,EAAA;AAAA;AACnB,IACA;AACE,MAAA,MAAM,IAAIA,iBAAA,CAAW,CAAqB,kBAAA,EAAA,QAAQ,CAAE,CAAA,CAAA;AAAA;AAE1D;;;;"}
|
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 {\n scaffolderActionsExtensionPoint,\n scaffolderAutocompleteExtensionPoint,\n} from '@backstage/plugin-scaffolder-node/alpha';\nimport {\n createBitbucketPipelinesRunAction,\n createPublishBitbucketCloudAction,\n createPublishBitbucketCloudPullRequestAction,\n} from './actions';\nimport { ScmIntegrations } from '@backstage/integration';\nimport { handleAutocompleteRequest } from './autocomplete/autocomplete';\n\n/**\n * @public\n * The Bitbucket Cloud Module for the Scaffolder Backend\n */\nexport const bitbucketCloudModule = createBackendModule({\n moduleId: 'bitbucketCloud',\n pluginId: 'scaffolder',\n register({ registerInit }) {\n registerInit({\n deps: {\n scaffolder: scaffolderActionsExtensionPoint,\n autocomplete: scaffolderAutocompleteExtensionPoint,\n config: coreServices.rootConfig,\n },\n async init({ scaffolder, config, autocomplete }) {\n const integrations = ScmIntegrations.fromConfig(config);\n\n scaffolder.addActions(\n createPublishBitbucketCloudAction({ integrations, config }),\n createBitbucketPipelinesRunAction({ integrations }),\n createPublishBitbucketCloudPullRequestAction({\n integrations,\n config,\n }),\n );\n\n autocomplete.addAutocompleteProvider({\n id: 'bitbucket-cloud',\n handler: handleAutocompleteRequest,\n });\n },\n });\n },\n});\n"],"names":["createBackendModule","scaffolderActionsExtensionPoint","scaffolderAutocompleteExtensionPoint","coreServices","autocomplete","ScmIntegrations","createPublishBitbucketCloudAction","createBitbucketPipelinesRunAction","createPublishBitbucketCloudPullRequestAction","handleAutocompleteRequest"],"mappings":";;;;;;;;;;AAmCO,MAAM,uBAAuBA,oCAAoB,CAAA;AAAA,EACtD,QAAU,EAAA,gBAAA;AAAA,EACV,QAAU,EAAA,YAAA;AAAA,EACV,QAAA,CAAS,EAAE,YAAA,EAAgB,EAAA;AACzB,IAAa,YAAA,CAAA;AAAA,MACX,IAAM,EAAA;AAAA,QACJ,UAAY,EAAAC,qCAAA;AAAA,QACZ,YAAc,EAAAC,0CAAA;AAAA,QACd,QAAQC,6BAAa,CAAA
|
|
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 {\n scaffolderActionsExtensionPoint,\n scaffolderAutocompleteExtensionPoint,\n} from '@backstage/plugin-scaffolder-node/alpha';\nimport {\n createBitbucketPipelinesRunAction,\n createPublishBitbucketCloudAction,\n createPublishBitbucketCloudPullRequestAction,\n} from './actions';\nimport { ScmIntegrations } from '@backstage/integration';\nimport { handleAutocompleteRequest } from './autocomplete/autocomplete';\n\n/**\n * @public\n * The Bitbucket Cloud Module for the Scaffolder Backend\n */\nexport const bitbucketCloudModule = createBackendModule({\n moduleId: 'bitbucketCloud',\n pluginId: 'scaffolder',\n register({ registerInit }) {\n registerInit({\n deps: {\n scaffolder: scaffolderActionsExtensionPoint,\n autocomplete: scaffolderAutocompleteExtensionPoint,\n config: coreServices.rootConfig,\n },\n async init({ scaffolder, config, autocomplete }) {\n const integrations = ScmIntegrations.fromConfig(config);\n\n scaffolder.addActions(\n createPublishBitbucketCloudAction({ integrations, config }),\n createBitbucketPipelinesRunAction({ integrations }),\n createPublishBitbucketCloudPullRequestAction({\n integrations,\n config,\n }),\n );\n\n autocomplete.addAutocompleteProvider({\n id: 'bitbucket-cloud',\n handler: handleAutocompleteRequest,\n });\n },\n });\n },\n});\n"],"names":["createBackendModule","scaffolderActionsExtensionPoint","scaffolderAutocompleteExtensionPoint","coreServices","autocomplete","ScmIntegrations","createPublishBitbucketCloudAction","createBitbucketPipelinesRunAction","createPublishBitbucketCloudPullRequestAction","handleAutocompleteRequest"],"mappings":";;;;;;;;;;AAmCO,MAAM,uBAAuBA,oCAAoB,CAAA;AAAA,EACtD,QAAU,EAAA,gBAAA;AAAA,EACV,QAAU,EAAA,YAAA;AAAA,EACV,QAAA,CAAS,EAAE,YAAA,EAAgB,EAAA;AACzB,IAAa,YAAA,CAAA;AAAA,MACX,IAAM,EAAA;AAAA,QACJ,UAAY,EAAAC,qCAAA;AAAA,QACZ,YAAc,EAAAC,0CAAA;AAAA,QACd,QAAQC,6BAAa,CAAA;AAAA,OACvB;AAAA,MACA,MAAM,IAAK,CAAA,EAAE,UAAY,EAAA,MAAA,gBAAQC,gBAAgB,EAAA;AAC/C,QAAM,MAAA,YAAA,GAAeC,2BAAgB,CAAA,UAAA,CAAW,MAAM,CAAA;AAEtD,QAAW,UAAA,CAAA,UAAA;AAAA,UACTC,gDAAkC,CAAA,EAAE,YAAc,EAAA,MAAA,EAAQ,CAAA;AAAA,UAC1DC,4DAAA,CAAkC,EAAE,YAAA,EAAc,CAAA;AAAA,UAClDC,sEAA6C,CAAA;AAAA,YAC3C,YAAA;AAAA,YACA;AAAA,WACD;AAAA,SACH;AAEA,QAAAJ,cAAA,CAAa,uBAAwB,CAAA;AAAA,UACnC,EAAI,EAAA,iBAAA;AAAA,UACJ,OAAS,EAAAK;AAAA,SACV,CAAA;AAAA;AACH,KACD,CAAA;AAAA;AAEL,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-scaffolder-backend-module-bitbucket-cloud",
|
|
3
|
-
"version": "0.2.2-next.
|
|
3
|
+
"version": "0.2.2-next.2",
|
|
4
4
|
"description": "The Bitbucket Cloud module for @backstage/plugin-scaffolder-backend",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin-module",
|
|
@@ -40,20 +40,20 @@
|
|
|
40
40
|
"test": "backstage-cli package test"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@backstage/backend-plugin-api": "1.0.2-next.
|
|
43
|
+
"@backstage/backend-plugin-api": "1.0.2-next.2",
|
|
44
44
|
"@backstage/config": "1.2.0",
|
|
45
45
|
"@backstage/errors": "1.2.4",
|
|
46
46
|
"@backstage/integration": "1.15.1",
|
|
47
47
|
"@backstage/plugin-bitbucket-cloud-common": "0.2.24",
|
|
48
|
-
"@backstage/plugin-scaffolder-node": "0.5.1-next.
|
|
48
|
+
"@backstage/plugin-scaffolder-node": "0.5.1-next.2",
|
|
49
49
|
"fs-extra": "^11.2.0",
|
|
50
50
|
"node-fetch": "^2.7.0",
|
|
51
51
|
"yaml": "^2.0.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@backstage/backend-test-utils": "1.0
|
|
55
|
-
"@backstage/cli": "0.29.0-next.
|
|
56
|
-
"@backstage/plugin-scaffolder-node-test-utils": "0.1.15-next.
|
|
54
|
+
"@backstage/backend-test-utils": "1.1.0-next.2",
|
|
55
|
+
"@backstage/cli": "0.29.0-next.2",
|
|
56
|
+
"@backstage/plugin-scaffolder-node-test-utils": "0.1.15-next.2",
|
|
57
57
|
"msw": "^1.0.0"
|
|
58
58
|
}
|
|
59
59
|
}
|