crates/common: enhance notifications and GC roots handling
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I8a19eeda480672f8f22adbafb3039db66a6a6964
This commit is contained in:
parent
2378ff6661
commit
a52c61556a
2 changed files with 6 additions and 9 deletions
|
|
@ -27,8 +27,8 @@ pub fn cleanup_old_roots(roots_dir: &Path, max_age: Duration) -> std::io::Result
|
||||||
Err(_) => continue,
|
Err(_) => continue,
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Ok(age) = now.duration_since(modified) {
|
if let Ok(age) = now.duration_since(modified)
|
||||||
if age > max_age {
|
&& age > max_age {
|
||||||
if let Err(e) = std::fs::remove_file(entry.path()) {
|
if let Err(e) = std::fs::remove_file(entry.path()) {
|
||||||
warn!(
|
warn!(
|
||||||
"Failed to remove old GC root {}: {e}",
|
"Failed to remove old GC root {}: {e}",
|
||||||
|
|
@ -38,7 +38,6 @@ pub fn cleanup_old_roots(roots_dir: &Path, max_age: Duration) -> std::io::Result
|
||||||
count += 1;
|
count += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(count)
|
Ok(count)
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,10 @@ pub async fn dispatch_build_finished(
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. GitHub commit status
|
// 2. GitHub commit status
|
||||||
if let Some(ref token) = config.github_token {
|
if let Some(ref token) = config.github_token
|
||||||
if project.repository_url.contains("github.com") {
|
&& project.repository_url.contains("github.com") {
|
||||||
set_github_status(token, &project.repository_url, commit_hash, build).await;
|
set_github_status(token, &project.repository_url, commit_hash, build).await;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 3. Gitea/Forgejo commit status
|
// 3. Gitea/Forgejo commit status
|
||||||
if let (Some(url), Some(token)) = (&config.gitea_url, &config.gitea_token) {
|
if let (Some(url), Some(token)) = (&config.gitea_url, &config.gitea_token) {
|
||||||
|
|
@ -30,11 +29,10 @@ pub async fn dispatch_build_finished(
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. Email notification
|
// 4. Email notification
|
||||||
if let Some(ref email_config) = config.email {
|
if let Some(ref email_config) = config.email
|
||||||
if !email_config.on_failure_only || build.status == BuildStatus::Failed {
|
&& (!email_config.on_failure_only || build.status == BuildStatus::Failed) {
|
||||||
send_email_notification(email_config, build, project).await;
|
send_email_notification(email_config, build, project).await;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn run_command_notification(cmd: &str, build: &Build, project: &Project) {
|
async fn run_command_notification(cmd: &str, build: &Build, project: &Project) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue