mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-25 00:01:55 +00:00
fix(backend): only apply new flow node format on latest version
This commit is contained in:
@@ -254,6 +254,7 @@ lazy_static::lazy_static! {
|
||||
pub static ref MIN_VERSION_IS_AT_LEAST_1_427: Arc<RwLock<bool>> = Arc::new(RwLock::new(false));
|
||||
pub static ref MIN_VERSION_IS_AT_LEAST_1_432: Arc<RwLock<bool>> = Arc::new(RwLock::new(false));
|
||||
pub static ref MIN_VERSION_IS_AT_LEAST_1_440: Arc<RwLock<bool>> = Arc::new(RwLock::new(false));
|
||||
pub static ref MIN_VERSION_IS_AT_LEAST_1_560: Arc<RwLock<bool>> = Arc::new(RwLock::new(false));
|
||||
|
||||
// Features flags:
|
||||
pub static ref DISABLE_FLOW_SCRIPT: bool = std::env::var("DISABLE_FLOW_SCRIPT").ok().is_some_and(|x| x == "1" || x == "true");
|
||||
@@ -1069,6 +1070,7 @@ pub async fn update_min_version(conn: &Connection) -> bool {
|
||||
*MIN_VERSION_IS_AT_LEAST_1_427.write().await = min_version >= Version::new(1, 427, 0);
|
||||
*MIN_VERSION_IS_AT_LEAST_1_432.write().await = min_version >= Version::new(1, 432, 0);
|
||||
*MIN_VERSION_IS_AT_LEAST_1_440.write().await = min_version >= Version::new(1, 440, 0);
|
||||
*MIN_VERSION_IS_AT_LEAST_1_560.write().await = min_version >= Version::new(1, 560, 0);
|
||||
|
||||
*MIN_VERSION.write().await = min_version.clone();
|
||||
min_version >= cur_version
|
||||
|
||||
@@ -22,7 +22,9 @@ use windmill_common::jobs::JobPayload;
|
||||
use windmill_common::scripts::{hash_script, NewScript, ScriptHash};
|
||||
#[cfg(feature = "python")]
|
||||
use windmill_common::worker::PythonAnnotations;
|
||||
use windmill_common::worker::{to_raw_value, to_raw_value_owned, write_file, Connection};
|
||||
use windmill_common::worker::{
|
||||
to_raw_value, to_raw_value_owned, write_file, Connection, MIN_VERSION_IS_AT_LEAST_1_560,
|
||||
};
|
||||
#[cfg(feature = "python")]
|
||||
use windmill_parser_yaml::AnsibleRequirements;
|
||||
|
||||
@@ -1655,27 +1657,21 @@ async fn insert_flow_modules<'c>(
|
||||
return Ok(tx);
|
||||
}
|
||||
|
||||
let flow_node_flow = FlowNodeFlow {
|
||||
value: FlowValue {
|
||||
modules: std::mem::take(modules),
|
||||
failure_module: failure_module.cloned(),
|
||||
same_worker,
|
||||
..Default::default()
|
||||
},
|
||||
summary,
|
||||
let flow_value = FlowValue {
|
||||
modules: std::mem::take(modules),
|
||||
failure_module: failure_module.cloned(),
|
||||
same_worker,
|
||||
..Default::default()
|
||||
};
|
||||
let flow = if *MIN_VERSION_IS_AT_LEAST_1_560.read().await {
|
||||
to_raw_value(&FlowNodeFlow { value: flow_value, summary })
|
||||
} else {
|
||||
to_raw_value(&flow_value)
|
||||
};
|
||||
|
||||
let id;
|
||||
(tx, id) = insert_flow_node(
|
||||
tx,
|
||||
path,
|
||||
workspace_id,
|
||||
None,
|
||||
None,
|
||||
Some(&Json(to_raw_value(&flow_node_flow))),
|
||||
None,
|
||||
)
|
||||
.await?;
|
||||
(tx, id) =
|
||||
insert_flow_node(tx, path, workspace_id, None, None, Some(&Json(flow)), None).await?;
|
||||
*modules_node = Some(id);
|
||||
Ok(tx)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user