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

fix: check extra references specified in config

Fixes #81
This commit is contained in:
Sergio
2025-03-26 16:54:54 +02:00
parent 806364f01d
commit f886601185

View File

@@ -81,20 +81,29 @@ async fn get_remote_updates(ctx: &Context, client: &Client, refresh: bool) -> Ve
/// Returns a list of updates for all images passed in.
pub async fn get_updates(
references: &Option<Vec<String>>,
references: &Option<Vec<String>>, // If a user requested _specific_ references to be checked, this will have a value
refresh: bool,
ctx: &Context,
) -> Vec<Update> {
let client = Client::new(ctx);
// Merge references argument with references from config
let all_references = match &references {
Some(refs) => {
refs.clone().extend_from_slice(&ctx.config.images.extra);
refs
}
None => &ctx.config.images.extra,
};
// Get local images
ctx.logger.debug("Retrieving images to be checked");
let mut images = get_images_from_docker_daemon(ctx, references).await;
// Add extra images from references
if let Some(refs) = references {
if !all_references.is_empty() {
let image_refs: FxHashSet<&String> = images.iter().map(|image| &image.reference).collect();
let extra = refs
let extra = all_references
.iter()
.filter(|&reference| !image_refs.contains(reference))
.map(|reference| Image::from_reference(reference))