mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-10 05:55:18 +00:00
Merge pull request #3642 from Dokploy/3469-multiple-preview-deployments-regression-in-v026x-same-as-1198
3469 multiple preview deployments regression in v026x same as 1198
This commit is contained in:
@@ -355,6 +355,11 @@ export default async function handler(
|
|||||||
action === "labeled" ||
|
action === "labeled" ||
|
||||||
action === "unlabeled"
|
action === "unlabeled"
|
||||||
) {
|
) {
|
||||||
|
const shouldCreateDeployment =
|
||||||
|
action === "opened" ||
|
||||||
|
action === "synchronize" ||
|
||||||
|
action === "reopened";
|
||||||
|
|
||||||
const repository = githubBody?.repository?.name;
|
const repository = githubBody?.repository?.name;
|
||||||
const deploymentHash = githubBody?.pull_request?.head?.sha;
|
const deploymentHash = githubBody?.pull_request?.head?.sha;
|
||||||
const branch = githubBody?.pull_request?.base?.ref;
|
const branch = githubBody?.pull_request?.base?.ref;
|
||||||
@@ -475,7 +480,7 @@ export default async function handler(
|
|||||||
let previewDeploymentId =
|
let previewDeploymentId =
|
||||||
previewDeploymentResult?.previewDeploymentId || "";
|
previewDeploymentResult?.previewDeploymentId || "";
|
||||||
|
|
||||||
if (!previewDeploymentResult) {
|
if (!previewDeploymentResult && shouldCreateDeployment) {
|
||||||
const previewDeployment = await createPreviewDeployment({
|
const previewDeployment = await createPreviewDeployment({
|
||||||
applicationId: app.applicationId as string,
|
applicationId: app.applicationId as string,
|
||||||
branch: prBranch,
|
branch: prBranch,
|
||||||
@@ -497,21 +502,23 @@ export default async function handler(
|
|||||||
previewDeploymentId,
|
previewDeploymentId,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (IS_CLOUD && app.serverId) {
|
if (previewDeploymentId) {
|
||||||
jobData.serverId = app.serverId;
|
if (IS_CLOUD && app.serverId) {
|
||||||
deploy(jobData).catch((error) => {
|
jobData.serverId = app.serverId;
|
||||||
console.error("Background deployment failed:", error);
|
deploy(jobData).catch((error) => {
|
||||||
});
|
console.error("Background deployment failed:", error);
|
||||||
continue;
|
});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
await myQueue.add(
|
||||||
|
"deployments",
|
||||||
|
{ ...jobData },
|
||||||
|
{
|
||||||
|
removeOnComplete: true,
|
||||||
|
removeOnFail: true,
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
await myQueue.add(
|
|
||||||
"deployments",
|
|
||||||
{ ...jobData },
|
|
||||||
{
|
|
||||||
removeOnComplete: true,
|
|
||||||
removeOnFail: true,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return res.status(200).json({ message: "Apps Deployed" });
|
return res.status(200).json({ message: "Apps Deployed" });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,10 @@ const { handler, api } = betterAuth({
|
|||||||
...(settings?.serverIp ? [`http://${settings?.serverIp}:3000`] : []),
|
...(settings?.serverIp ? [`http://${settings?.serverIp}:3000`] : []),
|
||||||
...(settings?.host ? [`https://${settings?.host}`] : []),
|
...(settings?.host ? [`https://${settings?.host}`] : []),
|
||||||
...(process.env.NODE_ENV === "development"
|
...(process.env.NODE_ENV === "development"
|
||||||
? ["http://localhost:3000"]
|
? [
|
||||||
|
"http://localhost:3000",
|
||||||
|
"https://absolutely-handy-falcon.ngrok-free.app",
|
||||||
|
]
|
||||||
: []),
|
: []),
|
||||||
...trustedOrigins,
|
...trustedOrigins,
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user