mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 04:53:36 +00:00
purge-old-deployments: Check /srv/zulip.git existence before pruning it.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
6d4e7aa307
commit
6766a3f780
@@ -14,6 +14,8 @@ from scripts.lib.zulip_tools import (
|
||||
su_to_zulip,
|
||||
)
|
||||
|
||||
LOCAL_GIT_CACHE_DIR = "/srv/zulip.git"
|
||||
|
||||
|
||||
def parse_args() -> argparse.Namespace:
|
||||
parser = argparse.ArgumentParser(
|
||||
@@ -75,9 +77,10 @@ def main() -> None:
|
||||
)
|
||||
|
||||
if not args.dry_run:
|
||||
subprocess.check_call(
|
||||
["git", "worktree", "prune"], cwd="/srv/zulip.git", preexec_fn=su_to_zulip
|
||||
)
|
||||
if os.path.exists(LOCAL_GIT_CACHE_DIR):
|
||||
subprocess.check_call(
|
||||
["git", "worktree", "prune"], cwd=LOCAL_GIT_CACHE_DIR, preexec_fn=su_to_zulip
|
||||
)
|
||||
|
||||
print("Deployments cleaned successfully...")
|
||||
print("Cleaning orphaned/unused caches...")
|
||||
|
||||
Reference in New Issue
Block a user