ci(images): build and publish the molecule-controller image #484

Merged
Defame1297 merged 6 commits from ci/477-molecule-controller-image into main 2026-11-29 18:52:29 +00:00
2 changed files with 25 additions and 2 deletions
Showing only changes of commit c3a7cef195 - Show all commits

No files matched your search

+7 -1
View File
@@ -135,7 +135,13 @@ class Registry:
def tags(self):
tags, path = [], "tags/list"
while path:
body, headers = self._get(path)
try:
body, headers = self._get(path)
except RegistryError as exc:
# A repository not pushed yet is 404 NAME_UNKNOWN (OCI distribution spec): no tags.
if exc.status == 404 and not tags:
return []
raise
tags += body.get("tags") or []
link = re.search(r"<[^>]*/tags/list(\?[^>]*)>", headers.get("Link", ""))
path = f"tags/list{link[1]}" if link else None
+18 -1
View File
@@ -104,6 +104,7 @@ class FakeRegistry(http.server.BaseHTTPRequestHandler):
refuse_token = False
no_realm = False
empty_token = False
unknown = False # the repository does not exist yet
agents = None # a fresh list per test, set in setUp
def do_GET(self):
@@ -127,6 +128,9 @@ class FakeRegistry(http.server.BaseHTTPRequestHandler):
b"{}",
extra={"WWW-Authenticate": f'Bearer realm="{realm}",service="reg"'},
)
elif self.unknown:
body = {"errors": [{"code": "NAME_UNKNOWN", "message": "unknown"}]}
self.reply(404, json.dumps(body).encode())
else:
self.reply(200, json.dumps({"tags": ["0.1.0"]}).encode())
@@ -150,7 +154,7 @@ class QuietServer(http.server.HTTPServer):
class RegistryClient(unittest.TestCase):
def setUp(self):
FakeRegistry.refuse = FakeRegistry.refuse_token = FakeRegistry.no_realm = False
FakeRegistry.empty_token = False
FakeRegistry.empty_token = FakeRegistry.unknown = False
FakeRegistry.agents = []
server = QuietServer(("127.0.0.1", 0), FakeRegistry)
threading.Thread(target=server.serve_forever, daemon=True).start()
@@ -165,6 +169,19 @@ class RegistryClient(unittest.TestCase):
for agent in FakeRegistry.agents:
self.assertTrue(agent.startswith("kamino-"), agent)
def test_a_repository_not_yet_pushed_has_no_tags(self):
FakeRegistry.unknown = True
self.assertEqual(self.registry.tags(), [])
self.assertEqual(
niv.next_version("0.1", self.registry.tags(), "c", no_label), "0.1.0"
)
def test_a_missing_manifest_is_still_a_registry_error(self):
FakeRegistry.unknown = True
with self.assertRaises(niv.RegistryError) as caught:
self.registry.label("0.1.0")
self.assertIn("404", str(caught.exception))
def test_a_refused_request_names_its_status_and_body(self):
FakeRegistry.refuse = True
with self.assertRaises(niv.RegistryError) as caught: