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