Fix dynamic layout with regex approval filters

In case the layout includes some regex approval filters (like
username) the dynamic layout creation fails during deepcopy of the
pipelines [1]. This is caused by Github/GerritApprovalFilter overwriting
stuff in the original data structure. Fix this by using the already
existing deepcopied data structures.

To test this an unused pipeline with approval filters for Github and
Gerrit is added to the dynamic layout test cases. This triggers the
deepcopy error without the fix in every test_dynamic_* test case.

[1] Traceback (most recent call last):
    File "/usr/lib/python3.6/site-packages/zuul/manager/__init__.py", line 453, in _loadDynamicLayout
      include_config_projects=False)
    File "/usr/lib/python3.6/site-packages/zuul/configloader.py", line 1478, in createDynamicLayout
      config = tenant.config_projects_config.copy()
    File "/usr/lib/python3.6/site-packages/zuul/model.py", line 2150, in copy
      r.pipelines = copy.deepcopy(self.pipelines)
    File "/usr/lib/python3.6/copy.py", line 150, in deepcopy
      y = copier(x, memo)
  ...
    File "/usr/lib/python3.6/copy.py", line 240, in _deepcopy_dict
      y[deepcopy(key, memo)] = deepcopy(value, memo)
    File "/usr/lib/python3.6/copy.py", line 161, in deepcopy
      y = copier(memo)
  TypeError: cannot deepcopy this pattern object

Change-Id: I4f7f74787aa91e938d0e2f07bd15b4e21d49cb88
5 files changed