mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-03 13:05:23 +02:00
feat: add clone by gitlab, github and bitbucket
This commit is contained in:
@@ -21,6 +21,8 @@ import { createDeployment, updateDeploymentStatus } from "./deployment";
|
||||
import { sendBuildErrorNotifications } from "@/server/utils/notifications/build-error";
|
||||
import { sendBuildSuccessNotifications } from "@/server/utils/notifications/build-success";
|
||||
import { validUniqueServerAppName } from "./project";
|
||||
import { cloneGitlabRepository } from "@/server/utils/providers/gitlab";
|
||||
import { cloneBitbucketRepository } from "@/server/utils/providers/bitbucket";
|
||||
export type Application = typeof applications.$inferSelect;
|
||||
|
||||
export const createApplication = async (
|
||||
@@ -81,6 +83,9 @@ export const findApplicationById = async (applicationId: string) => {
|
||||
security: true,
|
||||
ports: true,
|
||||
registry: true,
|
||||
gitlabProvider: true,
|
||||
githubProvider: true,
|
||||
bitbucketProvider: true,
|
||||
},
|
||||
});
|
||||
if (!application) {
|
||||
@@ -150,7 +155,13 @@ export const deployApplication = async ({
|
||||
|
||||
try {
|
||||
if (application.sourceType === "github") {
|
||||
await cloneGithubRepository(admin, application, deployment.logPath);
|
||||
await cloneGithubRepository(application, deployment.logPath);
|
||||
await buildApplication(application, deployment.logPath);
|
||||
} else if (application.sourceType === "gitlab") {
|
||||
await cloneGitlabRepository(application, deployment.logPath);
|
||||
await buildApplication(application, deployment.logPath);
|
||||
} else if (application.sourceType === "bitbucket") {
|
||||
await cloneBitbucketRepository(application, deployment.logPath);
|
||||
await buildApplication(application, deployment.logPath);
|
||||
} else if (application.sourceType === "docker") {
|
||||
await buildDocker(application, deployment.logPath);
|
||||
@@ -214,6 +225,10 @@ export const rebuildApplication = async ({
|
||||
try {
|
||||
if (application.sourceType === "github") {
|
||||
await buildApplication(application, deployment.logPath);
|
||||
} else if (application.sourceType === "gitlab") {
|
||||
await buildApplication(application, deployment.logPath);
|
||||
} else if (application.sourceType === "bitbucket") {
|
||||
await buildApplication(application, deployment.logPath);
|
||||
} else if (application.sourceType === "docker") {
|
||||
await buildDocker(application, deployment.logPath);
|
||||
} else if (application.sourceType === "git") {
|
||||
|
||||
@@ -142,10 +142,6 @@ export const haveGithubRequirements = (githubProvider: GithubProvider) => {
|
||||
);
|
||||
};
|
||||
|
||||
export const haveGitlabRequirements = (gitlabProvider: GitlabProvider) => {
|
||||
return !!(gitlabProvider?.accessToken && gitlabProvider?.refreshToken);
|
||||
};
|
||||
|
||||
export const getGitlabProvider = async (gitlabProviderId: string) => {
|
||||
const gitlabProviderResult = await db.query.gitlabProvider.findFirst({
|
||||
where: eq(gitlabProvider.gitlabProviderId, gitlabProviderId),
|
||||
|
||||
Reference in New Issue
Block a user