ci: accept every Docker repository separator in greptimedb_image

Path components may be joined by a double underscore or a run of hyphens.

Signed-off-by: jeremyhi <fengjiachun@gmail.com>
This commit is contained in:
jeremyhi
2026-10-13 08:12:33 +08:00
parent 7ff5bf44e0
commit e97fcad792
2 changed files with 7 additions and 3 deletions
+2 -1
View File
@@ -49,7 +49,8 @@ DEPTHS = {"GREPTIMEDB_OSWAL_MAX_IN_FLIGHT_CREATES": 4, "GREPTIMEDB_OSWAL_MAX_SEA
RESTART_FLUSH_INTERVAL = "10ms"
RESERVED_ENV = ("GREPTIMEDB_STANDALONE__STORAGE__", "GREPTIMEDB_STANDALONE__WAL__")
ENV_NAME = re.compile(r"[A-Za-z_][A-Za-z0-9_]*")
IMAGE = re.compile(r"[a-z0-9]+(?:[._-][a-z0-9]+)*(?::[0-9]+)?(?:/[a-z0-9]+(?:[._-][a-z0-9]+)*)+"
# Docker's reference grammar: path components separated by ".", "_", "__" or runs of "-".
IMAGE = re.compile(r"[a-z0-9]+(?:(?:[._]|__|-+)[a-z0-9]+)*(?::[0-9]+)?(?:/[a-z0-9]+(?:(?:[._]|__|-+)[a-z0-9]+)*)+"
r"(?::[A-Za-z0-9_][A-Za-z0-9_.-]{0,127})?(?:@sha256:[0-9a-f]{64})?")
NIGHTLY = re.compile(r"v\d+\.\d+\.\d+(?:-[0-9A-Za-z.]+)?-nightly-(\d{8})")
TAG = re.compile(r"[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}")
+5 -2
View File
@@ -125,9 +125,12 @@ class PlanTest(unittest.TestCase):
def test_the_image_is_the_full_reference_or_a_greptimedb_tag(self):
image = "docker.io/greptime/greptimedb-dev:dev-20261013-1791848986-a5a1a9f4"
self.assertEqual(bench.resolve_image(image, "nightly"), image)
for valid in (image, "ghcr.io/acme/greptimedb--bench:dev", "ghcr.io/acme/greptimedb__bench:dev",
"localhost:5000/a/b@sha256:" + "c" * 64):
self.assertEqual(bench.resolve_image(valid, "nightly"), valid)
self.assertEqual(bench.resolve_image("", "v1.4.0-nightly-20261012"), "greptime/greptimedb:v1.4.0-nightly-20261012")
for bad in ("greptimedb", "docker.io/greptime/greptimedb", "Docker.io/x/y:1", "x/y:bad tag"):
for bad in ("greptimedb", "docker.io/greptime/greptimedb", "Docker.io/x/y:1", "x/y:bad tag",
"x/y___z:1", "x/-y:1"):
with self.subTest(bad=bad), self.assertRaises(ValueError):
bench.resolve_image(bad, "nightly")