fix(backend): pass parent_path for trigger renames in git sync (#8059)

* fix(backend): pass parent_path for trigger renames in git sync

When renaming/moving a trigger path, the old path was not included in
the deployment metadata, so git sync never deleted the old file. This
adds parent_path to all 9 trigger DeployedObject variants and computes
it in update_trigger when the path changes.

Fixes #8014

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix path change with common prefix issue

* update ref

* chore: update ee-repo-ref to cb25312072c15c0e9cc375ebc824d41995a52898

This commit updates the EE repository reference after PR #428 was merged in windmill-ee-private.

Previous ee-repo-ref: 7225f7423311f58015a2fab61248c9d89888aef6

New ee-repo-ref: cb25312072c15c0e9cc375ebc824d41995a52898

Automated by sync-ee-ref workflow.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com>
This commit is contained in:
hugocasa
2026-02-25 09:01:59 +00:00
committed by GitHub
co-authored by Claude Opus 4.6 windmill-internal-app[bot]
parent 0d5851cbf7
commit a7d1e34619
13 changed files with 59 additions and 52 deletions
+1 -1
View File
@@ -1 +1 @@
0fede4b1086bc1456be9cc55b203228c979c5c5e
cb25312072c15c0e9cc375ebc824d41995a52898
+27 -27
View File
@@ -27,15 +27,15 @@ pub enum DeployedObject {
ResourceType { path: String },
User { email: String },
Group { name: String },
HttpTrigger { path: String },
WebsocketTrigger { path: String },
KafkaTrigger { path: String },
NatsTrigger { path: String },
PostgresTrigger { path: String },
MqttTrigger { path: String },
SqsTrigger { path: String },
GcpTrigger { path: String },
EmailTrigger { path: String },
HttpTrigger { path: String, parent_path: Option<String> },
WebsocketTrigger { path: String, parent_path: Option<String> },
KafkaTrigger { path: String, parent_path: Option<String> },
NatsTrigger { path: String, parent_path: Option<String> },
PostgresTrigger { path: String, parent_path: Option<String> },
MqttTrigger { path: String, parent_path: Option<String> },
SqsTrigger { path: String, parent_path: Option<String> },
GcpTrigger { path: String, parent_path: Option<String> },
EmailTrigger { path: String, parent_path: Option<String> },
Settings { setting_type: String },
Key { key_type: String },
}
@@ -54,15 +54,15 @@ impl DeployedObject {
DeployedObject::ResourceType { path, .. } => path.to_owned(),
DeployedObject::User { email } => format!("users/{email}"),
DeployedObject::Group { name } => format!("groups/{name}"),
DeployedObject::HttpTrigger { path } => path.to_owned(),
DeployedObject::WebsocketTrigger { path } => path.to_owned(),
DeployedObject::KafkaTrigger { path } => path.to_owned(),
DeployedObject::NatsTrigger { path } => path.to_owned(),
DeployedObject::PostgresTrigger { path } => path.to_owned(),
DeployedObject::MqttTrigger { path } => path.to_owned(),
DeployedObject::SqsTrigger { path } => path.to_owned(),
DeployedObject::GcpTrigger { path } => path.to_owned(),
DeployedObject::EmailTrigger { path } => path.to_owned(),
DeployedObject::HttpTrigger { path, .. } => path.to_owned(),
DeployedObject::WebsocketTrigger { path, .. } => path.to_owned(),
DeployedObject::KafkaTrigger { path, .. } => path.to_owned(),
DeployedObject::NatsTrigger { path, .. } => path.to_owned(),
DeployedObject::PostgresTrigger { path, .. } => path.to_owned(),
DeployedObject::MqttTrigger { path, .. } => path.to_owned(),
DeployedObject::SqsTrigger { path, .. } => path.to_owned(),
DeployedObject::GcpTrigger { path, .. } => path.to_owned(),
DeployedObject::EmailTrigger { path, .. } => path.to_owned(),
DeployedObject::Settings { .. } => "settings.yaml".to_string(),
DeployedObject::Key { .. } => "encryption_key.yaml".to_string(),
}
@@ -92,15 +92,15 @@ impl DeployedObject {
DeployedObject::ResourceType { .. } => None,
DeployedObject::User { .. } => None,
DeployedObject::Group { .. } => None,
DeployedObject::HttpTrigger { .. } => None,
DeployedObject::WebsocketTrigger { .. } => None,
DeployedObject::KafkaTrigger { .. } => None,
DeployedObject::NatsTrigger { .. } => None,
DeployedObject::PostgresTrigger { .. } => None,
DeployedObject::MqttTrigger { .. } => None,
DeployedObject::SqsTrigger { .. } => None,
DeployedObject::GcpTrigger { .. } => None,
DeployedObject::EmailTrigger { .. } => None,
DeployedObject::HttpTrigger { parent_path, .. } => parent_path.to_owned(),
DeployedObject::WebsocketTrigger { parent_path, .. } => parent_path.to_owned(),
DeployedObject::KafkaTrigger { parent_path, .. } => parent_path.to_owned(),
DeployedObject::NatsTrigger { parent_path, .. } => parent_path.to_owned(),
DeployedObject::PostgresTrigger { parent_path, .. } => parent_path.to_owned(),
DeployedObject::MqttTrigger { parent_path, .. } => parent_path.to_owned(),
DeployedObject::SqsTrigger { parent_path, .. } => parent_path.to_owned(),
DeployedObject::GcpTrigger { parent_path, .. } => parent_path.to_owned(),
DeployedObject::EmailTrigger { parent_path, .. } => parent_path.to_owned(),
DeployedObject::Settings { .. } => None,
DeployedObject::Key { .. } => None,
}
@@ -35,8 +35,8 @@ impl TriggerCrud for EmailTrigger {
const DEPLOYMENT_NAME: &'static str = "";
const IS_ALLOWED_ON_CLOUD: bool = false;
fn get_deployed_object(path: String) -> DeployedObject {
DeployedObject::EmailTrigger { path }
fn get_deployed_object(path: String, parent_path: Option<String>) -> DeployedObject {
DeployedObject::EmailTrigger { path, parent_path }
}
async fn create_trigger(
@@ -32,8 +32,8 @@ impl TriggerCrud for GcpTrigger {
const DEPLOYMENT_NAME: &'static str = "";
const IS_ALLOWED_ON_CLOUD: bool = false;
fn get_deployed_object(path: String) -> DeployedObject {
DeployedObject::GcpTrigger { path }
fn get_deployed_object(path: String, parent_path: Option<String>) -> DeployedObject {
DeployedObject::GcpTrigger { path, parent_path }
}
async fn create_trigger(
+3 -3
View File
@@ -276,7 +276,7 @@ pub async fn create_many_http_triggers(
&authed.username,
&db,
&w_id,
DeployedObject::HttpTrigger { path: http_trigger.base.path.clone() },
DeployedObject::HttpTrigger { path: http_trigger.base.path.clone(), parent_path: None },
Some(format!("HTTP trigger '{}' created", http_trigger.base.path)),
true,
None,
@@ -344,8 +344,8 @@ impl TriggerCrud for HttpTrigger {
"raw_string",
];
fn get_deployed_object(path: String) -> DeployedObject {
DeployedObject::HttpTrigger { path }
fn get_deployed_object(path: String, parent_path: Option<String>) -> DeployedObject {
DeployedObject::HttpTrigger { path, parent_path }
}
fn additional_routes(&self) -> Router {
@@ -35,8 +35,8 @@ impl TriggerCrud for KafkaTrigger {
const DEPLOYMENT_NAME: &'static str = "";
const IS_ALLOWED_ON_CLOUD: bool = false;
fn get_deployed_object(path: String) -> DeployedObject {
DeployedObject::KafkaTrigger { path }
fn get_deployed_object(path: String, parent_path: Option<String>) -> DeployedObject {
DeployedObject::KafkaTrigger { path, parent_path }
}
async fn create_trigger(
+2 -2
View File
@@ -39,8 +39,8 @@ impl TriggerCrud for MqttTrigger {
];
const IS_ALLOWED_ON_CLOUD: bool = false;
fn get_deployed_object(path: String) -> DeployedObject {
DeployedObject::MqttTrigger { path }
fn get_deployed_object(path: String, parent_path: Option<String>) -> DeployedObject {
DeployedObject::MqttTrigger { path, parent_path }
}
async fn validate_config(
@@ -35,8 +35,8 @@ impl TriggerCrud for NatsTrigger {
const DEPLOYMENT_NAME: &'static str = "";
const IS_ALLOWED_ON_CLOUD: bool = false;
fn get_deployed_object(path: String) -> DeployedObject {
DeployedObject::NatsTrigger { path }
fn get_deployed_object(path: String, parent_path: Option<String>) -> DeployedObject {
DeployedObject::NatsTrigger { path, parent_path }
}
async fn create_trigger(
@@ -58,8 +58,8 @@ impl TriggerCrud for PostgresTrigger {
];
const IS_ALLOWED_ON_CLOUD: bool = false;
fn get_deployed_object(path: String) -> DeployedObject {
DeployedObject::PostgresTrigger { path }
fn get_deployed_object(path: String, parent_path: Option<String>) -> DeployedObject {
DeployedObject::PostgresTrigger { path, parent_path }
}
async fn create_trigger(
@@ -32,8 +32,8 @@ impl TriggerCrud for SqsTrigger {
const DEPLOYMENT_NAME: &'static str = "";
const IS_ALLOWED_ON_CLOUD: bool = false;
fn get_deployed_object(path: String) -> DeployedObject {
DeployedObject::SqsTrigger { path }
fn get_deployed_object(path: String, parent_path: Option<String>) -> DeployedObject {
DeployedObject::SqsTrigger { path, parent_path }
}
async fn create_trigger(
@@ -43,8 +43,8 @@ impl TriggerCrud for WebsocketTrigger {
];
const IS_ALLOWED_ON_CLOUD: bool = false;
fn get_deployed_object(path: String) -> DeployedObject {
DeployedObject::WebsocketTrigger { path }
fn get_deployed_object(path: String, parent_path: Option<String>) -> DeployedObject {
DeployedObject::WebsocketTrigger { path, parent_path }
}
async fn validate_config(
+10 -4
View File
@@ -61,7 +61,7 @@ pub trait TriggerCrud: Send + Sync + 'static {
const ADDITIONAL_SELECT_FIELDS: &[&'static str] = &[];
const IS_ALLOWED_ON_CLOUD: bool;
fn get_deployed_object(path: String) -> DeployedObject;
fn get_deployed_object(path: String, parent_path: Option<String>) -> DeployedObject;
async fn validate_new(
&self,
@@ -437,7 +437,7 @@ async fn create_trigger<T: TriggerCrud>(
&authed.username,
&db,
&workspace_id,
T::get_deployed_object(new_path.clone()),
T::get_deployed_object(new_path.clone(), None),
Some(format!("{} '{}' created", T::DEPLOYMENT_NAME, new_path)),
true,
None,
@@ -526,12 +526,18 @@ async fn update_trigger<T: TriggerCrud>(
)
.await?;
let parent_path = if path != new_path {
Some(path.to_string())
} else {
None
};
handle_deployment_metadata(
&authed.email,
&authed.username,
&db,
&workspace_id,
T::get_deployed_object(new_path.clone()),
T::get_deployed_object(new_path.clone(), parent_path),
Some(format!("{} '{}' updated", T::DEPLOYMENT_NAME, new_path)),
true,
None,
@@ -632,7 +638,7 @@ async fn set_trigger_mode<T: TriggerCrud>(
&authed.username,
&db,
&workspace_id,
T::get_deployed_object(path.to_owned()),
T::get_deployed_object(path.to_owned(), None),
Some(format!("{} trigger '{}' updated", T::DEPLOYMENT_NAME, path)),
true,
None,
+2 -1
View File
@@ -20,7 +20,8 @@
"gitSync_18": "hub/28078/sync-script-to-git-repo-windmill",
"gitSync_19": "hub/28081/sync-script-to-git-repo-windmill",
"gitSync_20": "hub/28102/sync-script-to-git-repo-windmill",
"gitSync": "hub/28131/sync-script-to-git-repo-windmill",
"gitSync_21": "hub/28131/sync-script-to-git-repo-windmill",
"gitSync": "hub/28159/sync-script-to-git-repo-windmill",
"gitSyncTest": "hub/19799/git-repo-test-read-write-windmill",
"gitInitRepo_0": "hub/28134/git-sync%3A-init-repository-windmill",
"gitInitRepo": "hub/28158/git-sync%3A-init-repository-windmill",