MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / parse_image_ref

Function parse_image_ref

src/cloud-resources/src/crd/materialize.rs:1615–1627  ·  view source on GitHub ↗
(image_ref: &str)

Source from the content-addressed store, hash-verified

1613}
1614
1615fn parse_image_ref(image_ref: &str) -> Option<Version> {
1616 image_ref
1617 .rsplit_once(':')
1618 .and_then(|(_repo, tag)| tag.strip_prefix('v'))
1619 .and_then(|tag| {
1620 // To work around Docker tag restrictions, build metadata in
1621 // a Docker tag is delimited by `--` rather than the SemVer
1622 // `+` delimiter. So we need to swap the delimiter back to
1623 // `+` before parsing it as SemVer.
1624 let tag = tag.replace("--", "+");
1625 Version::parse(&tag).ok()
1626 })
1627}
1628
1629#[cfg(test)]
1630mod tests {

Callers 2

meets_minimum_versionMethod · 0.85
within_upgrade_windowMethod · 0.85

Calls 3

parseFunction · 0.50
replaceMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected