← Back to team overview

sts-sponsors team mailing list archive

[Merge] ~adam-collard/maas-ci/+git/maas-ci-internal:robust-start-review into ~maas-committers/maas-ci/+git/maas-ci-internal:main

 

Adam Collard has proposed merging ~adam-collard/maas-ci/+git/maas-ci-internal:robust-start-review into ~maas-committers/maas-ci/+git/maas-ci-internal:main.

Commit message:
Look for MPs from source rather than target.

Skip over unparseable jobs.


Requested reviews:
  MAAS Committers (maas-committers)

For more details, see:
https://code.launchpad.net/~adam-collard/maas-ci/+git/maas-ci-internal/+merge/437949
-- 
Your team MAAS Committers is requested to review the proposed merge of ~adam-collard/maas-ci/+git/maas-ci-internal:robust-start-review into ~maas-committers/maas-ci/+git/maas-ci-internal:main.
diff --git a/jobs/launchpad-ci/launchpad b/jobs/launchpad-ci/launchpad
index 11e580f..2e01883 100755
--- a/jobs/launchpad-ci/launchpad
+++ b/jobs/launchpad-ci/launchpad
@@ -225,8 +225,12 @@ def get_job_info(proposal):
     }
 
 
-def get_jobs(proposals):
-    return [get_job_info(proposal) for proposal in proposals]
+def generate_jobs(proposals):
+    for proposal in proposals:
+        try:
+            yield get_job_info(proposal)
+        except Exception:
+            logger.debug(f"Skipping unknown job info for {proposal.web_link}")
 
 
 def is_job(job, job_info):
@@ -237,10 +241,9 @@ def is_job(job, job_info):
 
 
 def find_proposal(lp, job_info):
-    repo = get_repository(lp, job_info["LP_REPO_DEST"])
-    proposals = repo.landing_candidates
-    jobs = get_jobs(proposals)
-    for job in jobs:
+    source_repo = get_repository(lp, job_info["LP_REPO_SRC"])
+    source_ref = source_repo.getRefByPath(path=job_info["LP_BRANCH_SRC"])
+    for job in generate_jobs(source_ref.landing_targets):
         if is_job(job, job_info):
             return job["MP"]
 

Follow ups