From 7dc27527576ac7e6241ae446e775f30fecf00af2 Mon Sep 17 00:00:00 2001 From: Eric Trombly Date: Tue, 19 May 2026 14:45:26 -0500 Subject: [PATCH 1/2] allow empty artifact list in notifier --- veno-core/src/app.rs | 9 ++++++++- veno-core/src/notifier/mod.rs | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/veno-core/src/app.rs b/veno-core/src/app.rs index 4ef5800..7c69ebd 100644 --- a/veno-core/src/app.rs +++ b/veno-core/src/app.rs @@ -18,9 +18,16 @@ pub struct AppState { impl AppState { pub fn init(file_path: &str) -> Result { let app_config = AppConfig::load(file_path)?; - let app_state = app_config + let mut app_state: AppState = app_config .try_deserialize() .context("Could not deserialize app config")?; + + for notifier in &mut app_state.notifiers { + if notifier.artifact_ids.is_empty() { + notifier.artifact_ids = app_state.artifacts.iter().map(|x| x.id.clone()).collect(); + } + } + Ok(app_state) } diff --git a/veno-core/src/notifier/mod.rs b/veno-core/src/notifier/mod.rs index 98a81db..dbda26f 100644 --- a/veno-core/src/notifier/mod.rs +++ b/veno-core/src/notifier/mod.rs @@ -15,6 +15,7 @@ static DEFAULT_MESSAGE_PREFIX: &str = "New version available for"; pub struct Notifier { pub name: String, pub sink: Sink, + #[serde(default)] pub artifact_ids: Vec, } From 0f5c79b94e5996a956493125df0eab1f8c6f23e7 Mon Sep 17 00:00:00 2001 From: Eric Trombly Date: Thu, 11 Jun 2026 15:03:30 -0500 Subject: [PATCH 2/2] change to using "artifact_ids": "all" to check all artifacts --- veno-core/src/app.rs | 8 +------- veno-core/src/notifier/mod.rs | 25 +++++++++++++++++++++++-- veno-web/src/api/notifiers/model.rs | 28 +++++++++++++++++++++++++--- 3 files changed, 49 insertions(+), 12 deletions(-) diff --git a/veno-core/src/app.rs b/veno-core/src/app.rs index 7c69ebd..57174cb 100644 --- a/veno-core/src/app.rs +++ b/veno-core/src/app.rs @@ -18,16 +18,10 @@ pub struct AppState { impl AppState { pub fn init(file_path: &str) -> Result { let app_config = AppConfig::load(file_path)?; - let mut app_state: AppState = app_config + let app_state: AppState = app_config .try_deserialize() .context("Could not deserialize app config")?; - for notifier in &mut app_state.notifiers { - if notifier.artifact_ids.is_empty() { - notifier.artifact_ids = app_state.artifacts.iter().map(|x| x.id.clone()).collect(); - } - } - Ok(app_state) } diff --git a/veno-core/src/notifier/mod.rs b/veno-core/src/notifier/mod.rs index dd35e8b..90e3216 100644 --- a/veno-core/src/notifier/mod.rs +++ b/veno-core/src/notifier/mod.rs @@ -17,8 +17,29 @@ static DEFAULT_MESSAGE_PREFIX: &str = "New version available for"; pub struct Notifier { pub name: String, pub sink: Sink, - #[serde(default)] - pub artifact_ids: Vec, + pub artifact_ids: ArtifactSelection, +} + +#[derive(Deserialize, Debug, Clone)] +#[serde(untagged)] +pub enum ArtifactSelection { + All(AllMarker), + Specific(Vec), +} + +impl ArtifactSelection { + pub fn contains(&self, other: &str) -> bool { + match self { + ArtifactSelection::All(_) => true, + ArtifactSelection::Specific(ids) => ids.contains(&other.to_string()), + } + } +} + +#[derive(Deserialize, Debug, Clone)] +#[serde(rename_all = "lowercase")] +pub enum AllMarker { + All, } #[derive(Deserialize, Debug, Clone)] diff --git a/veno-web/src/api/notifiers/model.rs b/veno-web/src/api/notifiers/model.rs index ff7379a..bf652a0 100644 --- a/veno-web/src/api/notifiers/model.rs +++ b/veno-web/src/api/notifiers/model.rs @@ -1,12 +1,12 @@ use serde::Serialize; use utoipa::ToSchema; -use veno_core::notifier::{Notifier, Sink}; +use veno_core::notifier::{ArtifactSelection, Notifier, Sink}; #[derive(Serialize, Debug, Clone, ToSchema)] pub struct NotifierResponse { pub name: String, pub sink: SinkDto, - pub artifact_ids: Vec, + pub artifact_ids: ArtifactSelectionDto, } #[derive(Serialize, Debug, Clone, ToSchema)] @@ -24,6 +24,19 @@ pub enum SinkDto { Console(ConsoleSink), } +#[derive(Serialize, Debug, Clone, ToSchema)] +#[serde(untagged)] +pub enum ArtifactSelectionDto { + All(AllMarker), + Specific(Vec), +} + +#[derive(Serialize, Debug, Clone, ToSchema)] +#[serde(rename_all = "lowercase")] +pub enum AllMarker { + All, +} + #[derive(Debug, Clone, Serialize, ToSchema)] pub struct SlackSink { pub webhook: String, @@ -56,7 +69,7 @@ impl From for NotifierResponse { Self { name: value.name, sink: value.sink.into(), - artifact_ids: value.artifact_ids, + artifact_ids: value.artifact_ids.into(), } } } @@ -84,3 +97,12 @@ impl From for SinkDto { } } } + +impl From for ArtifactSelectionDto { + fn from(value: ArtifactSelection) -> Self { + match value { + ArtifactSelection::All(_) => ArtifactSelectionDto::All(AllMarker::All), + ArtifactSelection::Specific(x) => ArtifactSelectionDto::Specific(x), + } + } +}