fixes some of the issue in 2.1.0-rc2

This commit is contained in:
yashsinghcodes
2025-06-26 02:47:29 +05:30
parent 98c3480aba
commit 00ffd7bfa8
2 changed files with 16 additions and 15 deletions
+14 -13
View File
@@ -813,20 +813,20 @@ func handleBackendImageDownload(ctx context.Context, images string) error {
newImages = append(newImages, curimage)
// Force remove the current image to avoid cached layers
if swarmConfig == "run" || swarmConfig == "swarm" {
_, err := dockercli.ImageRemove(ctx, curimage, image.RemoveOptions{
Force: true,
PruneChildren: true,
})
// if swarmConfig == "run" || swarmConfig == "swarm" {
// _, err := dockercli.ImageRemove(ctx, curimage, image.RemoveOptions{
// Force: true,
// PruneChildren: true,
// })
if err != nil {
log.Printf("[ERROR] Failed removing image for re-download: %s", err)
} else {
log.Printf("[DEBUG] Removed image: %s", curimage)
}
} else {
//log.Printf("[DEBUG] Skipping image removal for %s as swarmConfig is not set to run or swarm. Value: %#v", curimage, swarmConfig)
}
// if err != nil {
// log.Printf("[ERROR] Failed removing image for re-download: %s", err)
// } else {
// log.Printf("[DEBUG] Removed image: %s", curimage)
// }
// } else {
// //log.Printf("[DEBUG] Skipping image removal for %s as swarmConfig is not set to run or swarm. Value: %#v", curimage, swarmConfig)
// }
err := shuffle.DownloadDockerImageBackend(&http.Client{Timeout: imagedownloadTimeout}, curimage)
if err != nil {
@@ -874,6 +874,7 @@ func handleBackendImageDownload(ctx context.Context, images string) error {
// Update the service to run with the new image
//docker service update --image username/imagename:latest servicename --force
serviceUpdateOptions := types.ServiceUpdateOptions{}
service.Spec.TaskTemplate.ForceUpdate++
resp, err := dockercli.ServiceUpdate(
ctx,
service.ID,