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:
@@ -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");
|
||||
}
|
||||
|
Reference in New Issue
Block a user