Fix reenqueue wrong item on new patchset

When uploading a new pachset of a change with currently running jobs
zuul did not enqueue the correct patchset. The reason for this is that
when trying to abort the build it unlocks the (eventually existing)
semaphore. As the semaphore handler is located in the tenant it must
access the tenant object which it did in the layout of the old build
set. However this object can be None in some cases. The tenant also
can be accessed via the pipeline in the item which always works.

This also adds a test case for this as dynamic variant and also the
according test case for the semaphores.

Change-Id: Ic21ce36421d0805517f761aab7fbe776067960a8
3 files changed