diff options
| author | Daniel Smith <daniel.smith@qt.io> | 2025-10-28 11:31:40 +0100 |
|---|---|---|
| committer | Daniel Smith <daniel.smith@qt.io> | 2025-10-28 10:35:23 +0000 |
| commit | d1bf0f6366c11332d4528db8d6e57a92d01627d4 (patch) | |
| tree | a7e954a80dd4587bbbad27647f74cc9d939d2593 | |
| parent | dac5fedd6027195b7cb54d7dd00cad959b056e71 (diff) | |
Gerrit can be a bit slow to reflect changes, especially
when standing up a new server or performing an upgrade
where background processes may be running. Adding a short
delay helps avoid 403 errors when the webhook installer
tries to access Gerrit too quickly after each operation.
Change-Id: I3b86e8717d7682aec728a8888ca7bc9d413ce0d2
Reviewed-by: Daniel Smith <daniel.smith@qt.io>
| -rw-r--r-- | tools/webhook_installer/installer.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/webhook_installer/installer.py b/tools/webhook_installer/installer.py index 48d5367..ba1cfae 100644 --- a/tools/webhook_installer/installer.py +++ b/tools/webhook_installer/installer.py @@ -19,6 +19,7 @@ import urllib.parse import urllib.error import base64 import argparse +from time import sleep from os import environ as envs from urllib.parse import unquote, quote @@ -219,6 +220,7 @@ def update_gerrit_repo_webhooks(repo, target_webhooks_config_content, commit_sub gerrit_repos_with_webhooks_to_update_failed.append(repo) return None + sleep(2) # Small delay to ensure Gerrit is ready for the next operation # Upload the webhooks.config file to the change request if args.simulate: @@ -266,6 +268,8 @@ def update_gerrit_repo_webhooks(repo, target_webhooks_config_content, commit_sub gerrit_repos_with_webhooks_to_update_failed.append(repo) return None + sleep(2) + # Publish the change request (only if upload was successful and not a 409) if args.simulate: logger.info("Simulating publishing change request " + change_request_id @@ -289,6 +293,8 @@ def update_gerrit_repo_webhooks(repo, target_webhooks_config_content, commit_sub logger.error("Failed to connect to gerrit: %s", err.reason) sys.exit(1) + sleep(2) + # Self-review the change request if args.simulate: logger.info("Simulating self-reviewing change request " + change_request_id @@ -314,6 +320,8 @@ def update_gerrit_repo_webhooks(repo, target_webhooks_config_content, commit_sub logger.error("Failed to connect to gerrit: %s", err.reason) sys.exit(1) + sleep(2) + # Submit the change request if args.simulate: logger.info("Simulating submitting change request " + change_request_id |
