From 83956aa33cd2712995694aefef2ac25029f948c1 Mon Sep 17 00:00:00 2001 From: "William Walters (He/Him)" <44623911+wwalters12@users.noreply.github.com> Date: Wed, 10 Jan 2024 16:57:11 -0500 Subject: [PATCH 1/2] fix(docker): Parse date into Instant when using sortTagsByDate --- .../DockerRegistryImageLookupController.groovy | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/clouddriver-docker/src/main/groovy/com/netflix/spinnaker/clouddriver/docker/registry/controllers/DockerRegistryImageLookupController.groovy b/clouddriver-docker/src/main/groovy/com/netflix/spinnaker/clouddriver/docker/registry/controllers/DockerRegistryImageLookupController.groovy index a633f523efa..402aaed340c 100644 --- a/clouddriver-docker/src/main/groovy/com/netflix/spinnaker/clouddriver/docker/registry/controllers/DockerRegistryImageLookupController.groovy +++ b/clouddriver-docker/src/main/groovy/com/netflix/spinnaker/clouddriver/docker/registry/controllers/DockerRegistryImageLookupController.groovy @@ -51,7 +51,21 @@ class DockerRegistryImageLookupController { Keys.getTaggedImageKey(account, repository, "*") ).sort { a, b -> if (credentials.sortTagsByDate) { - b.attributes.date.epochSecond <=> a.attributes.date.epochSecond + Instant dateA + if (a.attributes.date instanceof String) { + dateA = Instant.parse(a.attributes.date) + } else { + dateA = a.attributes.date + } + + Instant dateB + if (b.attributes.date instanceof String) { + dateB = Instant.parse(b.attributes.date) + } else { + dateB = b.attributes.date + } + + dateB.epochSecond <=> dateA.epochSecond } else { a.id <=> b.id } From 05aa16ff339779c15ad2067c5bc002f6238db083 Mon Sep 17 00:00:00 2001 From: "William Walters (He/Him)" <44623911+wwalters12@users.noreply.github.com> Date: Wed, 10 Jan 2024 19:12:51 -0500 Subject: [PATCH 2/2] docker(fix): Import java.time.Instant --- .../controllers/DockerRegistryImageLookupController.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/clouddriver-docker/src/main/groovy/com/netflix/spinnaker/clouddriver/docker/registry/controllers/DockerRegistryImageLookupController.groovy b/clouddriver-docker/src/main/groovy/com/netflix/spinnaker/clouddriver/docker/registry/controllers/DockerRegistryImageLookupController.groovy index 402aaed340c..39693d89da5 100644 --- a/clouddriver-docker/src/main/groovy/com/netflix/spinnaker/clouddriver/docker/registry/controllers/DockerRegistryImageLookupController.groovy +++ b/clouddriver-docker/src/main/groovy/com/netflix/spinnaker/clouddriver/docker/registry/controllers/DockerRegistryImageLookupController.groovy @@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RequestMethod import org.springframework.web.bind.annotation.RequestParam import org.springframework.web.bind.annotation.RestController +import java.time.Instant @RestController @RequestMapping(["/dockerRegistry/images", "/titus/images"])