mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
run_hooks: Make post-deploy hooks be best-effort.
This commit is contained in:
committed by
Tim Abbott
parent
608b9bc761
commit
43034a79b6
@@ -65,10 +65,24 @@ if args.from_git:
|
||||
env["ZULIP_OLD_MERGE_BASE_COMMIT"] = resolve_version_string(old_merge_base)
|
||||
env["ZULIP_NEW_MERGE_BASE_COMMIT"] = resolve_version_string(NEW_ZULIP_MERGE_BASE)
|
||||
|
||||
failures = []
|
||||
for script_name in sorted(f for f in os.listdir(path) if f.endswith(".hook")):
|
||||
subprocess.check_call(
|
||||
result = subprocess.run(
|
||||
[os.path.join(path, script_name)],
|
||||
check=False,
|
||||
cwd=deploy_path,
|
||||
preexec_fn=su_to_zulip,
|
||||
env=env,
|
||||
)
|
||||
if result.returncode != 0:
|
||||
# Pre-deploy hooks abort on the first failure; post-deploy
|
||||
# hooks are best-effort and a failure of one does not abort
|
||||
# the rest of them.
|
||||
if args.kind == "pre-deploy":
|
||||
sys.exit(1)
|
||||
failures.append(script_name)
|
||||
|
||||
if failures:
|
||||
print("Failed hooks:")
|
||||
for failed_script in failures:
|
||||
print(f" {failed_script}")
|
||||
|
||||
Reference in New Issue
Block a user