Check whether images have changed
This commit is contained in:
parent
cdcf6de960
commit
02d51b8ebf
2 changed files with 20 additions and 0 deletions
|
@ -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())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
13
src/main.rs
13
src/main.rs
|
@ -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() {
|
||||||
|
|
Reference in a new issue