mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-12 08:05:44 +00:00
fix(git-sync): skip deleted/archived workspaces in the auto-pull poller
The poller scanned workspace_settings directly, so an archived (soft-deleted) or renamed-away workspace — whose settings row persists — kept polling and could enqueue a pull into a dead workspace. Join workspace and require NOT deleted. The EE webhook receiver gets the same filter (ee ref bumped). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PP5gBSPfo1YtkL1sWVAjJm
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
ec7ee12ac2
commit
e4856faea0
+26
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "SELECT ws.workspace_id, ws.git_sync\n FROM workspace_settings ws\n JOIN workspace w ON w.id = ws.workspace_id\n WHERE NOT w.deleted\n AND ws.git_sync IS NOT NULL\n AND ws.git_sync->'repositories' @> '[{\"auto_pull\": {\"enabled\": true}}]'::jsonb",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "workspace_id",
|
||||
"type_info": "Varchar"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "git_sync",
|
||||
"type_info": "Jsonb"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": []
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "bfbc368c751c8532792ae0a77ed570a14d22ed2a776efa111ad53aa9e77eadf1"
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "SELECT ws.git_sync FROM workspace_settings ws\n JOIN workspace w ON w.id = ws.workspace_id\n WHERE ws.workspace_id = $1 AND NOT w.deleted",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "git_sync",
|
||||
"type_info": "Jsonb"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "c92c08a4b4c06d087c2590081db78f7253e4470287810d7ee13b8519f54b997f"
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
6e2f282fe951cfbbab9d4b831d0e550bb1952854
|
||||
bdc29c9c3a63891677ac01b1baab41753ea0ec45
|
||||
|
||||
+10
-4
@@ -3141,11 +3141,17 @@ const AUTO_PULL_POLL_SLACK_S: i64 = 30;
|
||||
async fn poll_git_auto_pull_inner(db: &Pool<Postgres>) -> error::Result<()> {
|
||||
use windmill_common::workspaces::{AutoPullMode, WorkspaceGitSyncSettings};
|
||||
|
||||
// Join `workspace` and skip deleted/archived ones: their `workspace_settings`
|
||||
// rows persist (archive is a soft delete, and change_workspace_id leaves the old
|
||||
// id as an archived shell), so an auto-pull repo would otherwise keep polling and
|
||||
// deploying into a dead workspace.
|
||||
let rows = sqlx::query!(
|
||||
r#"SELECT workspace_id, git_sync
|
||||
FROM workspace_settings
|
||||
WHERE git_sync IS NOT NULL
|
||||
AND git_sync->'repositories' @> '[{"auto_pull": {"enabled": true}}]'::jsonb"#
|
||||
r#"SELECT ws.workspace_id, ws.git_sync
|
||||
FROM workspace_settings ws
|
||||
JOIN workspace w ON w.id = ws.workspace_id
|
||||
WHERE NOT w.deleted
|
||||
AND ws.git_sync IS NOT NULL
|
||||
AND ws.git_sync->'repositories' @> '[{"auto_pull": {"enabled": true}}]'::jsonb"#
|
||||
)
|
||||
.fetch_all(db)
|
||||
.await?;
|
||||
|
||||
Reference in New Issue
Block a user