Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud:fix_duplicate_github_requests 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/450688 -- Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud:fix_duplicate_github_requests into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-web/webcontrol/request/submit.py b/charms/focal/autopkgtest-web/webcontrol/request/submit.py index e40e3d4..d18fee6 100644 --- a/charms/focal/autopkgtest-web/webcontrol/request/submit.py +++ b/charms/focal/autopkgtest-web/webcontrol/request/submit.py @@ -243,7 +243,9 @@ class Submit: # XXX - needs fixing the parameters passed to the check may be # insufficient to determine if a request is unique - # self.is_request_queued_or_running(release, arch, package, triggers) + self.is_request_queued_or_running( + release, arch, package, triggers, kwargs, git=True + ) if release not in self.releases: raise NotFound("release", release) @@ -548,7 +550,7 @@ class Submit: return (code, response) def is_test_running( - self, req_series, req_arch, req_package, req_triggers, kwargs + self, req_series, req_arch, req_package, req_triggers, kwargs, git ): if not os.path.isfile(RUNNING_FP): return False @@ -566,18 +568,41 @@ class Submit: ) running_all_proposed = "all-proposed_1" in submitted req_all_proposed = "all-proposed" in kwargs.keys() + ################################################# + # - 'env' is a list of 'key=value' strings. + git_same = True + if git: + build_git_url = data[pkg][submitted][release][ + arch + ][0].get("build-git", []) + ppas = data[pkg][submitted][release][arch][0].get( + "ppas", [] + ) + env = data[pkg][submitted][release][arch][0].get( + "env", [] + ) + if ( + kwargs["build-git"] == build_git_url + and ppas == kwargs["ppa"] + ): + for e in kwargs["env"]: + if e not in env: + git_same = False + else: + git_same = False if ( req_arch in architectures and req_series in releases and req_package == pkg and sorted(triggers) == sorted(req_triggers) and (running_all_proposed == req_all_proposed) + and git_same ): return True return False def is_test_in_queue( - self, req_series, req_arch, req_package, req_triggers, kwargs + self, req_series, req_arch, req_package, req_triggers, kwargs, git ): if not os.path.isfile(QUEUE_FP): return False @@ -614,25 +639,46 @@ class Submit: "package": pkg, "triggers": sorted(triggers), } + git_same = True + if git: + build_git_url = details.get("build-git", []) + ppas = details.get("ppas", []) + env = details.get("env", []) + if ( + kwargs["build-git"] == build_git_url + and ppas == kwargs["ppa"] + ): + for e in kwargs["env"]: + if e not in env: + git_same = False + else: + git_same = False if ( test == this_test and running_all_proposed != req_all_proposed + and git_same ): return True return False def is_request_queued_or_running( - self, req_series, req_arch, req_package, req_triggers=[], kwargs={} + self, + req_series, + req_arch, + req_package, + req_triggers=[], + kwargs={}, + git=False, ): if self.is_test_running( - req_series, req_arch, req_package, req_triggers, kwargs + req_series, req_arch, req_package, req_triggers, kwargs, git ): raise RequestRunning( req_series, req_package, req_arch, req_triggers ) if self.is_test_in_queue( - req_series, req_arch, req_package, req_triggers, kwargs + req_series, req_arch, req_package, req_triggers, kwargs, git ): raise RequestInQueue( req_series, req_package, req_arch, req_triggers
-- 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