@backstage/plugin-scaffolder-backend-module-azure 0.2.11 → 0.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @backstage/plugin-scaffolder-backend-module-azure
2
2
 
3
+ ## 0.2.12
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/plugin-scaffolder-node@0.11.0
9
+ - @backstage/backend-plugin-api@1.4.2
10
+
11
+ ## 0.2.12-next.0
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+ - @backstage/plugin-scaffolder-node@0.11.0-next.0
17
+ - @backstage/backend-plugin-api@1.4.2-next.0
18
+ - @backstage/config@1.3.3
19
+ - @backstage/errors@1.2.7
20
+ - @backstage/integration@1.17.1
21
+
3
22
  ## 0.2.11
4
23
 
5
24
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"azure.cjs.js","sources":["../../src/actions/azure.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 {\n DefaultAzureDevOpsCredentialsProvider,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport {\n createTemplateAction,\n getRepoSourceDirectory,\n initRepoAndPush,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { GitRepositoryCreateOptions } from 'azure-devops-node-api/interfaces/GitInterfaces';\nimport {\n getBearerHandler,\n getPersonalAccessTokenHandler,\n WebApi,\n} from 'azure-devops-node-api';\nimport { Config } from '@backstage/config';\nimport { examples } from './azure.examples';\n\n/**\n * Creates a new action that initializes a git repository of the content in the workspace\n * and publishes it to Azure.\n * @public\n */\nexport function createPublishAzureAction(options: {\n integrations: ScmIntegrationRegistry;\n config: Config;\n}) {\n const { integrations, config } = options;\n\n return createTemplateAction({\n id: 'publish:azure',\n examples,\n description:\n 'Initializes a git repository of the content in the workspace, and publishes it to Azure.',\n schema: {\n input: {\n repoUrl: z =>\n z.string({\n description: 'Repository Location',\n }),\n description: z =>\n z\n .string({\n description: 'Repository Description',\n })\n .optional(),\n defaultBranch: z =>\n z\n .string({\n description: `Sets the default branch on the repository. The default value is 'master'`,\n })\n .optional(),\n sourcePath: z =>\n z\n .string({\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 })\n .optional(),\n token: z =>\n z\n .string({\n description: 'The token to use for authorization to Azure',\n })\n .optional(),\n gitCommitMessage: z =>\n z\n .string({\n description: `Sets the commit message on the repository. The default value is 'initial commit'`,\n })\n .optional(),\n gitAuthorName: z =>\n z\n .string({\n description: `Sets the default author name for the commit. The default value is 'Scaffolder'`,\n })\n .optional(),\n gitAuthorEmail: z =>\n z\n .string({\n description: `Sets the default author email for the commit.`,\n })\n .optional(),\n signCommit: z =>\n z\n .boolean({\n description: 'Sign commit with configured PGP private key',\n })\n .optional(),\n },\n output: {\n remoteUrl: z =>\n z\n .string({\n description: 'A URL to the repository with the provider',\n })\n .optional(),\n repoContentsUrl: z =>\n z\n .string({\n description: 'A URL to the root of the repository',\n })\n .optional(),\n repositoryId: z =>\n z\n .string({\n description: 'The Id of the created repository',\n })\n .optional(),\n commitHash: z =>\n z\n .string({\n description: 'The git commit hash of the initial commit',\n })\n .optional(),\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n defaultBranch = 'master',\n gitCommitMessage = 'initial commit',\n gitAuthorName,\n gitAuthorEmail,\n signCommit,\n } = ctx.input;\n\n const { project, repo, host, organization } = parseRepoUrl(\n repoUrl,\n integrations,\n );\n\n if (!organization) {\n throw new InputError(\n `Invalid URL provider was included in the repo URL to create ${ctx.input.repoUrl}, missing organization`,\n );\n }\n\n const url = `https://${host}/${organization}`;\n const credentialProvider =\n DefaultAzureDevOpsCredentialsProvider.fromIntegrations(integrations);\n const credentials = await credentialProvider.getCredentials({ url: url });\n const integrationConfig = integrations.azure.byHost(host);\n\n if (credentials === undefined && ctx.input.token === undefined) {\n throw new InputError(\n `No credentials provided ${url}, please check your integrations config`,\n );\n }\n\n const authHandler =\n ctx.input.token || credentials?.type === 'pat'\n ? getPersonalAccessTokenHandler(ctx.input.token ?? credentials!.token)\n : getBearerHandler(credentials!.token);\n\n const webApi = new WebApi(url, authHandler);\n const client = await webApi.getGitApi();\n const createOptions: GitRepositoryCreateOptions = { name: repo };\n\n const { remoteUrl, repositoryId, repoContentsUrl } = await ctx.checkpoint(\n {\n key: `create.repo.${repo}`,\n fn: async () => {\n const returnedRepo = await client.createRepository(\n createOptions,\n project,\n );\n\n if (!returnedRepo) {\n throw new InputError(\n `Unable to create the repository with Organization ${organization}, Project ${project} and Repo ${repo}.\n Please make sure that both the Org and Project are typed corrected and exist.`,\n );\n }\n\n if (!returnedRepo.remoteUrl) {\n throw new InputError(\n 'No remote URL returned from create repository for Azure',\n );\n }\n\n if (!returnedRepo.id) {\n throw new InputError(\n 'No Id returned from create repository for Azure',\n );\n }\n\n if (!returnedRepo.webUrl) {\n throw new InputError(\n 'No web URL returned from create repository for Azure',\n );\n }\n\n return {\n remoteUrl: returnedRepo.remoteUrl,\n repositoryId: returnedRepo.id,\n repoContentsUrl: returnedRepo.webUrl,\n };\n },\n },\n );\n\n const gitAuthorInfo = {\n name: gitAuthorName\n ? gitAuthorName\n : config.getOptionalString('scaffolder.defaultAuthor.name'),\n email: gitAuthorEmail\n ? gitAuthorEmail\n : config.getOptionalString('scaffolder.defaultAuthor.email'),\n };\n\n const auth = {\n username: 'notempty',\n password: ctx.input.token ?? credentials!.token,\n };\n\n const signingKey =\n integrationConfig?.config.commitSigningKey ??\n config.getOptionalString('scaffolder.defaultCommitSigningKey');\n if (signCommit && !signingKey) {\n throw new Error(\n 'Signing commits is enabled but no signing key is provided in the configuration',\n );\n }\n\n const commitHash = await ctx.checkpoint({\n key: `init.repo.and.push.${remoteUrl}`,\n fn: async () => {\n const commitResult = await initRepoAndPush({\n dir: getRepoSourceDirectory(\n ctx.workspacePath,\n ctx.input.sourcePath,\n ),\n remoteUrl,\n defaultBranch,\n auth: auth,\n logger: ctx.logger,\n commitMessage: gitCommitMessage\n ? gitCommitMessage\n : config.getOptionalString('scaffolder.defaultCommitMessage'),\n gitAuthorInfo,\n signingKey: signCommit ? signingKey : undefined,\n });\n\n return commitResult?.commitHash;\n },\n });\n\n ctx.output('commitHash', commitHash);\n ctx.output('remoteUrl', remoteUrl);\n ctx.output('repoContentsUrl', repoContentsUrl);\n ctx.output('repositoryId', repositoryId);\n },\n });\n}\n"],"names":["createTemplateAction","examples","parseRepoUrl","InputError","DefaultAzureDevOpsCredentialsProvider","getPersonalAccessTokenHandler","getBearerHandler","WebApi","initRepoAndPush","getRepoSourceDirectory"],"mappings":";;;;;;;;AAyCO,SAAS,yBAAyB,OAGtC,EAAA;AACD,EAAM,MAAA,EAAE,YAAc,EAAA,MAAA,EAAW,GAAA,OAAA;AAEjC,EAAA,OAAOA,yCAAqB,CAAA;AAAA,IAC1B,EAAI,EAAA,eAAA;AAAA,cACJC,uBAAA;AAAA,IACA,WACE,EAAA,0FAAA;AAAA,IACF,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,OAAA,EAAS,CACP,CAAA,KAAA,CAAA,CAAE,MAAO,CAAA;AAAA,UACP,WAAa,EAAA;AAAA,SACd,CAAA;AAAA,QACH,WAAA,EAAa,CACX,CAAA,KAAA,CAAA,CACG,MAAO,CAAA;AAAA,UACN,WAAa,EAAA;AAAA,SACd,EACA,QAAS,EAAA;AAAA,QACd,aAAA,EAAe,CACb,CAAA,KAAA,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AAe,CAAA;AAC7C,MAAI,GAAA,CAAA,MAAA,CAAO,gBAAgB,YAAY,CAAA;AAAA;AACzC,GACD,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"azure.cjs.js","sources":["../../src/actions/azure.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 {\n DefaultAzureDevOpsCredentialsProvider,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport {\n createTemplateAction,\n getRepoSourceDirectory,\n initRepoAndPush,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { GitRepositoryCreateOptions } from 'azure-devops-node-api/interfaces/GitInterfaces';\nimport {\n getBearerHandler,\n getPersonalAccessTokenHandler,\n WebApi,\n} from 'azure-devops-node-api';\nimport { Config } from '@backstage/config';\nimport { examples } from './azure.examples';\n\n/**\n * Creates a new action that initializes a git repository of the content in the workspace\n * and publishes it to Azure.\n * @public\n */\nexport function createPublishAzureAction(options: {\n integrations: ScmIntegrationRegistry;\n config: Config;\n}) {\n const { integrations, config } = options;\n\n return createTemplateAction({\n id: 'publish:azure',\n examples,\n description:\n 'Initializes a git repository of the content in the workspace, and publishes it to Azure.',\n schema: {\n input: {\n repoUrl: z =>\n z.string({\n description: 'Repository Location',\n }),\n description: z =>\n z\n .string({\n description: 'Repository Description',\n })\n .optional(),\n defaultBranch: z =>\n z\n .string({\n description: `Sets the default branch on the repository. The default value is 'master'`,\n })\n .optional(),\n sourcePath: z =>\n z\n .string({\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 })\n .optional(),\n token: z =>\n z\n .string({\n description: 'The token to use for authorization to Azure',\n })\n .optional(),\n gitCommitMessage: z =>\n z\n .string({\n description: `Sets the commit message on the repository. The default value is 'initial commit'`,\n })\n .optional(),\n gitAuthorName: z =>\n z\n .string({\n description: `Sets the default author name for the commit. The default value is 'Scaffolder'`,\n })\n .optional(),\n gitAuthorEmail: z =>\n z\n .string({\n description: `Sets the default author email for the commit.`,\n })\n .optional(),\n signCommit: z =>\n z\n .boolean({\n description: 'Sign commit with configured PGP private key',\n })\n .optional(),\n },\n output: {\n remoteUrl: z =>\n z\n .string({\n description: 'A URL to the repository with the provider',\n })\n .optional(),\n repoContentsUrl: z =>\n z\n .string({\n description: 'A URL to the root of the repository',\n })\n .optional(),\n repositoryId: z =>\n z\n .string({\n description: 'The Id of the created repository',\n })\n .optional(),\n commitHash: z =>\n z\n .string({\n description: 'The git commit hash of the initial commit',\n })\n .optional(),\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n defaultBranch = 'master',\n gitCommitMessage = 'initial commit',\n gitAuthorName,\n gitAuthorEmail,\n signCommit,\n } = ctx.input;\n\n const { project, repo, host, organization } = parseRepoUrl(\n repoUrl,\n integrations,\n );\n\n if (!organization) {\n throw new InputError(\n `Invalid URL provider was included in the repo URL to create ${ctx.input.repoUrl}, missing organization`,\n );\n }\n\n const url = `https://${host}/${organization}`;\n const credentialProvider =\n DefaultAzureDevOpsCredentialsProvider.fromIntegrations(integrations);\n const credentials = await credentialProvider.getCredentials({ url: url });\n const integrationConfig = integrations.azure.byHost(host);\n\n if (credentials === undefined && ctx.input.token === undefined) {\n throw new InputError(\n `No credentials provided ${url}, please check your integrations config`,\n );\n }\n\n const authHandler =\n ctx.input.token || credentials?.type === 'pat'\n ? getPersonalAccessTokenHandler(ctx.input.token ?? credentials!.token)\n : getBearerHandler(credentials!.token);\n\n const webApi = new WebApi(url, authHandler);\n const client = await webApi.getGitApi();\n const createOptions: GitRepositoryCreateOptions = { name: repo };\n\n const { remoteUrl, repositoryId, repoContentsUrl } = await ctx.checkpoint(\n {\n key: `create.repo.${repo}`,\n fn: async () => {\n const returnedRepo = await client.createRepository(\n createOptions,\n project,\n );\n\n if (!returnedRepo) {\n throw new InputError(\n `Unable to create the repository with Organization ${organization}, Project ${project} and Repo ${repo}.\n Please make sure that both the Org and Project are typed corrected and exist.`,\n );\n }\n\n if (!returnedRepo.remoteUrl) {\n throw new InputError(\n 'No remote URL returned from create repository for Azure',\n );\n }\n\n if (!returnedRepo.id) {\n throw new InputError(\n 'No Id returned from create repository for Azure',\n );\n }\n\n if (!returnedRepo.webUrl) {\n throw new InputError(\n 'No web URL returned from create repository for Azure',\n );\n }\n\n return {\n remoteUrl: returnedRepo.remoteUrl,\n repositoryId: returnedRepo.id,\n repoContentsUrl: returnedRepo.webUrl,\n };\n },\n },\n );\n\n const gitAuthorInfo = {\n name: gitAuthorName\n ? gitAuthorName\n : config.getOptionalString('scaffolder.defaultAuthor.name'),\n email: gitAuthorEmail\n ? gitAuthorEmail\n : config.getOptionalString('scaffolder.defaultAuthor.email'),\n };\n\n const auth = {\n username: 'notempty',\n password: ctx.input.token ?? credentials!.token,\n };\n\n const signingKey =\n integrationConfig?.config.commitSigningKey ??\n config.getOptionalString('scaffolder.defaultCommitSigningKey');\n if (signCommit && !signingKey) {\n throw new Error(\n 'Signing commits is enabled but no signing key is provided in the configuration',\n );\n }\n\n const commitHash = await ctx.checkpoint({\n key: `init.repo.and.push.${remoteUrl}`,\n fn: async () => {\n const commitResult = await initRepoAndPush({\n dir: getRepoSourceDirectory(\n ctx.workspacePath,\n ctx.input.sourcePath,\n ),\n remoteUrl,\n defaultBranch,\n auth: auth,\n logger: ctx.logger,\n commitMessage: gitCommitMessage\n ? gitCommitMessage\n : config.getOptionalString('scaffolder.defaultCommitMessage'),\n gitAuthorInfo,\n signingKey: signCommit ? signingKey : undefined,\n });\n\n return commitResult?.commitHash;\n },\n });\n\n ctx.output('commitHash', commitHash);\n ctx.output('remoteUrl', remoteUrl);\n ctx.output('repoContentsUrl', repoContentsUrl);\n ctx.output('repositoryId', repositoryId);\n },\n });\n}\n"],"names":["createTemplateAction","examples","parseRepoUrl","InputError","DefaultAzureDevOpsCredentialsProvider","getPersonalAccessTokenHandler","getBearerHandler","WebApi","initRepoAndPush","getRepoSourceDirectory"],"mappings":";;;;;;;;AAyCO,SAAS,yBAAyB,OAAA,EAGtC;AACD,EAAA,MAAM,EAAE,YAAA,EAAc,MAAA,EAAO,GAAI,OAAA;AAEjC,EAAA,OAAOA,yCAAA,CAAqB;AAAA,IAC1B,EAAA,EAAI,eAAA;AAAA,cACJC,uBAAA;AAAA,IACA,WAAA,EACE,0FAAA;AAAA,IACF,MAAA,EAAQ;AAAA,MACN,KAAA,EAAO;AAAA,QACL,OAAA,EAAS,CAAA,CAAA,KACP,CAAA,CAAE,MAAA,CAAO;AAAA,UACP,WAAA,EAAa;AAAA,SACd,CAAA;AAAA,QACH,WAAA,EAAa,CAAA,CAAA,KACX,CAAA,CACG,MAAA,CAAO;AAAA,UACN,WAAA,EAAa;AAAA,SACd,EACA,QAAA,EAAS;AAAA,QACd,aAAA,EAAe,CAAA,CAAA,KACb,CAAA,CACG,MAAA,CAAO;AAAA,UACN,WAAA,EAAa,CAAA,wEAAA;AAAA,SACd,EACA,QAAA,EAAS;AAAA,QACd,UAAA,EAAY,CAAA,CAAA,KACV,CAAA,CACG,MAAA,CAAO;AAAA,UACN,WAAA,EACE;AAAA,SACH,EACA,QAAA,EAAS;AAAA,QACd,KAAA,EAAO,CAAA,CAAA,KACL,CAAA,CACG,MAAA,CAAO;AAAA,UACN,WAAA,EAAa;AAAA,SACd,EACA,QAAA,EAAS;AAAA,QACd,gBAAA,EAAkB,CAAA,CAAA,KAChB,CAAA,CACG,MAAA,CAAO;AAAA,UACN,WAAA,EAAa,CAAA,gFAAA;AAAA,SACd,EACA,QAAA,EAAS;AAAA,QACd,aAAA,EAAe,CAAA,CAAA,KACb,CAAA,CACG,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F;AAAA,MACF;AAEA,MAAA,MAAM,UAAA,GAAa,MAAM,GAAA,CAAI,UAAA,CAAW;AAAA,QACtC,GAAA,EAAK,sBAAsB,SAAS,CAAA,CAAA;AAAA,QACpC,IAAI,YAAY;AACd,UAAA,MAAM,YAAA,GAAe,MAAMK,oCAAA,CAAgB;AAAA,YACzC,GAAA,EAAKC,2CAAA;AAAA,cACH,GAAA,CAAI,aAAA;AAAA,cACJ,IAAI,KAAA,CAAM;AAAA,aACZ;AAAA,YACA,SAAA;AAAA,YACA,aAAA;AAAA,YACA,IAAA;AAAA,YACA,QAAQ,GAAA,CAAI,MAAA;AAAA,YACZ,aAAA,EAAe,gBAAA,GACX,gBAAA,GACA,MAAA,CAAO,kBAAkB,iCAAiC,CAAA;AAAA,YAC9D,aAAA;AAAA,YACA,UAAA,EAAY,aAAa,UAAA,GAAa;AAAA,WACvC,CAAA;AAED,UAAA,OAAO,YAAA,EAAc,UAAA;AAAA,QACvB;AAAA,OACD,CAAA;AAED,MAAA,GAAA,CAAI,MAAA,CAAO,cAAc,UAAU,CAAA;AACnC,MAAA,GAAA,CAAI,MAAA,CAAO,aAAa,SAAS,CAAA;AACjC,MAAA,GAAA,CAAI,MAAA,CAAO,mBAAmB,eAAe,CAAA;AAC7C,MAAA,GAAA,CAAI,MAAA,CAAO,gBAAgB,YAAY,CAAA;AAAA,IACzC;AAAA,GACD,CAAA;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"azure.examples.cjs.js","sources":["../../src/actions/azure.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 Azure DevOps with the default configuration.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:azure',\n name: 'Publish to Azure',\n input: {\n repoUrl:\n 'dev.azure.com?organization=organization&project=project&repo=repo',\n },\n },\n ],\n }),\n },\n {\n description: 'Initializes an Azure DevOps repository with a description.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:azure',\n name: 'Publish to Azure',\n input: {\n repoUrl:\n 'dev.azure.com?organization=organization&project=project&repo=repo',\n description: 'Initialize a git repository',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes an Azure DevOps repository with a default branch, if not set defaults to master',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:azure',\n name: 'Publish to Azure',\n input: {\n repoUrl:\n 'dev.azure.com?organization=organization&project=project&repo=repo',\n defaultBranch: 'main',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes an Azure DevOps repository with a custom commit message',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:azure',\n name: 'Publish to Azure',\n input: {\n repoUrl:\n 'dev.azure.com?organization=organization&project=project&repo=repo',\n gitCommitMessage: 'Initial setup and configuration',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes an Azure DevOps repository with a custom author name and email',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:azure',\n name: 'Publish to Azure',\n input: {\n repoUrl:\n 'dev.azure.com?organization=organization&project=project&repo=repo',\n gitAuthorName: 'John Doe',\n gitAuthorEmail: 'john.doe@example.com',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes an Azure DevOps repository using a specific source path',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:azure',\n name: 'Publish to Azure',\n input: {\n repoUrl:\n 'dev.azure.com?organization=organization&project=project&repo=repo',\n sourcePath: 'path/to/source',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes an Azure DevOps repository using an authentication token',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:azure',\n name: 'Publish to Azure',\n input: {\n repoUrl:\n 'dev.azure.com?organization=organization&project=project&repo=repo',\n token: 'personal-access-token',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes an Azure DevOps repository using an custom repo url',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:azure',\n name: 'Publish to Azure',\n input: {\n repoUrl:\n 'test.azure.com?organization=organization&project=project&repo=repo',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WACE,EAAA,kIAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,SAAA;AAAA,UACJ,MAAQ,EAAA,eAAA;AAAA,UACR,IAAM,EAAA,kBAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OACE,EAAA;AAAA;AACJ;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,4DAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,SAAA;AAAA,UACJ,MAAQ,EAAA,eAAA;AAAA,UACR,IAAM,EAAA,kBAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OACE,EAAA,mEAAA;AAAA,YACF,WAAa,EAAA;AAAA;AACf;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WACE,EAAA,6FAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE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AAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,SAAA;AAAA,UACJ,MAAQ,EAAA,eAAA;AAAA,UACR,IAAM,EAAA,kBAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OACE,EAAA,mEAAA;AAAA,YACF,KAAO,EAAA;AAAA;AACT;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WACE,EAAA,iEAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,SAAA;AAAA,UACJ,MAAQ,EAAA,eAAA;AAAA,UACR,IAAM,EAAA,kBAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OACE,EAAA;AAAA;AACJ;AACF;AACF,KACD;AAAA;AAEL;;;;"}
1
+ {"version":3,"file":"azure.examples.cjs.js","sources":["../../src/actions/azure.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 Azure DevOps with the default configuration.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:azure',\n name: 'Publish to Azure',\n input: {\n repoUrl:\n 'dev.azure.com?organization=organization&project=project&repo=repo',\n },\n },\n ],\n }),\n },\n {\n description: 'Initializes an Azure DevOps repository with a description.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:azure',\n name: 'Publish to Azure',\n input: {\n repoUrl:\n 'dev.azure.com?organization=organization&project=project&repo=repo',\n description: 'Initialize a git repository',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes an Azure DevOps repository with a default branch, if not set defaults to master',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:azure',\n name: 'Publish to Azure',\n input: {\n repoUrl:\n 'dev.azure.com?organization=organization&project=project&repo=repo',\n defaultBranch: 'main',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes an Azure DevOps repository with a custom commit message',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:azure',\n name: 'Publish to Azure',\n input: {\n repoUrl:\n 'dev.azure.com?organization=organization&project=project&repo=repo',\n gitCommitMessage: 'Initial setup and configuration',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes an Azure DevOps repository with a custom author name and email',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:azure',\n name: 'Publish to Azure',\n input: {\n repoUrl:\n 'dev.azure.com?organization=organization&project=project&repo=repo',\n gitAuthorName: 'John Doe',\n gitAuthorEmail: 'john.doe@example.com',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes an Azure DevOps repository using a specific source path',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:azure',\n name: 'Publish to Azure',\n input: {\n repoUrl:\n 'dev.azure.com?organization=organization&project=project&repo=repo',\n sourcePath: 'path/to/source',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes an Azure DevOps repository using an authentication token',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:azure',\n name: 'Publish to Azure',\n input: {\n repoUrl:\n 'dev.azure.com?organization=organization&project=project&repo=repo',\n token: 'personal-access-token',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes an Azure DevOps repository using an custom repo url',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:azure',\n name: 'Publish to Azure',\n input: {\n repoUrl:\n 'test.azure.com?organization=organization&project=project&repo=repo',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAmBO,MAAM,QAAA,GAA8B;AAAA,EACzC;AAAA,IACE,WAAA,EACE,kIAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,EAAA,EAAI,SAAA;AAAA,UACJ,MAAA,EAAQ,eAAA;AAAA,UACR,IAAA,EAAM,kBAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EACE;AAAA;AACJ;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EAAa,4DAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,EAAA,EAAI,SAAA;AAAA,UACJ,MAAA,EAAQ,eAAA;AAAA,UACR,IAAA,EAAM,kBAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EACE,mEAAA;AAAA,YACF,WAAA,EAAa;AAAA;AACf;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EACE,6FAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,EAAA,EAAI,SAAA;AAAA,UACJ,MAAA,EAAQ,eAAA;AAAA,UACR,IAAA,EAAM,kBAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EACE,mEAAA;AAAA,YACF,aAAA,EAAe;AAAA;AACjB;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EACE,qEAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,EAAA,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A,sBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,EAAA,EAAI,SAAA;AAAA,UACJ,MAAA,EAAQ,eAAA;AAAA,UACR,IAAA,EAAM,kBAAA;AAAA,UACN,KAAA,EAAO;AAAA,YACL,OAAA,EACE;AAAA;AACJ;AACF;AACF,KACD;AAAA;AAEL;;;;"}
@@ -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 createBackendModule,\n coreServices,\n} from '@backstage/backend-plugin-api';\nimport { ScmIntegrations } from '@backstage/integration';\nimport { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';\nimport { createPublishAzureAction } from './actions';\n\n/**\n * @public\n * The Azure Module for the Scaffolder Backend\n */\nexport const azureModule = createBackendModule({\n moduleId: 'azure',\n pluginId: 'scaffolder',\n register({ registerInit }) {\n registerInit({\n deps: {\n scaffolderActions: scaffolderActionsExtensionPoint,\n config: coreServices.rootConfig,\n },\n async init({ scaffolderActions, config }) {\n const integrations = ScmIntegrations.fromConfig(config);\n scaffolderActions.addActions(\n createPublishAzureAction({\n integrations,\n config,\n }),\n );\n },\n });\n },\n});\n"],"names":["createBackendModule","scaffolderActionsExtensionPoint","coreServices","ScmIntegrations","createPublishAzureAction"],"mappings":";;;;;;;AA2BO,MAAM,cAAcA,oCAAoB,CAAA;AAAA,EAC7C,QAAU,EAAA,OAAA;AAAA,EACV,QAAU,EAAA,YAAA;AAAA,EACV,QAAA,CAAS,EAAE,YAAA,EAAgB,EAAA;AACzB,IAAa,YAAA,CAAA;AAAA,MACX,IAAM,EAAA;AAAA,QACJ,iBAAmB,EAAAC,qCAAA;AAAA,QACnB,QAAQC,6BAAa,CAAA;AAAA,OACvB;AAAA,MACA,MAAM,IAAA,CAAK,EAAE,iBAAA,EAAmB,QAAU,EAAA;AACxC,QAAM,MAAA,YAAA,GAAeC,2BAAgB,CAAA,UAAA,CAAW,MAAM,CAAA;AACtD,QAAkB,iBAAA,CAAA,UAAA;AAAA,UAChBC,8BAAyB,CAAA;AAAA,YACvB,YAAA;AAAA,YACA;AAAA,WACD;AAAA,SACH;AAAA;AACF,KACD,CAAA;AAAA;AAEL,CAAC;;;;"}
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 createBackendModule,\n coreServices,\n} from '@backstage/backend-plugin-api';\nimport { ScmIntegrations } from '@backstage/integration';\nimport { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';\nimport { createPublishAzureAction } from './actions';\n\n/**\n * @public\n * The Azure Module for the Scaffolder Backend\n */\nexport const azureModule = createBackendModule({\n moduleId: 'azure',\n pluginId: 'scaffolder',\n register({ registerInit }) {\n registerInit({\n deps: {\n scaffolderActions: scaffolderActionsExtensionPoint,\n config: coreServices.rootConfig,\n },\n async init({ scaffolderActions, config }) {\n const integrations = ScmIntegrations.fromConfig(config);\n scaffolderActions.addActions(\n createPublishAzureAction({\n integrations,\n config,\n }),\n );\n },\n });\n },\n});\n"],"names":["createBackendModule","scaffolderActionsExtensionPoint","coreServices","ScmIntegrations","createPublishAzureAction"],"mappings":";;;;;;;AA2BO,MAAM,cAAcA,oCAAA,CAAoB;AAAA,EAC7C,QAAA,EAAU,OAAA;AAAA,EACV,QAAA,EAAU,YAAA;AAAA,EACV,QAAA,CAAS,EAAE,YAAA,EAAa,EAAG;AACzB,IAAA,YAAA,CAAa;AAAA,MACX,IAAA,EAAM;AAAA,QACJ,iBAAA,EAAmBC,qCAAA;AAAA,QACnB,QAAQC,6BAAA,CAAa;AAAA,OACvB;AAAA,MACA,MAAM,IAAA,CAAK,EAAE,iBAAA,EAAmB,QAAO,EAAG;AACxC,QAAA,MAAM,YAAA,GAAeC,2BAAA,CAAgB,UAAA,CAAW,MAAM,CAAA;AACtD,QAAA,iBAAA,CAAkB,UAAA;AAAA,UAChBC,8BAAA,CAAyB;AAAA,YACvB,YAAA;AAAA,YACA;AAAA,WACD;AAAA,SACH;AAAA,MACF;AAAA,KACD,CAAA;AAAA,EACH;AACF,CAAC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-backend-module-azure",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "The azure module for @backstage/plugin-scaffolder-backend",
5
5
  "backstage": {
6
6
  "role": "backend-plugin-module",
@@ -50,16 +50,16 @@
50
50
  "test": "backstage-cli package test"
51
51
  },
52
52
  "dependencies": {
53
- "@backstage/backend-plugin-api": "^1.4.1",
53
+ "@backstage/backend-plugin-api": "^1.4.2",
54
54
  "@backstage/config": "^1.3.3",
55
55
  "@backstage/errors": "^1.2.7",
56
56
  "@backstage/integration": "^1.17.1",
57
- "@backstage/plugin-scaffolder-node": "^0.10.0",
57
+ "@backstage/plugin-scaffolder-node": "^0.11.0",
58
58
  "azure-devops-node-api": "^14.0.0",
59
59
  "yaml": "^2.0.0"
60
60
  },
61
61
  "devDependencies": {
62
- "@backstage/cli": "^0.33.1",
63
- "@backstage/plugin-scaffolder-node-test-utils": "^0.3.1"
62
+ "@backstage/cli": "^0.34.0",
63
+ "@backstage/plugin-scaffolder-node-test-utils": "^0.3.2"
64
64
  }
65
65
  }