[OpenStack-Infra] multiple gerrit connections for ZUUL

Paul Belanger pabelanger at redhat.com
Fri Apr 1 13:02:13 UTC 2016


On Fri, Apr 01, 2016 at 12:44:08PM +0000, Hejral, VaclavX wrote:
> Hello,
> 
> running Zuul version: 2.1.1.dev131, I want to configure multiple gerrit
> connections, so gerrit account reporting back will differ based on pipeline.
> Having just one gerrit account (connection) works without problems.
> 
> Original /etc/zuul/zuul.conf contained just one gerrit connection as below
> 
> >>
> [gerrit]
> server=review.openstack.org
> user=intel-nfv-ci
> sshkey=/var/lib/zuul/ssh/id_rsa
> >>
> 
> "gerrit" is used in /etc/zuul/layout/layout.conf
> and everything works well.
> 
> I thought the solution is to add additional connection section into
> /etc/zuul/zuul.conf and use connection in laoyut.yaml itself.
> I have troubles with that.
> 
> After adding next section, e.g. my_gerrit into /etc/zuul/zuul.conf
> >>
> [my_gerrit]
> server=review.openstack.org
> user=intel-networking-ci
> sshkey=/var/lib/zuul/ssh/id_rsa_intel-networking-ci at review.openstack.org
> >>
> 
> and using "my_gerrit" in /etc/zuul/layout/layout.yaml
> zuul refuses to start, and also validation via
> zuul-server -t fails.
> 
> I ended with configuration of /etc/zuul/zuul.conf as follows (I added
> "connection" string and "driver" parameter to both my gerrit connections)
> 
> >>
> [connection gerrit]
> driver=gerrit
> server=review.openstack.org
> user=intel-nfv-ci
> sshkey=/var/lib/zuul/ssh/id_rsa
> 
> [connection my_gerrit]
> driver=gerrit
> server=review.openstack.org
> user=intel-networking-ci
> sshkey=/var/lib/zuul/ssh/id_rsa_intel-networking-ci at review.openstack.org
> >>
> 
> No change. Still, zuul-server doesn't know about "my_gerrit"
> So now, I have /etc/zuul/zuul.conf with 2 gerrit connections defined,
> but the 2nd - my_gerrit I am unable to use in /etc/zuul/layout/layout.yaml
> 
> excerpt from working /etc/zuul/layout/layout.yaml
> >>
>     source: gerrit
>     trigger:
>       gerrit:
>         - event: patchset-created
>    success:
>       gerrit:
>         verified: 1
> >>
> This works well.
> 
> excerpt from non-working /etc/zuul/layout/layout.yaml
> >>
>     source: gerrit
>     trigger:
>       gerrit:
>         - event: patchset-created
>     success:
>       my_gerrit:
>         verified: 1
> >>
> 
> zuul-server -t
> Traceback (most recent call last):
>   File "/usr/local/bin/zuul-server", line 10, in <module>
>     sys.exit(main())
>   File "/usr/local/lib/python2.7/dist-packages/zuul/cmd/server.py", line 218, in main
>     sys.exit(server.test_config(path))
>   File "/usr/local/lib/python2.7/dist-packages/zuul/cmd/server.py", line 96, in test_config
>     self.connections)
>   File "/usr/local/lib/python2.7/dist-packages/zuul/scheduler.py", line 286, in testConfig
>     return self._parseConfig(config_path, connections)
>   File "/usr/local/lib/python2.7/dist-packages/zuul/scheduler.py", line 402, in _parseConfig
>     validator.validate(data, connections)
>   File "/usr/local/lib/python2.7/dist-packages/zuul/layoutvalidator.py", line 328, in validate
>     schema(data)
>   File "/usr/local/lib/python2.7/dist-packages/voluptuous.py", line 337, in __call__
>     return self._compiled([], data)
>   File "/usr/local/lib/python2.7/dist-packages/voluptuous.py", line 635, in validate_dict
>     return base_validate(path, iteritems(data), out)
>   File "/usr/local/lib/python2.7/dist-packages/voluptuous.py", line 471, in validate_mapping
>     raise MultipleInvalid(errors)
> voluptuous.MultipleInvalid: extra keys not allowed @ data['pipelines'][0]['success']['my_gerrit']
> 
> I tried to modify, source:, trigger:, success:
> seems anything except 1st gerrit connection "gerrit" is not knownn to zuul.
> 
> excerpt from non-working /etc/zuul/layout/layout.yaml
> >>
>     source: my_gerrit
>     trigger:
>       my_gerrit:
>         - event: patchset-created
>     success:
>       gerrit:
>         verified: 1
> >>
> 
> zuul-server -t
> Traceback (most recent call last):
>   File "/usr/local/bin/zuul-server", line 10, in <module>
>     sys.exit(main())
>   File "/usr/local/lib/python2.7/dist-packages/zuul/cmd/server.py", line 218, in main
>     sys.exit(server.test_config(path))
>   File "/usr/local/lib/python2.7/dist-packages/zuul/cmd/server.py", line 96, in test_config
>     self.connections)
>   File "/usr/local/lib/python2.7/dist-packages/zuul/scheduler.py", line 286, in testConfig
>     return self._parseConfig(config_path, connections)
>   File "/usr/local/lib/python2.7/dist-packages/zuul/scheduler.py", line 444, in _parseConfig
>     params)
>   File "/usr/local/lib/python2.7/dist-packages/zuul/scheduler.py", line 384, in _getReporterDriver
>     return self._getDriver('reporter', connection_name, driver_config)
>   File "/usr/local/lib/python2.7/dist-packages/zuul/scheduler.py", line 369, in _getDriver
>     driver = drivers[dtype][driver_name].split(':')
> KeyError: 'my_gerrit'
> 
> I tried vice versa, to keep just "my_gerrit" in /etc/zuul/zuul.conf
> I got similar issue - that zuul does not know "gerrit" now
> 
> zuul-server -t
> Traceback (most recent call last):
>   File "/usr/local/bin/zuul-server", line 10, in <module>
>     sys.exit(main())
>   File "/usr/local/lib/python2.7/dist-packages/zuul/cmd/server.py", line 218, in main
>     sys.exit(server.test_config(path))
>   File "/usr/local/lib/python2.7/dist-packages/zuul/cmd/server.py", line 96, in test_config
>     self.connections)
>   File "/usr/local/lib/python2.7/dist-packages/zuul/scheduler.py", line 286, in testConfig
>     return self._parseConfig(config_path, connections)
>   File "/usr/local/lib/python2.7/dist-packages/zuul/scheduler.py", line 402, in _parseConfig
>     validator.validate(data, connections)
>   File "/usr/local/lib/python2.7/dist-packages/zuul/layoutvalidator.py", line 328, in validate
>     schema(data)
>   File "/usr/local/lib/python2.7/dist-packages/voluptuous.py", line 337, in __call__
>     return self._compiled([], data)
>   File "/usr/local/lib/python2.7/dist-packages/voluptuous.py", line 635, in validate_dict
>     return base_validate(path, iteritems(data), out)
>   File "/usr/local/lib/python2.7/dist-packages/voluptuous.py", line 471, in validate_mapping
>     raise MultipleInvalid(errors)
> voluptuous.MultipleInvalid: extra keys not allowed @ data['pipelines'][0]['success']['gerrit']
> 
> Is it known this scenario shouldn't work or am I doing something wrong?
> Any ideas?
> 
> Thanks,
> Vaclav
> 
While I haven't tested it personally, we do have an example test fixture
documenting[1][2] what is needed for multiple gerrit servers.

My only comment would be to ensure you are using commit
352264b3c22b501ae53c1643e31df2ccdfc89388[3] or later, since that introduced the new
connection concept.

[1] https://git.openstack.org/cgit/openstack-infra/zuul/tree/tests/fixtures/layouts/good_connections1.conf
[2] https://git.openstack.org/cgit/openstack-infra/zuul/tree/tests/fixtures/layouts/good_connections1.yaml
[3] https://git.openstack.org/cgit/openstack-infra/zuul/commit/?id=352264b3c22b501ae53c1643e31df2ccdfc89388



More information about the OpenStack-Infra mailing list