netork's release joins an arm64 image to the amd64 one its dev build already signed and attested, under a new index. ATTEST_PLATFORMS (the sign action's attest-platforms) signs the new index and every platform behind it, and attests only the ones named.
This commit is contained in:
1 parent
06825cb504
commit
e7ef8fe073
3 files changed
+33
-1
No files matched your search
@@ -120,6 +120,30 @@ class TestSign:
|
||||
assert sum(f"@{AMD}" in ln for ln in verified) == 2
|
||||
assert sum(f"@{ARM}" in ln for ln in verified) == 2
|
||||
|
||||
def test_a_release_index_attests_only_the_platform_it_added(self, tmp_path):
|
||||
"""netork's release joins arm64 to the amd64 image its dev build already
|
||||
signed and attested: the new index is signed throughout, and only arm64
|
||||
needs its CIS result and SBOM (ATTEST_PLATFORMS)."""
|
||||
raw = {
|
||||
"mediaType": "application/vnd.oci.image.index.v1+json",
|
||||
"manifests": [
|
||||
{"digest": AMD, "platform": {"os": "linux", "architecture": "amd64"}},
|
||||
{"digest": ARM, "platform": {"os": "linux", "architecture": "arm64"}},
|
||||
],
|
||||
}
|
||||
env = self._env(tmp_path, raw, {}, ATTEST_PLATFORMS="arm64")
|
||||
attest = self._attest_dir(tmp_path, "arm64")
|
||||
|
||||
result = _run(SIGN, f"{IMAGE}:0.41.0@{INDEX}", str(attest), env=env)
|
||||
|
||||
assert result.returncode == 0, result.stderr
|
||||
log = _log(tmp_path)
|
||||
assert any("sign --yes --recursive" in ln and f"@{INDEX}" in ln for ln in log)
|
||||
attests = [ln for ln in log if " attest " in ln]
|
||||
assert len(attests) == 2 and all(f"@{ARM}" in ln for ln in attests)
|
||||
assert f"signed and attested: {IMAGE}@{AMD}" not in result.stdout
|
||||
assert f"signed: {IMAGE}@{AMD} (amd64)" in result.stdout
|
||||
|
||||
def test_a_missing_expected_platform_stops_it(self, tmp_path):
|
||||
env = self._env(
|
||||
tmp_path, {"mediaType": "x"}, {"architecture": "amd64"}, EXPECT_PLATFORMS="amd64 arm64"
|
||||
|
||||
Reference in new issue
Block a user