From e97fcad792774292795cfc3c11a24ecdf8e6abdf Mon Sep 17 00:00:00 2001 From: jeremyhi Date: Tue, 13 Oct 2026 08:12:33 +0800 Subject: [PATCH] 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 --- .github/scripts/oswal-s3-bench.py | 3 ++- tests/perf/test_oswal_s3_bench_scripts.py | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/scripts/oswal-s3-bench.py b/.github/scripts/oswal-s3-bench.py index 4fa01383355..0ddf42f4225 100644 --- a/.github/scripts/oswal-s3-bench.py +++ b/.github/scripts/oswal-s3-bench.py @@ -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}") diff --git a/tests/perf/test_oswal_s3_bench_scripts.py b/tests/perf/test_oswal_s3_bench_scripts.py index cb6fddf7215..affc01d4cd1 100644 --- a/tests/perf/test_oswal_s3_bench_scripts.py +++ b/tests/perf/test_oswal_s3_bench_scripts.py @@ -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")