zuul/zuul/merger
James E. Blair 9bb4453b8f Avoid exception when no buildset files
If a queue item has a change that modifies zuul.yaml files, then
the mergers send back the contents of the files and we store those
contents on the buildset as RepoFiles.

Likewise, if a queue item changes the zuul config (the same condition
as above) then we perform a dynamic reconfiguration for the queue item.

The way we determine whether a queue item updates the zuul config is
by consulting the updatesConfig method on the item's change objects.
If the branch is an always-dynamic-branch, then updatesConfig will
always return True because the purpose is to always trigger the
dynamic reconfig.

In the case of branch events, we skip the initial merge job,
which means we have no RepoFiles for the buildset.

In the case of branch event (ie, a post-merge job), that means that
the scheduler thinks it should create a dynamic configuration (because
updatesConfig is true) but it doesn't have the files to do it (because
RepoFiles is None).  This results in an exception when trying to
reconstitute the missing RepoFiles from ZooKeeper.  The scheduler
catches this exception and continues, but it is logged, and looks
alarming.  To avoid this, we will no longer attempt to create a
dynamic reconfiguration if we don't have a RepoFiles.

A second cause for the exception was observed with a newly created
branch (which is not an always-dynamic-branch).  In this case, the
event typcially does not arrive with a files list, so we perform a
fileschanges merger job to get the list from git.  That did not reset
the repo, which means it did not have a local copy of the newly
created branch from upstream.  This caused the fileschanges job to
fail.  This, in turn, caused the updatesConfig method to return True
(since it is conservative and says that the config is updated if it is
unsure).  This caused a dynamic reconfiguration which again failed
because we do not get the files contents on branch items.

To correct this, we now reset the repo before performing fileschanges
jobs.

The first condition is not practical to test because it fails safe
regardless, and is an expected behavior.  A test is added for the
second condition.

Change-Id: I1775ebdc989a38d597fe948ff9b6985afd2b5a81
2024-06-19 17:54:45 -07:00
..
__init__.py Split the merger into a separate process 2014-02-17 11:47:15 -08:00
client.py Finish circular dependency refactor 2024-02-09 07:39:40 -08:00
merger.py Avoid exception when no buildset files 2024-06-19 17:54:45 -07:00
server.py Record merger operations 2024-06-14 07:58:29 -07:00