Switch the launcher to Gearman.

Remove the Jenkins launcher and add a new Gearman launcher (designed
to be compatible with Jenkins) in its place.

See the documentation for how to set up the Gearman Plugin for
Jenkins.

Change-Id: Ie7224396271d7375f4ea42eebb57f883bc291738
Merge branch 'master' into feature/gearman

Change-Id: I4f13e8ecfad5075ca40b66a989a5abe2c3be22fc
Merge branch 'master' into feature/gearman

Change-Id: I9494196710a96414573b11788ed6007817c9f774
Update to new Gear API.

It dropped some "waitFor..." calls.

Also, update the unit tests to deal with some indeterminism in the
order jobs are run (showed up while testing this patch).

Change-Id: Id77838cc1bf0823ee0ee3795cb9190f405a1ff21
Reviewed-on: https://review.openstack.org/31109
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Approved: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Tested-by: Jenkins
Use gear release version 0.1.1.

Change-Id: I14dbe148f0ff57e5d0c50cc712120a2708f158b1
Reviewed-on: https://review.openstack.org/31727
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Reviewed-by: Khai Do <zaro0508@gmail.com>
Approved: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Tested-by: Jenkins
Add optional internal gearman server.

Change-Id: Id4e6b77f5abba23f46236def28f54509c61fd247
Reviewed-on: https://review.openstack.org/30170
Reviewed-by: Monty Taylor <mordred@inaugust.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Approved: Clark Boylan <clark.boylan@gmail.com>
Tested-by: Jenkins
Update to new zuul-gearman protocol.

* Use non-Jenkins terminology "manager" rather than "master".
* Use name+number as the identifier for both stopping builds and
  descriptions.
* Expect 'url' parameter instead of 'full_url'.

Change-Id: I1fe9851556618fc6d6deb8906e3f2ee41725c3ad
Reviewed-on: https://review.openstack.org/31726
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Approved: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Tested-by: Jenkins
Wait for internal gearman server to settle.

If we're using the internal gearman server, wait for workers
to register their functions before proceeding with startup.

This is mostly to handle restarts where we may be immediately
ready to run jobs, but workers may not have registered functions
yet.  In that case, we would immediately start declaring jobs
LOST.  So give them a chance to show up first.

The gearman-plugin for jenkins currently tries to reconnect
every 3 seconds.  We could probably even lower that to 1 or 2.

Change-Id: I173b16ba78cecac91acec26b4f2d55f38610e5a2
Reviewed-on: https://review.openstack.org/31735
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Approved: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Tested-by: Jenkins
Update to gear 0.2.0.

The internal data structure of the server queue changed.

Change-Id: I280a671577d2247b315174f543dfb2ff8b7d51f4
Reviewed-on: https://review.openstack.org/31997
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Approved: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
Handle failed jobs with no results.

If we get a WORK_FAIL or WORK_EXCEPTION with no preceding WORK_DATA
packet with a result, record the result as LOST.

This can happen if Jenkins encounters an exception while running
the job.

Change-Id: I159248e228af4e67ba6c88282346f366592e0d37
Reviewed-on: https://review.openstack.org/32814
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Approved: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
Merge branch 'master' into feature/gearman

Change-Id: I0b6d513aaa2536f01bcd4475d843bb93de69c7e0
Require gear 0.3.1.

And less than 0.4.0 for safety.

Change-Id: I539a2cc7816c15491db55975ac07ee7a148535dc
Reviewed-on: https://review.openstack.org/32973
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Approved: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Tested-by: Jenkins
Fix signal handler.

Change-Id: Idf4c576d6f6576519f1deff85ccc3f3901491d0e
Reviewed-on: https://review.openstack.org/33463
Reviewed-by: Monty Taylor <mordred@inaugust.com>
Approved: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Tested-by: Jenkins
Use flake8/hacking instead of pep8/pyflakes.

Change-Id: Id0e447a7e66562d6ad0298619e36f752ae31adb0
Reviewed-on: https://review.openstack.org/33349
Reviewed-by: James E. Blair <corvus@inaugust.com>
Reviewed-by: Doug Hellmann <doug.hellmann@dreamhost.com>
Approved: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Tested-by: Jenkins
Migrate to pbr.

Change-Id: I734f0f8237fb603ee41a39f06e63c007e79825a9
Reviewed-on: https://review.openstack.org/33350
Reviewed-by: James E. Blair <corvus@inaugust.com>
Reviewed-by: Doug Hellmann <doug.hellmann@dreamhost.com>
Approved: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
Rename requirements files to standard names.

Change-Id: I0385ac9f8336a8c2e45b0fa6ed062b6b23a182aa
Reviewed-on: https://review.openstack.org/33351
Reviewed-by: James E. Blair <corvus@inaugust.com>
Approved: Jeremy Stanley <fungi@yuggoth.org>
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Tested-by: Jenkins
Migrate to testrepository.

Needed to move some directory creation around to be contained within the
testcase, but with parallel testing, we shave 48 seconds off the run
time and go from around 60s to around 11. We're also now compatible with
future subunit-based fast-fail semantics when we grow them.

Change-Id: I6c7148c29d1edb5d9469a8c2afe4b31b2b340009
Reviewed-on: https://review.openstack.org/33352
Approved: James E. Blair <corvus@inaugust.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
Add ability to skip log capture.

Change-Id: I8f3ac5c469e9d530d1ac7776c7488d0c42cdf1ad
Reviewed-on: https://review.openstack.org/35329
Approved: James E. Blair <corvus@inaugust.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
Fix testr configuration

* Correct passing env vars in testr.conf.
* Use ZUUL_TEST_ROOT correctly when building the tempdir for
  the local git dir for tests.
* Remove some tabs from docs.
* Update test gearman server method override to match current gear.
* Make test_failed_changes more deterministic: this test
  occasionally failed due to races in the test.
* Update the fake logger configuration to match previous usage.

Change-Id: I1850b930e37d9a0fd2e9c8098052cf7df60576af
Reviewed-on: https://review.openstack.org/35404
Reviewed-by: Monty Taylor <mordred@inaugust.com>
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Approved: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
Use daemon threads

Otherwise they can prevent exiting on timeout which confuses testr.

Change-Id: I239ab46f44fd09fe6b69fb70fdf4043e3c1daa67
Reviewed-on: https://review.openstack.org/35321
Reviewed-by: Monty Taylor <mordred@inaugust.com>
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Approved: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins