Tim Andersson has proposed merging 
~andersson123/autopkgtest-cloud:update-github-jobs-modifications into 
autopkgtest-cloud:master.

Requested reviews:
  Canonical's Ubuntu QA (canonical-ubuntu-qa)

For more details, see:
https://code.launchpad.net/~andersson123/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/470988

Fixes update-github-jobs not correctly matching the pending github job files 
with currently running jobs by removing the need for all the env values to be 
the same and instead just checking that the UPSTREAM_PULL_REQUEST is the same.
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of 
~andersson123/autopkgtest-cloud:update-github-jobs-modifications into 
autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-web/webcontrol/update-github-jobs b/charms/focal/autopkgtest-web/webcontrol/update-github-jobs
index 14a8888..285a5dc 100755
--- a/charms/focal/autopkgtest-web/webcontrol/update-github-jobs
+++ b/charms/focal/autopkgtest-web/webcontrol/update-github-jobs
@@ -122,13 +122,23 @@ def finish_job(jobfile: Path, params, code, log_url):
     logging.info("%s processed, payload was %s", jobfile.name, data)
 
 
+def get_upstream_pr_from_env(env):
+    upstream_pr = None
+    for env_var in env:
+        if env_var.startswith("UPSTREAM_PULL_REQUEST"):
+            upstream_pr = env_var
+    if upstream_pr is None:
+        raise KeyError(f"No upstream PR in env! env: {env}")
+    return upstream_pr
+
+
 def is_job_running(params):
     job_match_me = (
         params["arch"],
         params["release"],
         params["build-git"],
         params["ppas"],
-        params["env"],
+        get_upstream_pr_from_env(params["env"]),
     )
 
     running_json = json.loads(RUNNING_CACHE.read_text())
@@ -145,7 +155,7 @@ def is_job_running(params):
                     release,
                     test_params["build-git"],
                     test_params["ppas"],
-                    test_params["env"],
+                    get_upstream_pr_from_env(test_params["env"]),
                 )
                 if this_test == job_match_me:
                     return True
-- 
Mailing list: https://launchpad.net/~canonical-ubuntu-qa
Post to     : canonical-ubuntu-qa@lists.launchpad.net
Unsubscribe : https://launchpad.net/~canonical-ubuntu-qa
More help   : https://help.launchpad.net/ListHelp

Reply via email to