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:
Mauricio Siu
2025-12-09 23:08:38 -06:00
committed by GitHub
+25 -32
View File
@@ -81,41 +81,34 @@ 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) {
}); // Validate image name matches
return; if (webhookImageName !== applicationImageName) {
} res.status(301).json({
message: `Application Image Name (${applicationImageName}) doesn't match request event payload Image Name (${webhookImageName}).`,
});
return;
}
// Validate image name matches if (!applicationDockerTag) {
if (webhookImageName !== applicationImageName) { res.status(301).json({
res.status(301).json({ message: "Application Docker Tag Not Found",
message: `Application Image Name (${applicationImageName}) doesn't match request event payload Image Name (${webhookImageName}).`, });
}); return;
return; }
}
if (!applicationDockerTag) { if (webhookDockerTag) {
res.status(301).json({ if (webhookDockerTag !== applicationDockerTag) {
message: "Application Docker Tag Not Found", res.status(301).json({
}); message: `Application Image Tag (${applicationDockerTag}) doesn't match request event payload Image Tag (${webhookDockerTag}).`,
return; });
} return;
}
if (!webhookDockerTag) { }
res.status(301).json({
message: "Webhook Docker Tag Not Found",
});
return;
}
if (webhookDockerTag !== applicationDockerTag) {
res.status(301).json({
message: `Application Image Tag (${applicationDockerTag}) doesn't match request event payload Image Tag (${webhookDockerTag}).`,
});
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,