feat: add labels to config
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use anyhow::Context;
|
||||
use apt::AptTask;
|
||||
|
||||
use super::task::{IntoTask, Task};
|
||||
use super::task::IntoTask;
|
||||
|
||||
pub struct Plan {}
|
||||
impl Plan {
|
||||
@@ -13,48 +13,4 @@ impl Plan {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct AptTask {}
|
||||
|
||||
impl AptTask {
|
||||
pub fn new() -> Self {
|
||||
Self {}
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl Task for AptTask {
|
||||
fn id(&self) -> String {
|
||||
"apt".into()
|
||||
}
|
||||
|
||||
async fn execute(&self) -> anyhow::Result<()> {
|
||||
let mut cmd = tokio::process::Command::new("apt-get");
|
||||
cmd.args(["update", "-q"]);
|
||||
let output = cmd.output().await.context("failed to run apt update")?;
|
||||
match output.status.success() {
|
||||
true => tracing::info!("successfully ran apt update"),
|
||||
false => {
|
||||
anyhow::bail!(
|
||||
"failed to run apt update: {}",
|
||||
std::str::from_utf8(&output.stderr)?
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let mut cmd = tokio::process::Command::new("apt-get");
|
||||
cmd.env("DEBIAN_FRONTEND", "noninteractive")
|
||||
.args(["upgrade", "-y"]);
|
||||
let output = cmd.output().await.context("failed to run apt upgrade")?;
|
||||
match output.status.success() {
|
||||
true => tracing::info!("successfully ran apt upgrade"),
|
||||
false => {
|
||||
anyhow::bail!(
|
||||
"failed to run apt upgrade: {}",
|
||||
std::str::from_utf8(&output.stderr)?
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
pub mod apt;
|
||||
|
Reference in New Issue
Block a user