@@ -312,7 +312,8 @@ def _composed(folder: Path, changes: dict | None = None, arches=("amd64", "arm64
312312 return folder
313313
314314
315- def _computer_registry (served : dict [str , str ], created : list , children : set [str ] | None = None ):
315+ def _computer_registry (served : dict [str , str ], created : list , children : set [str ] | None = None ,
316+ before : str = "not found" ):
316317 """Docker as the registries answer: ``served`` as ``_docker`` serves it, the local registry's composed images, and
317318 the agentenv-chromium index, served once created, of ``children``, by default the two images it was made of."""
318319 published = _docker (served )
@@ -326,7 +327,7 @@ def run(command, **kw):
326327 return published (command , ** kw )
327328 ref = command [4 ]
328329 if ref == _COMPUTER_INDEX and not created :
329- return subprocess .CompletedProcess (command , 1 , "" , f"ERROR: { ref } : not found \n " )
330+ return subprocess .CompletedProcess (command , 1 , "" , f"ERROR: { ref } : { before } \n " )
330331 if command [5 :] == ["--raw" ]:
331332 raw = raws .get (ref ) or (ref == _COMPUTER_INDEX and {"manifests" : [
332333 {"digest" : digest } for digest in sorted (children or {_AMD64 , _ARM64 })]})
@@ -357,6 +358,21 @@ def test_publish_computers_joins_each_apps_platform_manifests_into_one_index_and
357358 assert released_computers (record ) == computers
358359
359360
361+ def test_publish_computers_creates_an_index_ghcr_wont_say_it_has_before_the_packages_first_push (script , monkeypatch ,
362+ tmp_path , workflow ,
363+ capsys ):
364+ created = []
365+ refused = "denied: requested access to the resource is denied"
366+ monkeypatch .setattr (script .subprocess , "run" , _computer_registry ({}, created , before = refused ))
367+ monkeypatch .setattr (script .subprocess , "Popen" , lambda argv , ** kw : (created .append (argv ), _Process ("" , 0 ))[1 ])
368+
369+ assert _run (script , monkeypatch , "publish-computers" , str (_composed (tmp_path ))) == 0
370+
371+ out = capsys .readouterr ().out
372+ assert len (created ) == 1 and f"::warning::{ _COMPUTER_INDEX } is taken as unpublished" in out
373+ assert "::error::" not in out
374+
375+
360376@pytest .mark .parametrize ("changes, arches, problem" , [
361377 ({"arm64" : {"env" : "@local/agentenv-framework/browsers/other" }}, ("amd64" , "arm64" ),
362378 "isn't an app a release publishes" ),
0 commit comments