Skip to content
Merged
2 changes: 1 addition & 1 deletion backend/ee-repo-ref.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ea468d0b673257c694203517b0c5df52d9cb70dd
bc904859dd66c55ebad002e8526103c73de841cd
2 changes: 1 addition & 1 deletion backend/windmill-common/src/jobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ pub enum JobPayload {
},
DeploymentCallback {
path: String,
// debouncing_settings: Option<DebouncingSettings>,
debouncing_settings: DebouncingSettings,
},
Identity,
Noop,
Expand Down
3 changes: 3 additions & 0 deletions backend/windmill-common/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ lazy_static::lazy_static! {
.unwrap_or(false);

pub static ref MIN_VERSION: Arc<RwLock<Version>> = Arc::new(RwLock::new(Version::new(0, 0, 0)));
pub static ref MIN_VERSION_SUPPORTS_SYNC_JOBS_DEBOUNCING: Arc<RwLock<bool>> = Arc::new(RwLock::new(false));
pub static ref MIN_VERSION_SUPPORTS_DEBOUNCING_V2: Arc<RwLock<bool>> = Arc::new(RwLock::new(false));
pub static ref MIN_VERSION_SUPPORTS_RUNNABLE_SETTINGS_V0: Arc<RwLock<bool>> = Arc::new(RwLock::new(false));
/// Global flag indicating if all workers support workspace dependencies feature (>= 1.583.0)
Expand Down Expand Up @@ -1295,6 +1296,8 @@ pub async fn update_min_version(conn: &Connection) -> bool {
tracing::info!("Minimal worker version: {min_version}");
}

*MIN_VERSION_SUPPORTS_SYNC_JOBS_DEBOUNCING.write().await =
min_version >= Version::new(1, 602, 0);
*MIN_VERSION_SUPPORTS_DEBOUNCING_V2.write().await = min_version >= Version::new(1, 597, 0);
*MIN_VERSION_SUPPORTS_RUNNABLE_SETTINGS_V0.write().await =
min_version >= *crate::runnable_settings::MIN_VERSION_RUNNABLE_SETTINGS_V0;
Expand Down
28 changes: 27 additions & 1 deletion backend/windmill-common/src/workspaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
use strum::AsRefStr;

use crate::{
error::{to_anyhow, Error, Result},
error::{self, to_anyhow, Error, Result},
get_database_url,
utils::get_custom_pg_instance_password,
variables::{build_crypt, decrypt},
Expand Down Expand Up @@ -63,6 +63,32 @@ pub struct GitRepositorySettings {
pub settings: Option<GitSyncSettings>,
}

impl GitRepositorySettings {
pub fn is_script_meets_min_version(&self, min_version: u32) -> error::Result<bool> {
// example: "hub/28102/sync-script-to-git-repo-windmill"
let current = self
.script_path
.split("/") // -> ["hub" "28102" "sync-script-to-git-repo-windmill"]
.skip(1) // omit "hub"
.next() // get numeric id
.ok_or(Error::InternalErr(format!(
"cannot get script version id from: {}",
&self.script_path
)))?
.parse()
.unwrap_or_else(|e| {
tracing::warn!(
"cannot get script version id from: {}. e: {e}",
&self.script_path
);

u32::MAX
});

Ok(current >= min_version) // this works on assumption that all scripts in hub have sequential ids
}
}

#[derive(Serialize, Deserialize, Debug)]
pub struct GitSyncSettings {
pub include_path: Vec<String>,
Expand Down
3 changes: 2 additions & 1 deletion backend/windmill-queue/src/jobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4843,14 +4843,15 @@ pub async fn push<'c, 'd>(
..Default::default()
}
}
JobPayload::DeploymentCallback { path } => JobPayloadUntagged {
JobPayload::DeploymentCallback { path, debouncing_settings } => JobPayloadUntagged {
runnable_path: Some(path.clone()),
job_kind: JobKind::DeploymentCallback,
concurrency_settings: ConcurrencySettings {
concurrency_key: Some(format!("{workspace_id}:git_sync")),
concurrent_limit: Some(1),
concurrency_time_window_s: Some(0),
},
debouncing_settings,
..Default::default()
},
JobPayload::Identity => {
Expand Down
Loading