From ecc598788a359e25b4b8de8ae6a211d2a7c38108 Mon Sep 17 00:00:00 2001 From: Bill Date: Sun, 9 Nov 2025 21:32:11 -0500 Subject: [PATCH] Fix wmill sync authentication by using CLI flags Replace environment variable authentication (WM_TOKEN, WM_WORKSPACE, WM_BASE_URL) with explicit command-line flags (--token, --workspace, --base-url) as required by wmill CLI. According to wmill documentation, when using --base-url, the --token and --workspace flags are required and no local workspace configuration will be used. This is the correct approach for a stateless containerized service where credentials are passed per-request. This fixes the exit code 255 error that occurred when wmill tried to run sync without proper workspace configuration. --- app/sync.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/sync.py b/app/sync.py index 03ee56c..45a790b 100644 --- a/app/sync.py +++ b/app/sync.py @@ -59,17 +59,18 @@ def run_wmill_sync(config: Dict[str, Any]) -> bool: logger.info(f"Syncing Windmill workspace '{workspace}' from {WINDMILL_BASE_URL}") - env = os.environ.copy() - env['WM_BASE_URL'] = WINDMILL_BASE_URL - env['WM_TOKEN'] = windmill_token - env['WM_WORKSPACE'] = workspace - try: - # Run wmill sync in the workspace directory + # Run wmill sync in the workspace directory with explicit flags + # Note: When using --base-url, --token and --workspace are required result = subprocess.run( - ['wmill', 'sync', 'pull', '--yes'], + [ + 'wmill', 'sync', 'pull', + '--base-url', WINDMILL_BASE_URL, + '--token', windmill_token, + '--workspace', workspace, + '--yes' + ], cwd=WORKSPACE_DIR, - env=env, capture_output=True, text=True, check=True