Skip to main content

parse_and_validate

Function parse_and_validate 

Source
pub fn parse_and_validate(
    bytes: &[u8],
    expected_version: &str,
) -> Result<ReleaseManifest, ReleaseManifestError>
Expand description

Parse release-images.yaml bytes and validate every integrity rule a manifest must satisfy before any of its digests are safe to pin a cluster to.

Checks, in order: the schema version is FORMAT_VERSION; the declared version matches expected_version (no leading v on either side); every entry’s image is exactly ghcr.io/officialunofficial/<name> with a valid lowercase name; every entry’s digest is a sha256:<64-hex> content address. All fail closed, naming the offending component/entry.

§Errors

Returns ReleaseManifestError::Yaml if bytes isn’t valid YAML matching the manifest shape, ReleaseManifestError::UnknownFormatVersion, ReleaseManifestError::VersionMismatch, ReleaseManifestError::MalformedImage, or ReleaseManifestError::MalformedDigest for the corresponding validation failure.