chore: migrate the bitbucket actions
Signed-off-by: benjdlambert <ben@blam.sh>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-scaffolder-backend-module-bitbucket': patch
|
||||
---
|
||||
|
||||
Migrating `bitbucket` actions to use the new `zod` format
|
||||
@@ -7,7 +7,6 @@ import { BackendFeature } from '@backstage/backend-plugin-api';
|
||||
import * as bitbucketCloud from '@backstage/plugin-scaffolder-backend-module-bitbucket-cloud';
|
||||
import * as bitbucketServer from '@backstage/plugin-scaffolder-backend-module-bitbucket-server';
|
||||
import { Config } from '@backstage/config';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { ScmIntegrationRegistry } from '@backstage/integration';
|
||||
import { TemplateAction } from '@backstage/plugin-scaffolder-node';
|
||||
|
||||
@@ -40,19 +39,23 @@ export function createPublishBitbucketAction(options: {
|
||||
}): TemplateAction<
|
||||
{
|
||||
repoUrl: string;
|
||||
description?: string;
|
||||
defaultBranch?: string;
|
||||
repoVisibility?: 'private' | 'public';
|
||||
sourcePath?: string;
|
||||
enableLFS?: boolean;
|
||||
token?: string;
|
||||
gitCommitMessage?: string;
|
||||
gitAuthorName?: string;
|
||||
gitAuthorEmail?: string;
|
||||
signCommit?: boolean;
|
||||
description?: string | undefined;
|
||||
repoVisibility?: 'private' | 'public' | undefined;
|
||||
defaultBranch?: string | undefined;
|
||||
sourcePath?: string | undefined;
|
||||
enableLFS?: boolean | undefined;
|
||||
token?: string | undefined;
|
||||
gitCommitMessage?: string | undefined;
|
||||
gitAuthorName?: string | undefined;
|
||||
gitAuthorEmail?: string | undefined;
|
||||
signCommit?: boolean | undefined;
|
||||
},
|
||||
JsonObject,
|
||||
'v1'
|
||||
{
|
||||
remoteUrl?: string | undefined;
|
||||
repoContentsUrl?: string | undefined;
|
||||
commitHash?: string | undefined;
|
||||
},
|
||||
'v2'
|
||||
>;
|
||||
|
||||
// @public @deprecated (undocumented)
|
||||
|
||||
@@ -209,101 +209,99 @@ export function createPublishBitbucketAction(options: {
|
||||
}) {
|
||||
const { integrations, config } = options;
|
||||
|
||||
return createTemplateAction<{
|
||||
repoUrl: string;
|
||||
description?: string;
|
||||
defaultBranch?: string;
|
||||
repoVisibility?: 'private' | 'public';
|
||||
sourcePath?: string;
|
||||
enableLFS?: boolean;
|
||||
token?: string;
|
||||
gitCommitMessage?: string;
|
||||
gitAuthorName?: string;
|
||||
gitAuthorEmail?: string;
|
||||
signCommit?: boolean;
|
||||
}>({
|
||||
return createTemplateAction({
|
||||
id: 'publish:bitbucket',
|
||||
description:
|
||||
'Initializes a git repository of the content in the workspace, and publishes it to Bitbucket.',
|
||||
examples,
|
||||
schema: {
|
||||
input: {
|
||||
type: 'object',
|
||||
required: ['repoUrl'],
|
||||
properties: {
|
||||
repoUrl: {
|
||||
title: 'Repository Location',
|
||||
type: 'string',
|
||||
},
|
||||
description: {
|
||||
title: 'Repository Description',
|
||||
type: 'string',
|
||||
},
|
||||
repoVisibility: {
|
||||
title: 'Repository Visibility',
|
||||
type: 'string',
|
||||
enum: ['private', 'public'],
|
||||
},
|
||||
defaultBranch: {
|
||||
title: 'Default Branch',
|
||||
type: 'string',
|
||||
description: `Sets the default branch on the repository. The default value is 'master'`,
|
||||
},
|
||||
sourcePath: {
|
||||
title: 'Source Path',
|
||||
description:
|
||||
'Path within the workspace that will be used as the repository root. If omitted, the entire workspace will be published as the repository.',
|
||||
type: 'string',
|
||||
},
|
||||
enableLFS: {
|
||||
title: 'Enable LFS?',
|
||||
description:
|
||||
'Enable LFS for the repository. Only available for hosted Bitbucket.',
|
||||
type: 'boolean',
|
||||
},
|
||||
token: {
|
||||
title: 'Authentication Token',
|
||||
type: 'string',
|
||||
description: 'The token to use for authorization to BitBucket',
|
||||
},
|
||||
gitCommitMessage: {
|
||||
title: 'Git Commit Message',
|
||||
type: 'string',
|
||||
description: `Sets the commit message on the repository. The default value is 'initial commit'`,
|
||||
},
|
||||
gitAuthorName: {
|
||||
title: 'Default Author Name',
|
||||
type: 'string',
|
||||
description: `Sets the default author name for the commit. The default value is 'Scaffolder'`,
|
||||
},
|
||||
gitAuthorEmail: {
|
||||
title: 'Default Author Email',
|
||||
type: 'string',
|
||||
description: `Sets the default author email for the commit.`,
|
||||
},
|
||||
signCommit: {
|
||||
title: 'Sign commit',
|
||||
type: 'boolean',
|
||||
description: 'Sign commit with configured PGP private key',
|
||||
},
|
||||
},
|
||||
repoUrl: z =>
|
||||
z.string({
|
||||
description: 'Repository Location',
|
||||
}),
|
||||
description: z =>
|
||||
z
|
||||
.string({
|
||||
description: 'Repository Description',
|
||||
})
|
||||
.optional(),
|
||||
repoVisibility: z =>
|
||||
z
|
||||
.enum(['private', 'public'], {
|
||||
description: 'Repository Visibility',
|
||||
})
|
||||
.optional(),
|
||||
defaultBranch: z =>
|
||||
z
|
||||
.string({
|
||||
description: `Sets the default branch on the repository. The default value is 'master'`,
|
||||
})
|
||||
.optional(),
|
||||
sourcePath: z =>
|
||||
z
|
||||
.string({
|
||||
description:
|
||||
'Path within the workspace that will be used as the repository root. If omitted, the entire workspace will be published as the repository.',
|
||||
})
|
||||
.optional(),
|
||||
enableLFS: z =>
|
||||
z
|
||||
.boolean({
|
||||
description:
|
||||
'Enable LFS for the repository. Only available for hosted Bitbucket.',
|
||||
})
|
||||
.optional(),
|
||||
token: z =>
|
||||
z
|
||||
.string({
|
||||
description: 'The token to use for authorization to BitBucket',
|
||||
})
|
||||
.optional(),
|
||||
gitCommitMessage: z =>
|
||||
z
|
||||
.string({
|
||||
description: `Sets the commit message on the repository. The default value is 'initial commit'`,
|
||||
})
|
||||
.optional(),
|
||||
gitAuthorName: z =>
|
||||
z
|
||||
.string({
|
||||
description: `Sets the default author name for the commit. The default value is 'Scaffolder'`,
|
||||
})
|
||||
.optional(),
|
||||
gitAuthorEmail: z =>
|
||||
z
|
||||
.string({
|
||||
description: `Sets the default author email for the commit.`,
|
||||
})
|
||||
.optional(),
|
||||
signCommit: z =>
|
||||
z
|
||||
.boolean({
|
||||
description: 'Sign commit with configured PGP private key',
|
||||
})
|
||||
.optional(),
|
||||
},
|
||||
output: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
remoteUrl: {
|
||||
title: 'A URL to the repository with the provider',
|
||||
type: 'string',
|
||||
},
|
||||
repoContentsUrl: {
|
||||
title: 'A URL to the root of the repository',
|
||||
type: 'string',
|
||||
},
|
||||
commitHash: {
|
||||
title: 'The git commit hash of the initial commit',
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
remoteUrl: z =>
|
||||
z
|
||||
.string({
|
||||
description: 'A URL to the repository with the provider',
|
||||
})
|
||||
.optional(),
|
||||
repoContentsUrl: z =>
|
||||
z
|
||||
.string({
|
||||
description: 'A URL to the root of the repository',
|
||||
})
|
||||
.optional(),
|
||||
commitHash: z =>
|
||||
z
|
||||
.string({
|
||||
description: 'The git commit hash of the initial commit',
|
||||
})
|
||||
.optional(),
|
||||
},
|
||||
},
|
||||
async handler(ctx) {
|
||||
|
||||
Reference in New Issue
Block a user