Switch official environment publishing to Docker Hub
This commit is contained in:
parent
0c4ac17b82
commit
6988d85f7d
11 changed files with 590 additions and 73 deletions
|
|
@ -246,15 +246,15 @@ def test_fetch_oci_manifest_resolves_linux_amd64_index_with_bearer_auth(
|
|||
runtime_paths = _fake_runtime_paths(tmp_path)
|
||||
store = EnvironmentStore(runtime_paths=runtime_paths, cache_dir=tmp_path / "cache")
|
||||
spec = VmEnvironment(
|
||||
name="debian:12-ghcr",
|
||||
name="debian:12-registry",
|
||||
version="1.0.0",
|
||||
description="OCI-backed environment",
|
||||
default_packages=("bash", "git"),
|
||||
distribution="debian",
|
||||
distribution_version="12",
|
||||
source_profile="missing-profile",
|
||||
oci_registry="ghcr.io",
|
||||
oci_repository="thaloco/pyro-environments/debian-12",
|
||||
oci_registry="registry-1.docker.io",
|
||||
oci_repository="thalesmaciel/pyro-environment-debian-12",
|
||||
oci_reference="1.0.0",
|
||||
)
|
||||
|
||||
|
|
@ -288,7 +288,7 @@ def test_fetch_oci_manifest_resolves_linux_amd64_index_with_bearer_auth(
|
|||
def fake_urlopen(request: object, timeout: int = 90) -> FakeResponse:
|
||||
del timeout
|
||||
url = request.full_url if isinstance(request, urllib.request.Request) else str(request)
|
||||
if url.startswith("https://ghcr.io/token?"):
|
||||
if url.startswith("https://auth.docker.io/token?"):
|
||||
return FakeResponse(b'{"token":"secret-token"}')
|
||||
authorization = _authorization_header(request)
|
||||
if url.endswith("/manifests/1.0.0"):
|
||||
|
|
@ -300,9 +300,9 @@ def test_fetch_oci_manifest_resolves_linux_amd64_index_with_bearer_auth(
|
|||
_http_headers(
|
||||
{
|
||||
"WWW-Authenticate": (
|
||||
'Bearer realm="https://ghcr.io/token",'
|
||||
'service="ghcr.io",'
|
||||
'scope="repository:thaloco/pyro-environments/debian-12:pull"'
|
||||
'Bearer realm="https://auth.docker.io/token",'
|
||||
'service="registry.docker.io",'
|
||||
'scope="repository:thalesmaciel/pyro-environment-debian-12:pull"'
|
||||
)
|
||||
}
|
||||
),
|
||||
|
|
@ -322,9 +322,9 @@ def test_fetch_oci_manifest_resolves_linux_amd64_index_with_bearer_auth(
|
|||
_http_headers(
|
||||
{
|
||||
"WWW-Authenticate": (
|
||||
'Bearer realm="https://ghcr.io/token",'
|
||||
'service="ghcr.io",'
|
||||
'scope="repository:thaloco/pyro-environments/debian-12:pull"'
|
||||
'Bearer realm="https://auth.docker.io/token",'
|
||||
'service="registry.docker.io",'
|
||||
'scope="repository:thalesmaciel/pyro-environment-debian-12:pull"'
|
||||
)
|
||||
}
|
||||
),
|
||||
|
|
@ -345,8 +345,11 @@ def test_fetch_oci_manifest_resolves_linux_amd64_index_with_bearer_auth(
|
|||
assert manifest == child_manifest
|
||||
assert resolved_digest == child_digest
|
||||
assert authorized_urls == [
|
||||
"https://ghcr.io/v2/thaloco/pyro-environments/debian-12/manifests/1.0.0",
|
||||
f"https://ghcr.io/v2/thaloco/pyro-environments/debian-12/manifests/{child_digest}",
|
||||
"https://registry-1.docker.io/v2/thalesmaciel/pyro-environment-debian-12/manifests/1.0.0",
|
||||
(
|
||||
"https://registry-1.docker.io/v2/thalesmaciel/pyro-environment-debian-12/"
|
||||
f"manifests/{child_digest}"
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
|
|
@ -377,15 +380,15 @@ def test_environment_store_installs_from_oci_when_runtime_source_missing(
|
|||
manifest_payload = json.dumps(manifest).encode("utf-8")
|
||||
manifest_digest = _sha256_digest(manifest_payload)
|
||||
environment = VmEnvironment(
|
||||
name="debian:12-ghcr",
|
||||
name="debian:12-registry",
|
||||
version="1.0.0",
|
||||
description="OCI-backed environment",
|
||||
default_packages=("bash", "git"),
|
||||
distribution="debian",
|
||||
distribution_version="12",
|
||||
source_profile="missing-profile",
|
||||
oci_registry="ghcr.io",
|
||||
oci_repository="thaloco/pyro-environments/debian-12",
|
||||
oci_registry="registry-1.docker.io",
|
||||
oci_repository="thalesmaciel/pyro-environment-debian-12",
|
||||
oci_reference="1.0.0",
|
||||
)
|
||||
|
||||
|
|
@ -415,7 +418,7 @@ def test_environment_store_installs_from_oci_when_runtime_source_missing(
|
|||
assert installed.kernel_image.read_text(encoding="utf-8") == "kernel\n"
|
||||
assert installed.rootfs_image.read_text(encoding="utf-8") == "rootfs\n"
|
||||
assert installed.source == (
|
||||
"oci://ghcr.io/thaloco/pyro-environments/debian-12"
|
||||
"oci://registry-1.docker.io/thalesmaciel/pyro-environment-debian-12"
|
||||
f"@{manifest_digest}"
|
||||
)
|
||||
metadata = json.loads((installed.install_dir / "environment.json").read_text(encoding="utf-8"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue