From 8b1dc3fb22e30989ee1f94b5cce4d02ac04b588d Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Tue, 5 Jul 2016 16:49:00 -0700 Subject: Add dynamic reconfiguration If a change alters .zuul.yaml in a repo that is permitted to use in-repo configuration, create a shadow configuration layout specifically for that and any following changes with the new configuration in place. Such configuration changes extend only to altering jobs and job trees. More substantial changes such as altering pipelines will be ignored. This only applies to "project" repos (ie, the repositories under test which may incidentally have .zuul.yaml files) rather than "config" repos (repositories specifically designed to hold Zuul configuration in zuul.yaml files). This is to avoid the situation where a user might propose a change to a config repository (and Zuul would therefore run) that would perform actions that the gatekeepers of that repository would not normally permit. This change also corrects an issue with job inheritance in that the Job instances attached to the project pipeline job trees (ie, those that represent the job as invoked in the specific pipeline configuration for a project) were inheriting attributes at configuration time rather than when job trees are frozen when a change is enqueued. This could mean that they would inherit attributes from the wrong variant of a job. Change-Id: If3cd47094e6c6914abf0ffaeca45997c132b8e32 --- zuul/scheduler.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'zuul/scheduler.py') diff --git a/zuul/scheduler.py b/zuul/scheduler.py index 60dafbe3a..a34be2248 100644 --- a/zuul/scheduler.py +++ b/zuul/scheduler.py @@ -191,12 +191,14 @@ class MergeCompletedEvent(ResultEvent): :arg str commit: The SHA of the merged commit (changes with refs). """ - def __init__(self, build_set, zuul_url, merged, updated, commit): + def __init__(self, build_set, zuul_url, merged, updated, commit, + files): self.build_set = build_set self.zuul_url = zuul_url self.merged = merged self.updated = updated self.commit = commit + self.files = files class NodesProvisionedEvent(ResultEvent): @@ -358,11 +360,12 @@ class Scheduler(threading.Thread): self.wake_event.set() self.log.debug("Done adding complete event for build: %s" % build) - def onMergeCompleted(self, build_set, zuul_url, merged, updated, commit): + def onMergeCompleted(self, build_set, zuul_url, merged, updated, + commit, files): self.log.debug("Adding merge complete event for build set: %s" % build_set) - event = MergeCompletedEvent(build_set, zuul_url, - merged, updated, commit) + event = MergeCompletedEvent(build_set, zuul_url, merged, + updated, commit, files) self.result_event_queue.put(event) self.wake_event.set() @@ -606,6 +609,9 @@ class Scheduler(threading.Thread): def _areAllBuildsComplete(self): self.log.debug("Checking if all builds are complete") + if self.merger.areMergesOutstanding(): + self.log.debug("Waiting on merger") + return False waiting = False for pipeline in self.layout.pipelines.values(): for item in pipeline.getAllItems(): @@ -617,7 +623,6 @@ class Scheduler(threading.Thread): if not waiting: self.log.debug("All builds are complete") return True - self.log.debug("All builds are not complete") return False def run(self): -- cgit v1.2.1