From 9ea343041db78f438a8fc769af797d18380027dd Mon Sep 17 00:00:00 2001 From: Janet Gainer-Dewar Date: Tue, 20 Feb 2024 11:23:15 -0500 Subject: [PATCH 1/2] Update docker image regex to handle python:3 correctly --- .../src/main/scala/cromwell/docker/DockerImageIdentifier.scala | 2 +- .../test/scala/cromwell/docker/DockerImageIdentifierSpec.scala | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dockerHashing/src/main/scala/cromwell/docker/DockerImageIdentifier.scala b/dockerHashing/src/main/scala/cromwell/docker/DockerImageIdentifier.scala index f34702509db..afab2cf79d8 100644 --- a/dockerHashing/src/main/scala/cromwell/docker/DockerImageIdentifier.scala +++ b/dockerHashing/src/main/scala/cromwell/docker/DockerImageIdentifier.scala @@ -56,7 +56,7 @@ object DockerImageIdentifier { ( # Begin capturing group for name [a-z0-9]+(?:[._-][a-z0-9]+)* # API v2 name component regex - see https://docs.docker.com/registry/spec/api/#/overview - (?::[0-9]+)? # Optional port + (?::[0-9]{4,5})? # Optional port (expect 4 or 5 digits) (?:/[a-z0-9]+(?:[._-][a-z0-9]+)*)* # Optional additional name components separated by / ) # End capturing group for name diff --git a/dockerHashing/src/test/scala/cromwell/docker/DockerImageIdentifierSpec.scala b/dockerHashing/src/test/scala/cromwell/docker/DockerImageIdentifierSpec.scala index 35fe341737b..feae7b0c1d4 100644 --- a/dockerHashing/src/test/scala/cromwell/docker/DockerImageIdentifierSpec.scala +++ b/dockerHashing/src/test/scala/cromwell/docker/DockerImageIdentifierSpec.scala @@ -41,6 +41,7 @@ class DockerImageIdentifierSpec "0.8.1.1--htslib1.5_0" ), ("terrabatchdev.azurecr.io/postgres:latest", Option("terrabatchdev.azurecr.io"), None, "postgres", "latest"), + ("python:3", None, None, "python", "3"), // Very long tags with trailing spaces cause problems for the re engine ("someuser/someimage:supercalifragilisticexpialidociouseventhoughthesoundofitissomethingquiteatrociousifyousayitloudenoughyoullalwayssoundprecocious ", None, From 238ff7406ede9305d310b6b0951d2d08d0a9b89a Mon Sep 17 00:00:00 2001 From: Janet Gainer-Dewar Date: Tue, 20 Feb 2024 12:23:34 -0500 Subject: [PATCH 2/2] Allow port 443 --- .../src/main/scala/cromwell/docker/DockerImageIdentifier.scala | 2 +- .../test/scala/cromwell/docker/DockerImageIdentifierSpec.scala | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dockerHashing/src/main/scala/cromwell/docker/DockerImageIdentifier.scala b/dockerHashing/src/main/scala/cromwell/docker/DockerImageIdentifier.scala index afab2cf79d8..7c20760b644 100644 --- a/dockerHashing/src/main/scala/cromwell/docker/DockerImageIdentifier.scala +++ b/dockerHashing/src/main/scala/cromwell/docker/DockerImageIdentifier.scala @@ -56,7 +56,7 @@ object DockerImageIdentifier { ( # Begin capturing group for name [a-z0-9]+(?:[._-][a-z0-9]+)* # API v2 name component regex - see https://docs.docker.com/registry/spec/api/#/overview - (?::[0-9]{4,5})? # Optional port (expect 4 or 5 digits) + (?::[0-9]{4,5}|:443)? # Optional port (expect 4 or 5 digits OR :443) (?:/[a-z0-9]+(?:[._-][a-z0-9]+)*)* # Optional additional name components separated by / ) # End capturing group for name diff --git a/dockerHashing/src/test/scala/cromwell/docker/DockerImageIdentifierSpec.scala b/dockerHashing/src/test/scala/cromwell/docker/DockerImageIdentifierSpec.scala index feae7b0c1d4..30c8cb6a010 100644 --- a/dockerHashing/src/test/scala/cromwell/docker/DockerImageIdentifierSpec.scala +++ b/dockerHashing/src/test/scala/cromwell/docker/DockerImageIdentifierSpec.scala @@ -42,6 +42,7 @@ class DockerImageIdentifierSpec ), ("terrabatchdev.azurecr.io/postgres:latest", Option("terrabatchdev.azurecr.io"), None, "postgres", "latest"), ("python:3", None, None, "python", "3"), + ("localhost:443/ubuntu", Option("localhost:443"), None, "ubuntu", "latest"), // Very long tags with trailing spaces cause problems for the re engine ("someuser/someimage:supercalifragilisticexpialidociouseventhoughthesoundofitissomethingquiteatrociousifyousayitloudenoughyoullalwayssoundprecocious ", None,