m/cup
1
0
mirror of https://github.com/sergi0g/cup.git synced 2025-11-17 01:23:39 -05:00

Tiny improvement to version handling, add a new debug log

This commit is contained in:
Sergio
2025-02-01 10:28:17 +02:00
parent 4bbb53cd67
commit b5aa0309ee
2 changed files with 10 additions and 4 deletions

View File

@@ -182,7 +182,10 @@ pub async fn get_latest_tag(
Some(t) => {
if t == base && image.digest_info.is_some() {
// Tags are equal so we'll compare digests
debug!(config.debug, "Tags for {} are equal, comparing digests.", image.reference);
debug!(
config.debug,
"Tags for {} are equal, comparing digests.", image.reference
);
get_latest_digest(
&Image {
version_info: Some(VersionInfo {

View File

@@ -47,17 +47,20 @@ impl Version {
let major: u32 = match c.name("major") {
Some(major) => {
positions.push((major.start(), major.end()));
major.as_str().parse().unwrap()
match major.as_str().parse() {
Ok(m) => m,
Err(_) => return None
}
}
None => return None,
};
let minor: Option<u32> = c.name("minor").map(|minor| {
positions.push((minor.start(), minor.end()));
minor.as_str().parse().unwrap()
minor.as_str().parse().expect(&format!("Minor version invalid in tag {}", tag))
});
let patch: Option<u32> = c.name("patch").map(|patch| {
positions.push((patch.start(), patch.end()));
patch.as_str().parse().unwrap()
patch.as_str().parse().expect(&format!("Patch version invalid in tag {}", tag))
});
let mut format_str = tag.to_string();
positions.reverse();