mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-24 04:38:46 +00:00
Merge pull request #3213 from Dokploy/3086-webhook-deployment-fails-with-webhook-docker-image-name-not-found-after-v02510-update
refactor(deploy): streamline webhook image validation logic
This commit is contained in:
@@ -81,13 +81,9 @@ export default async function handler(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!webhookImageName) {
|
// If webhook provides image information, validate it matches the configured image
|
||||||
res.status(301).json({
|
// If webhook doesn't provide image information, fall back to using the configured image (backward compatibility)
|
||||||
message: "Webhook Docker Image Name Not Found",
|
if (webhookImageName) {
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validate image name matches
|
// Validate image name matches
|
||||||
if (webhookImageName !== applicationImageName) {
|
if (webhookImageName !== applicationImageName) {
|
||||||
res.status(301).json({
|
res.status(301).json({
|
||||||
@@ -103,19 +99,16 @@ export default async function handler(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!webhookDockerTag) {
|
if (webhookDockerTag) {
|
||||||
res.status(301).json({
|
|
||||||
message: "Webhook Docker Tag Not Found",
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (webhookDockerTag !== applicationDockerTag) {
|
if (webhookDockerTag !== applicationDockerTag) {
|
||||||
res.status(301).json({
|
res.status(301).json({
|
||||||
message: `Application Image Tag (${applicationDockerTag}) doesn't match request event payload Image Tag (${webhookDockerTag}).`,
|
message: `Application Image Tag (${applicationDockerTag}) doesn't match request event payload Image Tag (${webhookDockerTag}).`,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If webhook doesn't provide image info, we'll use the configured image (old behavior)
|
||||||
} else if (sourceType === "github") {
|
} else if (sourceType === "github") {
|
||||||
const normalizedCommits = req.body?.commits?.flatMap(
|
const normalizedCommits = req.body?.commits?.flatMap(
|
||||||
(commit: any) => commit.modified,
|
(commit: any) => commit.modified,
|
||||||
|
|||||||
Reference in New Issue
Block a user