From 063d51e442093e5b41182fe8936bd0596d6d1e04 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sun, 21 Sep 2025 13:54:53 -0600 Subject: [PATCH] feat(bitbucket): add bitbucketEmail field to Bitbucket provider settings and update related API and database schema --- .../git/bitbucket/add-bitbucket-provider.tsx | 30 +- .../git/bitbucket/edit-bitbucket-provider.tsx | 84 +- .../dokploy/drizzle/0112_freezing_skrulls.sql | 1 + apps/dokploy/drizzle/meta/0112_snapshot.json | 6571 +++++++++++++++++ apps/dokploy/drizzle/meta/_journal.json | 7 + packages/server/src/db/schema/bitbucket.ts | 17 +- packages/server/src/services/bitbucket.ts | 25 +- .../server/src/utils/providers/bitbucket.ts | 84 +- 8 files changed, 6767 insertions(+), 52 deletions(-) create mode 100644 apps/dokploy/drizzle/0112_freezing_skrulls.sql create mode 100644 apps/dokploy/drizzle/meta/0112_snapshot.json diff --git a/apps/dokploy/components/dashboard/settings/git/bitbucket/add-bitbucket-provider.tsx b/apps/dokploy/components/dashboard/settings/git/bitbucket/add-bitbucket-provider.tsx index d8284274..4476fdbb 100644 --- a/apps/dokploy/components/dashboard/settings/git/bitbucket/add-bitbucket-provider.tsx +++ b/apps/dokploy/components/dashboard/settings/git/bitbucket/add-bitbucket-provider.tsx @@ -1,7 +1,6 @@ import { zodResolver } from "@hookform/resolvers/zod"; import { ExternalLink } from "lucide-react"; import Link from "next/link"; -import { useRouter } from "next/router"; import { useEffect, useState } from "react"; import { useForm } from "react-hook-form"; import { toast } from "sonner"; @@ -27,11 +26,11 @@ import { } from "@/components/ui/form"; import { Input } from "@/components/ui/input"; import { api } from "@/utils/api"; -import { useUrl } from "@/utils/hooks/use-url"; const Schema = z.object({ name: z.string().min(1, { message: "Name is required" }), username: z.string().min(1, { message: "Username is required" }), + email: z.string().email().optional(), apiToken: z.string().min(1, { message: "API Token is required" }), workspaceName: z.string().optional(), }); @@ -55,6 +54,7 @@ export const AddBitbucketProvider = () => { useEffect(() => { form.reset({ username: "", + email: "", apiToken: "", workspaceName: "", }); @@ -67,6 +67,7 @@ export const AddBitbucketProvider = () => { bitbucketWorkspaceName: data.workspaceName || "", authId: auth?.id || "", name: data.name || "", + bitbucketEmail: data.email || "", }) .then(async () => { await utils.gitProvider.getAll.invalidate(); @@ -128,12 +129,11 @@ export const AddBitbucketProvider = () => { permissions:

{ )} /> + ( + + Bitbucket Email + + + + + + )} + /> + ; @@ -60,19 +63,28 @@ export const EditBitbucketProvider = ({ bitbucketId }: Props) => { const form = useForm({ defaultValues: { username: "", + email: "", workspaceName: "", + apiToken: "", + appPassword: "", }, resolver: zodResolver(Schema), }); const username = form.watch("username"); + const email = form.watch("email"); const workspaceName = form.watch("workspaceName"); + const apiToken = form.watch("apiToken"); + const appPassword = form.watch("appPassword"); useEffect(() => { form.reset({ username: bitbucket?.bitbucketUsername || "", + email: bitbucket?.bitbucketEmail || "", workspaceName: bitbucket?.bitbucketWorkspaceName || "", name: bitbucket?.gitProvider.name || "", + apiToken: bitbucket?.apiToken || "", + appPassword: bitbucket?.appPassword || "", }); }, [form, isOpen, bitbucket]); @@ -81,8 +93,11 @@ export const EditBitbucketProvider = ({ bitbucketId }: Props) => { bitbucketId, gitProviderId: bitbucket?.gitProviderId || "", bitbucketUsername: data.username, + bitbucketEmail: data.email || "", bitbucketWorkspaceName: data.workspaceName || "", name: data.name || "", + apiToken: data.apiToken || "", + appPassword: data.appPassword || "", }) .then(async () => { await utils.gitProvider.getAll.invalidate(); @@ -122,8 +137,9 @@ export const EditBitbucketProvider = ({ bitbucketId }: Props) => {

- For security, credentials (API Token/App Password) can’t be - edited. To change them, create a new Bitbucket provider. + Update your Bitbucket authentication. Use API Token for + enhanced security (recommended) or App Password for legacy + support.

{ )} /> + ( + + Email (Required for API Tokens) + + + + + + )} + /> + { )} /> +
+

+ Authentication (Update to use API Token) +

+ ( + + API Token (Recommended) + + + + + + )} + /> + + ( + + + App Password (Legacy - will be deprecated June 2026) + + + + + + + )} + /> +
+