(image_ref: &str)
| 1613 | } |
| 1614 | |
| 1615 | fn 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)] |
| 1630 | mod tests { |
no test coverage detected