Correct retrieval of LastTagTime when the Docker image doesn't already exist

This commit is contained in:
Luke Parker
2023-07-22 04:37:45 -04:00
parent d07447fe97
commit cb8c8031b0

View File

@@ -39,12 +39,14 @@ pub fn build(name: String) {
.arg(format!("serai-dev-{name}"))
.output()
{
let last_tag_time_buf = String::from_utf8(res.stdout).expect("docker had non-utf8 output");
let last_tag_time = last_tag_time_buf.trim();
if !last_tag_time.is_empty() {
let created_time = SystemTime::from(
chrono::DateTime::parse_and_remainder(
String::from_utf8(res.stdout).expect("docker had non-utf8 output").trim(),
"%F %T.%f %z",
)
.expect("docker formatted last tag time unexpectedly")
chrono::DateTime::parse_and_remainder(last_tag_time, "%F %T.%f %z")
.unwrap_or_else(|_| {
panic!("docker formatted last tag time unexpectedly: {last_tag_time}")
})
.0,
);
@@ -92,11 +94,12 @@ pub fn build(name: String) {
}
}
} else {
// Recursively crawl since we care when the folder's contents were edited, not the folder
// itself
// Recursively crawl since we care when the folder's contents were edited, not the
// folder itself
for entry in fs::read_dir(path.clone()).expect("couldn't read directory") {
metadatas
.push(meta(path.join(entry.expect("couldn't access item in directory").file_name())));
metadatas.push(meta(
path.join(entry.expect("couldn't access item in directory").file_name()),
));
}
}
}
@@ -110,6 +113,7 @@ pub fn build(name: String) {
}
}
}
}
println!("Building {}...", &name);