Auto-sync Fri Feb 13 08:51:24 UTC 2026
This commit is contained in:
@@ -1,94 +1,22 @@
|
||||
#!/bin/bash
|
||||
set -x
|
||||
exec > >(tee -a /tmp/debug_script.log) 2>&1
|
||||
export WM_BASE_URL="http://windmill_server:8000"
|
||||
export WM_WORKSPACE="admins"
|
||||
export PATH=$HOME/.npm-global/bin:$PATH
|
||||
|
||||
echo "=== Windmill Workflow Git Sync ==="
|
||||
echo "=== START SYNC ==="
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configuration & Checks
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# Ensure Windmill CLI variables are set
|
||||
if [[ -z "${WM_TOKEN}" ]]; then
|
||||
echo "Warning: WM_TOKEN is not set. attempting to continue assuming ~/.config/windmill/config.toml exists."
|
||||
echo "If this fails, please set WM_TOKEN and WM_BASE_URL variables in the Windmill workspace settings or workflow input."
|
||||
fi
|
||||
|
||||
# Configure Git for the container
|
||||
# This is necessary because the script runs inside a Docker container
|
||||
# where the global git config might not be set.
|
||||
echo "Configuring Git..."
|
||||
git config --global --add safe.directory /workspace
|
||||
if [ -z "$(git config --global user.email)" ]; then
|
||||
git config --global user.email "windmill-bot@example.com"
|
||||
git config --global user.name "Windmill Bot"
|
||||
fi
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Execution
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# Move to workspace directory (mapped to /home/akira/develop/windmill)
|
||||
# We need to be in the workflows directory where wmill.yaml is likely located
|
||||
# to ensure configuration (like includeSchedules) is respected.
|
||||
if [ -d "/workspace/workflows" ]; then
|
||||
cd /workspace/workflows
|
||||
elif [ -d "/workspace" ]; then
|
||||
cd /workspace
|
||||
else
|
||||
echo "Error: /workspace directory not found. Is the volume mounted correctly?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set PATH to ensure wmill is available
|
||||
export PATH=~/.npm-global/bin:$PATH
|
||||
|
||||
# Check if wmill is available
|
||||
if ! command -v wmill &> /dev/null; then
|
||||
echo "wmill command not found. Attempting to install windmill-client..."
|
||||
# Try installing using pip if npm is not available, or npm
|
||||
if command -v npm &> /dev/null; then
|
||||
npm install -g windmill-cli
|
||||
else
|
||||
echo "Error: npm not found. Cannot install wmill client."
|
||||
exit 1
|
||||
fi
|
||||
npm install -g windmill-cli
|
||||
fi
|
||||
|
||||
# Pull latest from Windmill
|
||||
echo "Pulling from Windmill..."
|
||||
# wmill sync pull will use the workspace defined in wmill.yaml or env vars.
|
||||
# We add --yes to avoid prompts.
|
||||
if wmill sync pull --skip-variables --skip-secrets --skip-resources --yes --verbose; then
|
||||
echo "Successfully pulled from Windmill."
|
||||
else
|
||||
echo "Error: wmill sync pull failed. Check your WM_TOKEN and connection."
|
||||
exit 1
|
||||
fi
|
||||
wmill sync pull --token "$WM_TOKEN" --base-url "$WM_BASE_URL" --workspace "$WM_WORKSPACE" --skip-variables --skip-secrets --skip-resources --yes --verbose || exit 1
|
||||
|
||||
git config --global --add safe.directory /workspace
|
||||
git config --global user.email "bot@example.com"
|
||||
git config --global user.name "Bot"
|
||||
|
||||
# Check for changes
|
||||
# Force add everything first to capture untracked files
|
||||
git add .
|
||||
git commit -m "Auto-sync $(date)" || echo "No changes"
|
||||
|
||||
if [[ -n $(git status --porcelain) ]]; then
|
||||
echo "Changes detected, committing to Git..."
|
||||
|
||||
# Commit
|
||||
TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')
|
||||
|
||||
# Use explicit config to ensure commit works even if global config fails
|
||||
if git -c user.email="windmill-bot@example.com" -c user.name="Windmill Bot" commit -m "Auto-sync: ${TIMESTAMP}
|
||||
|
||||
Synced workflows from Windmill workspace"; then
|
||||
echo "✓ Changes committed to Git"
|
||||
echo "Successfully synced and committed changes at ${TIMESTAMP}"
|
||||
else
|
||||
echo "Error: Git commit failed."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "✓ No changes detected"
|
||||
echo "No changes to commit"
|
||||
fi
|
||||
|
||||
echo "=== Sync Complete ==="
|
||||
echo "=== END SYNC ==="
|
||||
|
||||
@@ -3,6 +3,8 @@ locks:
|
||||
g/all/setup_app__app+__app_hash: d71add32e14e552d1a4c861c972a50d9598b07c0af201bbadec5b59bbd99d7e3
|
||||
g/all/setup_app__app+change_account.deno.ts: 3c592cac27e9cdab0de6ae19270bcb08c7fa54355ad05253a12de2351894346b
|
||||
u/admin/hub_sync: aaf9fd803fa229f3029d1bb02bbe3cc422fce680cad39c4eec8dd1da115de102
|
||||
u/antigravity/git_sync__flow+__flow_hash: 747f089a941b4fede4e17d92132c523be583291cdbbea7f523421409f443f6f0
|
||||
u/antigravity/git_sync__flow+a.sh: 615cae3132332c6b63ebc41d99bebe582577f9bb99102a9587c1f8cce56b853a
|
||||
u/antigravity/hello_world_demo__flow+__flow_hash: 0adc341960f8196454876684f85fe14ef087ba470322d2aabc99b37bf61edac9
|
||||
u/antigravity/hello_world_demo__flow+a.ts: 53669a285c16d4ba322888755a33424521f769e9ebf64fc1f0cb21f9952b5958
|
||||
u/antigravity/test_git_sync: 6461260a743de38a8c37d4b6083d481a73a6fde8c17cad1976d6635dca11362c
|
||||
|
||||
Reference in New Issue
Block a user