mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-18 16:02:10 +00:00
2ce21c9ef8
* feat(git-sync): enable per-item promotion mode on dev workspaces Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * style: keep unrelated git-sync Alert copy at its original wrapping Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(git-sync): fall back to parent_path on empty deploy path + bump ee ref computeGitSyncDeployBranch used ?? so a backend-serialized empty path (rename out of the repo filter) skipped the deploy branch and could commit to the tracked base; use || to fall back to parent_path like the backend. Bumps ee-repo-ref for the single-object promotion_open_prs fix (windmill-ee-private#679). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(git-sync): route dev-promotion non-branchable objects off the tracked base user/group objects (and any unresolvable ref) returned null in promotion mode, so a dev-workspace deploy pushed them straight to the parent's tracked branch. Fall back to the dev's env-label branch instead; the backend opens no PR for them (isolated, not promoted). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(git-sync): dev-workspace promotion via a toggle on the inherited repo A dev workspace reuses the single repo it inherited from prod: a 'Promote to prod via Git' toggle flips it between sync mode (deploys to the dev branch) and promotion mode (per-item wm_deploy/** PRs to prod), with a per-item/per-folder sub-toggle. Removes the redundant separate-promotion-repo setup for dev workspaces. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * test(git-sync): dev-promotion regression test + widen git_sync_e2e path filter Adds a CLI integration case covering dev-workspace promotion (script -> wm_deploy branch; user/group -> env-label branch, main never touched). Widens the git-sync-test.yml relevance filter to the deploy-branch derivation, git-sync guard, and CLI git-deploy files so the e2e suite runs on PRs like this one. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(git-sync): gate dev promotion toggle on EE, fix card mode + workflow path filters Codex review: (1) show the dev promotion toggle only under an active EE license and revert the optimistic save if the backend rejects it; (2) derive the dev card's display mode from use_individual_branch so promotion copy shows in promotion mode; (3) mirror the new relevance paths into the workflow's top-level push/pull_request filters so it actually triggers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(git-sync): only use the single-card dev promotion UX when the dev has one repo Codex review: an attached dev workspace keeps its own repositories rather than inheriting prod's. Gating the single-card + toggle + hidden-secondaries UX on repositories.length <= 1 makes a multi-repo attached dev fall back to the normal layout, so no active repo is hidden and an unrelated repo isn't presented as prod's promotion target. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(git-sync): runtime EE-plan gate for promotion mode, consistent with auto-pull/PR Codex review: promotion mode only had the CE compile rejection, while auto-pull and PR creation runtime-gate on the active plan (check_git_sync_ee_license). Add check_promotion_license and call it from both edit_git_sync_config and edit_git_sync_repository, plus the matching CE rejection on edit_git_sync_config so the two endpoints are symmetric. Promotion is now gated like every other git-sync EE setting. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(git-sync): dev promotion must reuse the parent workspace's repository Codex review: repository count doesn't prove a dev inherited prod's repo — an attached dev keeps its own. check_dev_promotion_targets_parent_repo resolves the promotion repo's URL and rejects enabling promotion unless it matches one the parent (prod) tracks, so branches/PRs can't target an unrelated repository. Called from both git-sync edit endpoints. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(git-sync): dev promotion save-time check uses shared parent-repo matcher (url+branch) Delegates to windmill_common::git_sync_ee::dev_promotion_target_matches_parent so the settings gate and the deploy-time safety net share one url+branch identity check. Bumps ee-repo-ref for the EE deploy-time enforcement. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore: bump ee-repo-ref for private resolve_repo_url_and_branch Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore: bump ee-repo-ref for promotion-target matcher authz doc Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore(git-sync): bump hub scripts to gitsync-cli versions, fix promotion tooltips Point LATEST_GIT_SYNC_SCRIPT_PATH (28790 -> 28796) and GIT_SYNC_PULL_SCRIPT_PATH / gitInitRepo (28789 -> 28795) at the hub versions pinning windmill-cli@1.763.1-gitsync.0, which carries the dev-workspace promotion routing. Slugs unchanged, so the GitHub-App token check and hub script cache are unaffected. Tooltips: enabling promotion pushes a PR-ready wm_deploy/** branch; Windmill only opens the pull request itself when automatic pull requests are enabled. Reword both toggles to stop promising a PR. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(git-sync): dev promotion mirrors to the env-label branch, PR toggles exclusive by branch type Bump ee-repo-ref for the dispatcher changes: a promotion dev's deploys now also push to its env-label branch (one extra mirror job per batch, users/groups mirror-only), and `fork_open_prs` no longer applies to a dev in promotion mode where `promotion_open_prs` governs. Frontend: the fork-PR toggle tooltip states its actual coverage (wm-fork/** and the dev branch of a dev workspace) and that a promotion dev's own pull request toggle takes over for wm_deploy/** branches. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(git-sync): reject dev promotion on pre-28796 pinned sync scripts An older pinned sync script bundles a CLI that force-disables per-item branches on every fork, so enabling promotion on a dev workspace with such a pin would silently keep deploying to the env-label branch. Both git-sync edit endpoints now reject the combination with an actionable error; the EE dispatchers (via ee-repo-ref bump) demote inherited configs to promotion-off semantics so markers, branch keys and the mirror match the branch the CLI actually pushes. Roots and auto-managed repositories are unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(git-sync): serialize dev promotion toggle saves The promotion and per-folder toggles persist immediately via whole-repo saves; leaving them interactive while one is pending lets rapid flips race, and the earlier save (enabling runs extra backend checks) can commit last, silently reversing the state the UI shows. Both toggles now disable while a save is in flight. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(git-sync): lock auto-PR toggle during promotion save, rename-out branch routing Frontend: the automatic-PR toggle is revealed by the promotion toggle's in-flight save; an edit made mid-save was absorbed into the saved baseline without reaching the backend. It now disables during that save. EE (ee-repo-ref bump): dispatcher debounce/concurrency keys and PR markers follow the CLI's parent_path fallback for rename-out items, so their wm_deploy/** branches debounce per-branch and open their PR. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore(git-sync): condense comments to durable constraints Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore: update ee-repo-ref to 8bf73f803158bcbf7b8d55a36f4a1ebfcc1bbcd9 This commit updates the EE repository reference after PR #679 was merged in windmill-ee-private. Previous ee-repo-ref: c2cd718cb53d234f909f485bd7cd43ed9605ffd1 New ee-repo-ref: 8bf73f803158bcbf7b8d55a36f4a1ebfcc1bbcd9 Automated by sync-ee-ref workflow. --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com>
223 lines
7.8 KiB
YAML
223 lines
7.8 KiB
YAML
name: Git Sync Integration Tests
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- "backend/windmill-git-sync/**"
|
|
- "backend/windmill-api-integration-tests/tests/git_sync*"
|
|
- "backend/ee-repo-ref.txt"
|
|
- "backend/windmill-common/src/workspaces.rs"
|
|
- "backend/windmill-worker/src/result_processor.rs"
|
|
- "backend/windmill-api-workspaces/**"
|
|
- "cli/src/commands/sync/**"
|
|
- "cli/src/utils/git.ts"
|
|
- "integration_tests/test/git_sync_test.py"
|
|
- ".github/workflows/git-sync-test.yml"
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
paths:
|
|
- "backend/windmill-git-sync/**"
|
|
- "backend/windmill-api-integration-tests/tests/git_sync*"
|
|
- "backend/ee-repo-ref.txt"
|
|
- "backend/windmill-common/src/workspaces.rs"
|
|
- "backend/windmill-worker/src/result_processor.rs"
|
|
- "backend/windmill-api-workspaces/**"
|
|
- "cli/src/commands/sync/**"
|
|
- "cli/src/utils/git.ts"
|
|
- "integration_tests/test/git_sync_test.py"
|
|
- ".github/workflows/git-sync-test.yml"
|
|
|
|
concurrency:
|
|
group: git-sync-test-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
check-relevance:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
should_run: ${{ steps.check.outputs.should_run }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Check if git sync related files changed
|
|
id: check
|
|
env:
|
|
WINDMILL_EE_PRIVATE_ACCESS: ${{ secrets.WINDMILL_EE_PRIVATE_ACCESS }}
|
|
run: |
|
|
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
|
BASE=${{ github.event.pull_request.base.sha }}
|
|
else
|
|
BASE=${{ github.event.before }}
|
|
fi
|
|
|
|
CHANGED_FILES=$(git diff --name-only "$BASE"..HEAD 2>/dev/null || echo "")
|
|
echo "Changed files:"
|
|
echo "$CHANGED_FILES"
|
|
|
|
# Direct git sync file changes — always relevant.
|
|
if echo "$CHANGED_FILES" | grep -qE '^(backend/windmill-git-sync/|backend/windmill-worker/src/result_processor\.rs|backend/windmill-api-workspaces/|backend/windmill-api-integration-tests/tests/git_sync|backend/windmill-common/src/workspaces\.rs|cli/src/commands/sync/|cli/src/utils/git\.ts|integration_tests/test/git_sync|\.github/workflows/git-sync-test\.yml)'; then
|
|
echo "should_run=true" >> "$GITHUB_OUTPUT"
|
|
echo "Relevant: direct git sync file changes"
|
|
exit 0
|
|
fi
|
|
|
|
# If ee-repo-ref.txt changed, check if the EE diff touches windmill-git-sync/
|
|
if echo "$CHANGED_FILES" | grep -q '^backend/ee-repo-ref.txt$'; then
|
|
NEW_REF=$(cat backend/ee-repo-ref.txt)
|
|
OLD_REF=$(git show "$BASE:backend/ee-repo-ref.txt" 2>/dev/null || echo "")
|
|
|
|
if [ -n "$OLD_REF" ] && [ "$OLD_REF" != "$NEW_REF" ]; then
|
|
# Clone EE repo and check diff
|
|
git clone --bare "https://x-access-token:${WINDMILL_EE_PRIVATE_ACCESS}@github.com/windmill-labs/windmill-ee-private.git" /tmp/ee-repo 2>/dev/null
|
|
EE_CHANGED=$(git -C /tmp/ee-repo diff --name-only "$OLD_REF".."$NEW_REF" 2>/dev/null || echo "")
|
|
echo "EE changed files:"
|
|
echo "$EE_CHANGED"
|
|
|
|
if echo "$EE_CHANGED" | grep -q '^windmill-git-sync/'; then
|
|
echo "should_run=true" >> "$GITHUB_OUTPUT"
|
|
echo "Relevant: EE git sync files changed"
|
|
exit 0
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
echo "should_run=false" >> "$GITHUB_OUTPUT"
|
|
echo "No git sync relevant changes detected, skipping tests"
|
|
|
|
git_sync_e2e:
|
|
needs: [check-relevance]
|
|
if: needs.check-relevance.outputs.should_run == 'true'
|
|
runs-on: ubicloud-standard-16
|
|
services:
|
|
postgres:
|
|
image: postgres:14
|
|
ports:
|
|
- 5432:5432
|
|
env:
|
|
POSTGRES_DB: windmill
|
|
POSTGRES_PASSWORD: changeme
|
|
options: >-
|
|
--health-cmd pg_isready --health-interval 10s --health-timeout 5s
|
|
--health-retries 5
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.ref }}
|
|
fetch-depth: 0
|
|
|
|
- name: Read EE repo commit hash
|
|
run: |
|
|
echo "ee_repo_ref=$(cat ./backend/ee-repo-ref.txt)" >> "$GITHUB_ENV"
|
|
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
repository: windmill-labs/windmill-ee-private
|
|
path: ./windmill-ee-private
|
|
ref: ${{ env.ee_repo_ref }}
|
|
token: ${{ secrets.WINDMILL_EE_PRIVATE_ACCESS }}
|
|
fetch-depth: 0
|
|
|
|
- name: Substitute EE code
|
|
run: |
|
|
cd backend && ./substitute_ee_code.sh --copy --dir ./windmill-ee-private
|
|
|
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
with:
|
|
cache-workspaces: backend
|
|
toolchain: 1.97.0
|
|
|
|
- uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: 1.3.10
|
|
|
|
- uses: denoland/setup-deno@v2
|
|
with:
|
|
deno-version: v2.x
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
|
|
- name: Install wmill CLI
|
|
run: |
|
|
cd cli && bash gen_wm_client.sh && bun install
|
|
mkdir -p "$HOME/.local/bin"
|
|
printf '#!/bin/sh\nexec bun run "%s/cli/src/main.ts" "$@"\n' "$GITHUB_WORKSPACE" > "$HOME/.local/bin/wmill"
|
|
chmod +x "$HOME/.local/bin/wmill"
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
|
|
- name: Build Windmill
|
|
working-directory: ./backend
|
|
env:
|
|
SQLX_OFFLINE: true
|
|
CARGO_BUILD_JOBS: 12
|
|
RUSTFLAGS: ""
|
|
run: |
|
|
cargo build --features enterprise,private,license,zip
|
|
|
|
- name: Start Gitea
|
|
run: |
|
|
docker run -d --name gitea \
|
|
-e GITEA__database__DB_TYPE=sqlite3 \
|
|
-e GITEA__security__INSTALL_LOCK=true \
|
|
-e GITEA__server__HTTP_PORT=3000 \
|
|
-e GITEA__server__ROOT_URL=http://localhost:3000 \
|
|
-e GITEA__service__DISABLE_REGISTRATION=false \
|
|
-p 3000:3000 \
|
|
gitea/gitea:1.22-rootless
|
|
echo "Waiting for Gitea to be ready..."
|
|
for i in $(seq 1 30); do
|
|
if curl -sf http://localhost:3000/api/v1/version > /dev/null 2>&1; then
|
|
echo "Gitea is ready"
|
|
break
|
|
fi
|
|
sleep 2
|
|
done
|
|
curl -sf http://localhost:3000/api/v1/version > /dev/null || { echo "Gitea failed to start"; exit 1; }
|
|
|
|
- name: Start Windmill
|
|
working-directory: ./backend
|
|
env:
|
|
DATABASE_URL: postgres://postgres:changeme@localhost:5432/windmill
|
|
LICENSE_KEY: ${{ secrets.WM_LICENSE_KEY_CI }}
|
|
DENO_PATH: deno
|
|
BUN_PATH: bun
|
|
NODE_BIN_PATH: node
|
|
# The auto-pull poller's SSRF guard rejects localhost git remotes;
|
|
# the tests' Gitea runs on localhost.
|
|
ALLOW_LOCAL_GIT_REMOTES: "true"
|
|
run: |
|
|
./target/debug/windmill &
|
|
echo "Waiting for Windmill to be ready..."
|
|
for i in $(seq 1 60); do
|
|
if curl -sf http://localhost:8000/api/version > /dev/null 2>&1; then
|
|
echo "Windmill is ready"
|
|
break
|
|
fi
|
|
sleep 2
|
|
done
|
|
curl -sf http://localhost:8000/api/version > /dev/null || { echo "Windmill failed to start"; exit 1; }
|
|
|
|
- name: Run git sync E2E tests
|
|
timeout-minutes: 10
|
|
env:
|
|
GITEA_DOCKER_URL: http://localhost:3000
|
|
LICENSE_KEY: ${{ secrets.WM_LICENSE_KEY_CI }}
|
|
run: |
|
|
python3 -m venv .venv
|
|
.venv/bin/pip install -r integration_tests/requirements.txt
|
|
cd integration_tests && ../.venv/bin/python -m unittest -v test.git_sync_test
|
|
|
|
- name: Archive logs
|
|
uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: Git Sync Integration Tests Logs
|
|
path: |
|
|
integration_tests/logs
|