Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ incremental = true
lto = "thin"

[features]
default = []
default = ["enterprise", "private", "python", "license"]
private = ["windmill-api/private", "windmill-autoscaling/private", "windmill-common/private", "windmill-git-sync/private", "windmill-indexer/private", "windmill-queue/private", "windmill-worker/private"]
agent_worker_server = ["windmill-api/agent_worker_server"]
enterprise = ["windmill-worker/enterprise", "windmill-queue/enterprise", "windmill-api/enterprise", "dep:windmill-autoscaling", "windmill-autoscaling/enterprise", "windmill-git-sync/enterprise", "windmill-common/prometheus", "windmill-common/enterprise"]
Expand Down
2 changes: 1 addition & 1 deletion backend/ee-repo-ref.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5c2a8854e7ff014063a69dd8f7829a935129c31e
a46502cd9e494c67866ec9095a49bb1873448eb1
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, 999, 0); // todo
*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
27 changes: 26 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,31 @@ 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: u32 = self
.script_path
.split("/") // -> ["hub" "28102" "sync-script-to-git-repo-windmill"]
.skip(1) // emit "hub"
.next() // get numeric id
.ok_or(Error::InternalErr(format!(
"cannot get script version id from: {}",
&self.script_path
)))
.and_then(|s| {
s.parse().map_err(|e| {
Error::InternalErr(format!(
"cannot get script version id from: {}. e: {e}",
&self.script_path
))
})
})?;

Ok(current >= min_version) // this works on assumption that all scripts in hub have sequential ids
}
Comment on lines 67 to 89
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concern: Assumption about sequential hub script IDs

The comment states this "works on assumption that all scripts in hub have sequential ids". This assumption may be fragile:

  1. Hub scripts could be deleted - IDs might not be strictly sequential
  2. Different hub scripts - Not all hub scripts are the sync script; comparing IDs across different scripts doesn't indicate version
  3. Non-hub paths - If script_path doesn't follow the hub/{id}/{name} format, this will fail

Consider adding more robust error handling or documentation about when this method should be called and what guarantees exist about hub script ID ordering.

}

#[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 @@ -4833,14 +4833,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