mirror of
https://github.com/zulip/zulip.git
synced 2025-11-13 10:26:28 +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,
|
su_to_zulip,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
LOCAL_GIT_CACHE_DIR = "/srv/zulip.git"
|
||||||
|
|
||||||
|
|
||||||
def parse_args() -> argparse.Namespace:
|
def parse_args() -> argparse.Namespace:
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
@@ -75,9 +77,10 @@ def main() -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
if not args.dry_run:
|
if not args.dry_run:
|
||||||
subprocess.check_call(
|
if os.path.exists(LOCAL_GIT_CACHE_DIR):
|
||||||
["git", "worktree", "prune"], cwd="/srv/zulip.git", preexec_fn=su_to_zulip
|
subprocess.check_call(
|
||||||
)
|
["git", "worktree", "prune"], cwd=LOCAL_GIT_CACHE_DIR, preexec_fn=su_to_zulip
|
||||||
|
)
|
||||||
|
|
||||||
print("Deployments cleaned successfully...")
|
print("Deployments cleaned successfully...")
|
||||||
print("Cleaning orphaned/unused caches...")
|
print("Cleaning orphaned/unused caches...")
|
||||||
|
|||||||
Reference in New Issue
Block a user