1
Fork 0

Check whether images have changed

This commit is contained in:
Jake Howard 2020-10-05 20:56:06 +01:00
parent cdcf6de960
commit 02d51b8ebf
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 20 additions and 0 deletions

View file

@ -1,4 +1,5 @@
use std::collections::HashSet; use std::collections::HashSet;
use std::fmt;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::process::Command; use std::process::Command;
@ -39,3 +40,9 @@ impl ComposeProject {
stdout.trim().split('\n').map(String::from).collect() stdout.trim().split('\n').map(String::from).collect()
} }
} }
impl fmt::Display for ComposeProject {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.compose_file.display())
}
}

View file

@ -33,7 +33,20 @@ fn get_files(files: &[String]) -> Option<Vec<PathBuf>> {
} }
fn do_update(compose_project: compose::ComposeProject) { fn do_update(compose_project: compose::ComposeProject) {
info!("Processing {}...", compose_project);
let pre_images = compose_project.get_images();
if pre_images.is_empty() {
warn!("no running images, skipping");
return;
}
compose_project.pull(); compose_project.pull();
let post_images = compose_project.get_images();
if post_images == pre_images {
info!("No change to images");
}
} }
fn main() { fn main() {