mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-10 14:05:18 +00:00
feat(settings): enhance getUpdateData and reloadDockerResource for image digest comparison
- Added logic to getUpdateData to compare current and latest image digests for canary and feature tags, indicating if an update is available. - Updated reloadDockerResource to ensure the correct image tag is used during dokploy service updates based on the current image tag.
This commit is contained in:
@@ -87,6 +87,19 @@ export const getUpdateData = async (
|
|||||||
// These are unstable versions that change frequently, and users on these
|
// These are unstable versions that change frequently, and users on these
|
||||||
// branches are expected to manually manage updates
|
// branches are expected to manually manage updates
|
||||||
if (currentImageTag === "canary" || currentImageTag === "feature") {
|
if (currentImageTag === "canary" || currentImageTag === "feature") {
|
||||||
|
const currentDigest = await getServiceImageDigest();
|
||||||
|
const latestDigest = allResults.find(
|
||||||
|
(t) => t.name === currentImageTag,
|
||||||
|
)?.digest;
|
||||||
|
if (!latestDigest) {
|
||||||
|
return DEFAULT_UPDATE_DATA;
|
||||||
|
}
|
||||||
|
if (currentDigest !== latestDigest) {
|
||||||
|
return {
|
||||||
|
latestVersion: currentImageTag,
|
||||||
|
updateAvailable: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
latestVersion: currentImageTag,
|
latestVersion: currentImageTag,
|
||||||
updateAvailable: false,
|
updateAvailable: false,
|
||||||
@@ -286,7 +299,13 @@ export const reloadDockerResource = async (
|
|||||||
let command = "";
|
let command = "";
|
||||||
if (resourceType === "service") {
|
if (resourceType === "service") {
|
||||||
if (resourceName === "dokploy") {
|
if (resourceName === "dokploy") {
|
||||||
command = `docker service update --force --image dokploy/dokploy:${version} ${resourceName}`;
|
const currentImageTag = getDokployImageTag();
|
||||||
|
let imageTag = version;
|
||||||
|
if (currentImageTag === "canary" || currentImageTag === "feature") {
|
||||||
|
imageTag = currentImageTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
command = `docker service update --force --image dokploy/dokploy:${imageTag} ${resourceName}`;
|
||||||
} else {
|
} else {
|
||||||
command = `docker service update --force ${resourceName}`;
|
command = `docker service update --force ${resourceName}`;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user