diff options
author | James E. Blair <jim@acmegating.com> | 2023-01-17 06:23:43 -0800 |
---|---|---|
committer | James E. Blair <jim@acmegating.com> | 2023-01-24 15:35:39 -0800 |
commit | ac3122503f632df2febe4e919eee0e2851c2afb8 (patch) | |
tree | 51aca6408ecd76a29c55433d7afdbbcbce8bc247 /zuul | |
parent | bc06b0851c38396f2aefa4f93dfb24d84cc8afd7 (diff) | |
download | zuul-ac3122503f632df2febe4e919eee0e2851c2afb8.tar.gz |
Refresh dependencies for changes in pipelines
Commit 549103881899751e84b411212f7820cde502b42b appears to have
had an error. It attempted to only refresh changes if they are
in the pipeline or are dependencies of changes in the pipeline,
but it only did the latter, which has an adverse effect for the
GitHub driver. We can change dependencies of GitHub changes
without creating new patchsets, which means that this error
(not updating dependencies of changes in the pipeline) would cause
Zuul not to eject a GitHub change from a pipeline when its
dependencies changed via a PR message update.
The error went unnoticed with Gerrit since dependency updates
happen with new patchsets, which themselves cause changes to be
ejected.
This change corrects the behavior.
Repetitive calls to updateCommitDependencies are also eliminated
by creating a set of changes to update across the whole pipeline.
Finally, two tests are added, one for Gerrit (which previously would
have passed) and one for GitHub (which previously would have failed).
Change-Id: I005820223471e8f6372ef70730f381918ec9c1af
Diffstat (limited to 'zuul')
-rw-r--r-- | zuul/manager/__init__.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/zuul/manager/__init__.py b/zuul/manager/__init__.py index 60eb479e0..832be780a 100644 --- a/zuul/manager/__init__.py +++ b/zuul/manager/__init__.py @@ -276,19 +276,19 @@ class PipelineManager(metaclass=ABCMeta): if not isinstance(change, model.Change): return - change_in_pipeline = False + to_refresh = set() for item in self.pipeline.getAllItems(): if not isinstance(item.change, model.Change): continue + if item.change.equals(change): + to_refresh.add(item.change) for dep_change_ref in item.change.commit_needs_changes: - if item.change.equals(change): - change_in_pipeline = True dep_change_key = ChangeKey.fromReference(dep_change_ref) if dep_change_key.isSameChange(change.cache_stat.key): - self.updateCommitDependencies(item.change, None, event) + to_refresh.add(item.change) - if change_in_pipeline: - self.updateCommitDependencies(change, None, event) + for existing_change in to_refresh: + self.updateCommitDependencies(existing_change, None, event) def reportEnqueue(self, item): if not self.pipeline.state.disabled: |