feat: enable checking if it should actually run
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:
parent
83294306a4
commit
03e23c7d9d
15
Cargo.lock
generated
15
Cargo.lock
generated
@ -382,6 +382,7 @@ dependencies = [
|
||||
"futures",
|
||||
"nodrift",
|
||||
"notmad",
|
||||
"petname",
|
||||
"prost",
|
||||
"prost-types",
|
||||
"reqwest",
|
||||
@ -1781,6 +1782,20 @@ version = "2.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
|
||||
|
||||
[[package]]
|
||||
name = "petname"
|
||||
version = "2.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9cd31dcfdbbd7431a807ef4df6edd6473228e94d5c805e8cf671227a21bad068"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap",
|
||||
"itertools",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rand",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project"
|
||||
version = "1.1.7"
|
||||
|
@ -37,3 +37,4 @@ reqwest = { version = "0.12.9", default-features = false, features = [
|
||||
serde_json = "1.0.133"
|
||||
wasmtime = "28.0.0"
|
||||
wasmtime-wasi = "28.0.0"
|
||||
petname = "2.0.2"
|
||||
|
@ -124,11 +124,21 @@ impl InnerPluginStore {
|
||||
pub async fn execute(&mut self, plugin: &str) -> anyhow::Result<()> {
|
||||
let plugin = self.ensure_plugin(plugin).await?;
|
||||
|
||||
plugin
|
||||
if plugin
|
||||
.interface0
|
||||
.call_execute(&mut self.store)
|
||||
.call_should_run(&mut self.store)
|
||||
.await
|
||||
.context("Failed to call add function")
|
||||
.context("Failed to call should run")?
|
||||
{
|
||||
tracing::info!("job was marked as required to run");
|
||||
return plugin
|
||||
.interface0
|
||||
.call_execute(&mut self.store)
|
||||
.await
|
||||
.context("Failed to call add function");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn ensure_plugin(&mut self, plugin: &str) -> anyhow::Result<Churn> {
|
||||
|
@ -31,6 +31,13 @@ pub async fn execute() -> anyhow::Result<()> {
|
||||
setup_labels.insert(k, v);
|
||||
}
|
||||
|
||||
if !setup_labels.contains_key("node_name") {
|
||||
setup_labels.insert(
|
||||
"node_name".into(),
|
||||
petname::petname(2, "-").expect("to be able to generate a valid petname"),
|
||||
);
|
||||
}
|
||||
|
||||
agent::setup_config(discovery, force, setup_labels).await?;
|
||||
tracing::info!("wrote default agent config");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user