Skip to content

Commit

Permalink
testing repo stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzeid committed Jan 10, 2025
1 parent cf8956c commit 30cdf39
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 3 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ dependencies = [
"django_compressor",
"jinja2",
"kombu",
"mercurial==6.9",
"mots",
"mozilla_django_oidc",
"networkx",
Expand Down
48 changes: 48 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,54 @@ markupsafe==3.0.2 \
--hash=sha256:f8b3d067f2e40fe93e1ccdd6b2e1d16c43140e76f02fb1319a05cf2b79d99430 \
--hash=sha256:fcabf5ff6eea076f859677f5f0b6b5c1a51e70a376b0579e0eadef8db48c6b50
# via jinja2
mercurial==6.9 \
--hash=sha256:0113d58ca9a2b7d41417f24788df21e9793bda5419ab962fd3410266fd32dad9 \
--hash=sha256:05f5c42b09ffcabf1bd2a3aae43a30e55ad4fd1f3b4a6853ad2092cb4724e9b5 \
--hash=sha256:0861b4c1620c0ed9a7b74795dc2be50535c2d9a883a1408eabc4ec8dee183c6e \
--hash=sha256:13ed70c06a9565f5e4074fe03d79df1cffacc7fd7ef93a4ffc77fa71887fdd40 \
--hash=sha256:179832de288a3dd95403a02df6a822c40c56fbea93c33c606997ad34f7ccb458 \
--hash=sha256:1ecbe95dc6f780d3436ee353daa649c855391dad6a27e72279942d3643267998 \
--hash=sha256:22679bbbf374531647aa07c0a2fe86a7e241f0558efbaf7a644537e9788e3abb \
--hash=sha256:2654bab75c0a3194b2e62bbc2ce688bbb694a6a54f25e2e5860f8f7f106a72f9 \
--hash=sha256:329fcadb626ae05ebf999685b4dc071bf50cf8be600878619bc2d79789d6a096 \
--hash=sha256:3a25f67144152032a0d7dbf63ee134c2368e92018dd6d61be35a795f8e81b23e \
--hash=sha256:3f3df1cc76c73cd4cbed0e967177d11031b511ecb67c97e3d549571fb2484441 \
--hash=sha256:3f4e24ee71b79b4a12428694acc9800c12963fb48d8e9be130dc07360222016b \
--hash=sha256:42e6309f679ee9fc331cdf5d16c1dbabb4231aa2dc9d83a8d3c66ac12d82279e \
--hash=sha256:440131421808c9a2fc4a4325176838913f41961f63e8fea66e5b53ac11f3d1d8 \
--hash=sha256:444b4f1018974343b09c0241982d1dec9ecce83787a448c8ed1c9663a15f70e0 \
--hash=sha256:5cd2d3cd0b0a16ac7d9795c0431e09b69ed49a65eaf56c6ee6755f0c902790d0 \
--hash=sha256:5cfdbeae6bda05cb8adb7d401f117a708cdab481b7eebae8307aa09a9e28d487 \
--hash=sha256:629604293df2be8171ec856bf4f8b4faa8e4305af13607dce0f89f74132836d6 \
--hash=sha256:6743ccef3a949b5927bdee78c69ffa567f211ac26d85fabe84043d20cbd3c2f9 \
--hash=sha256:69dc2992e3c06ebabf3e237522d7baf370ea144674c9df7be6157e926886d0e1 \
--hash=sha256:72f2bed7c2ceadb663efefa1562b2009aab1ba3966ce11a7bd2881e8c44f3518 \
--hash=sha256:77264cf06d7ecc9b2a384be65578fccc0b5a585ff2500a7c158077bd09e04725 \
--hash=sha256:856e118815017feaccab1137fa12e09178e88174404b1df11a4dc48a7a3ad0ee \
--hash=sha256:8dd08a77e402ef97b40b975ae5b23a9aa8016c351b625cfbce87a1b314fc5b19 \
--hash=sha256:97462eda40d3a3aa3360261df45e64caf16e8bfb24260a03b6a5e2d8a9c0e665 \
--hash=sha256:a098e4cee612e18f7457482f58096c6ad7496700b27774e1f6f82967c8fb9743 \
--hash=sha256:a3786faac06a2deca871f2ca93ea10a5baf2ef6431f59151b031ed4354d2a53c \
--hash=sha256:a6d4805a87a621443ff374c72cca082b2de698a7acf795001a44d4977dd4c23e \
--hash=sha256:a929edc9995e15b0eb17a80f21e4683c51cc4e457fbe9398b82afc3c606cf208 \
--hash=sha256:ad01b5d9c62cd441fdc2444a0b227d6f40790325d3fb65930928846f0c509653 \
--hash=sha256:ba9c0328845ce0b43b62674d304aeafee6d23f483b48d503db3682aefba3b751 \
--hash=sha256:c3e4d0da931de8caea4e71344be4900251c01910628ad456f4c4e010df7206db \
--hash=sha256:c4bc16d718f3d12775c5c86c97e64a5409bf4c68a789794040aa43a54039bcfd \
--hash=sha256:ceb3937fb4e59756fc9a1930abc423d33a6009c991a30ffb7aa708a6130fc4eb \
--hash=sha256:d26ab92a68ff8891717f9f3fe8d3514c4b9d421127a47d93c47c437a9297fa91 \
--hash=sha256:dd0ec5344b581386323ad05af0a5bf431857485851fc5054b5f0d846fcb9ce80 \
--hash=sha256:df0d5b558396a09b7d7eada50361989e1625c79593361f1e49d835f529446650 \
--hash=sha256:e11fc5556c68f1269edb5d04e4c4dd4af20a8cb389e6d2c103d89552dea738ae \
--hash=sha256:e2991b93a5c7e25363f73403866ff5ca641a2af9b39fc7397dd6776654be5af1 \
--hash=sha256:e35c4efb5cbfe9ef2bc98516b2b798b4c69847d644999b643c45856c47a16f70 \
--hash=sha256:e7685ff82cf8589fe240a83347b7ee73765525a5dd8c311bf69f8b187f9ecf40 \
--hash=sha256:ec2a00f73da23123c52ec68206b6ebed1a214c569cda37aaab7b343ef539c7c3 \
--hash=sha256:f08fa97d6416b93a6b7a900d1bee44701ed30dc84c4a0406c468eb8b4ec4d16a \
--hash=sha256:f4d26f3932416c29a052072ba216ba9c31a3d61a8ac80d20996d4e83a0749320 \
--hash=sha256:f545c86537f6b542ab7ecae5a4869b716b2d50a58739ab616b1884b0e37cd5c7 \
--hash=sha256:f6e0c74b14bb57304992b39a57c40b47189c5bb40bc797d3a6e135388d560133
# via lando (pyproject.toml)
mots==0.13.2 \
--hash=sha256:39dc2eddef877d922b4bd71660975ee514f893c9465428aff5364bbcc7fdc357 \
--hash=sha256:c433bf5fae7e3b8897b353ef37ac0e19871addee3b391355ea2e11c73c597bd8
Expand Down
31 changes: 28 additions & 3 deletions src/lando/main/management/commands/start_landing_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,37 @@ def handle_git(self, worker: Worker):
"""Handle the starting of the Git landing worker ("git-landing-worker")."""
self._handle(worker, SCM_TYPE_GIT)

def _handle(self, worker: Worker, repo_type: str):
# Clone or update repos upon worker startup.
def _check_for_unsupported_repos(self, worker: Worker, repo_type: str):
for repo in worker.enabled_repos:
# Check if any associated repos are unsupported, raise exception if so.
repo.raise_for_unsupported_repo_scm(repo_type)
repo.scm.prepare_repo(repo.pull_path)

def _prepare_repos(self, worker: Worker):
for repo in worker.enabled_repos:
if not repo.scm.repo_is_initialized:
logger.info(f"Repo {repo} not prepared, preparing...")
repo.scm.prepare_repo(repo.pull_path)

def _handle(self, worker: Worker, repo_type: str):
self._check_for_unsupported_repos(worker, repo_type)
max_attempts = 5
all_repos_cloned = False
for attempt in range(max_attempts):
logger.info(f"Attempting to prepare repos (attempt #{attempt}).")
try:
self._prepare_repos(worker)
except Exception as e:
logger.error("Encountered error while preparing repos.")
logger.exception(e)
continue
else:
all_repos_cloned = True
break

if not all_repos_cloned:
raise CommandError(
"Could not prepare all repos. Check logs for more details."
)

# Continue with starting the worker.
try:
Expand Down

0 comments on commit 30cdf39

Please sign in to comment.