-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch main into improve-logging
- Loading branch information
Showing
8 changed files
with
837 additions
and
308 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,41 @@ | ||
use bollard::secret::ImageSummary; | ||
|
||
use crate::{ | ||
debug, | ||
utils::{split_image, CliConfig}, | ||
}; | ||
|
||
#[derive(Clone, Debug)] | ||
pub struct Image { | ||
pub registry: String, | ||
pub repository: String, | ||
pub tag: String, | ||
pub digest: Option<String>, | ||
} | ||
|
||
impl Image { | ||
pub async fn from(image: ImageSummary, options: &CliConfig) -> Option<Self> { | ||
if !image.repo_tags.is_empty() && !image.repo_digests.is_empty() { | ||
let (registry, repository, tag) = split_image(&image.repo_tags[0]); | ||
let image = Image { | ||
registry, | ||
repository, | ||
tag, | ||
digest: Some( | ||
image.repo_digests[0] | ||
.clone() | ||
.split('@') | ||
.collect::<Vec<&str>>()[1] | ||
.to_string(), | ||
), | ||
}; | ||
return Some(image); | ||
} else if options.verbose { | ||
debug!( | ||
"Skipped an image\nTags: {:#?}\nDigests: {:#?}", | ||
image.repo_tags, image.repo_digests | ||
) | ||
} | ||
None | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.