From 59af9c81e51d640acde6fca64df6466352cd0520 Mon Sep 17 00:00:00 2001 From: Ashley Cui Date: Tue, 21 Jul 2026 16:39:37 -0400 Subject: [PATCH] Docker compat v1.45 : deprecate is-automated field searching for is-automated=true will yield no results, while is-automated=false will be a no-op Signed-off-by: Ashley Cui --- pkg/api/handlers/compat/images_search.go | 36 +++++++++++++++++++----- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/pkg/api/handlers/compat/images_search.go b/pkg/api/handlers/compat/images_search.go index 21913fabc8..55570cd68e 100644 --- a/pkg/api/handlers/compat/images_search.go +++ b/pkg/api/handlers/compat/images_search.go @@ -10,6 +10,7 @@ import ( "go.podman.io/image/v5/types" "go.podman.io/podman/v6/libpod" "go.podman.io/podman/v6/pkg/api/handlers/utils" + "go.podman.io/podman/v6/pkg/api/handlers/utils/apiutil" api "go.podman.io/podman/v6/pkg/api/types" "go.podman.io/podman/v6/pkg/auth" "go.podman.io/podman/v6/pkg/domain/entities" @@ -49,6 +50,22 @@ func SearchImages(w http.ResponseWriter, r *http.Request) { password = authconf.Password idToken = authconf.IdentityToken } + // compat v1.45 deprecation: searching for is-automated=true will yield no results, while is-automated=false will be a no-op. + isAutomatedDeprecated := false + if _, err := apiutil.SupportedVersion(r, ">=1.45.0"); err == nil { + if !utils.IsLibpodRequest(r) { + isAutomatedDeprecated = true + if vals, ok := query.Filters["is-automated"]; ok { + switch vals[0] { + case "true": + utils.WriteResponse(w, http.StatusOK, []registry.SearchResult{}) + return + case "false": + delete(query.Filters, "is-automated") + } + } + } + } filters := []string{} for key, val := range query.Filters { @@ -79,14 +96,19 @@ func SearchImages(w http.ResponseWriter, r *http.Request) { return } compatResults := make([]registry.SearchResult, len(reports)) - for i, r := range reports { - compatResults[i] = registry.SearchResult{ - Name: r.Name, - Description: r.Description, - StarCount: r.Stars, - IsOfficial: toBool(r.Official), - IsAutomated: toBool(r.Automated), + for i, report := range reports { + result := registry.SearchResult{ + Name: report.Name, + Description: report.Description, + StarCount: report.Stars, + IsOfficial: toBool(report.Official), + IsAutomated: toBool(report.Automated), } + if isAutomatedDeprecated { + //nolint:staticcheck + result.IsAutomated = false + } + compatResults[i] = result } utils.WriteResponse(w, http.StatusOK, compatResults) return