Commit Graph

24 Commits

Author SHA1 Message Date
James E. Blair 3aa546da86 Remove the rpc client and listener
These are not used any more, remove them from the scheduler and
the "zuul" client.

Change-Id: I5a3217dde32c5f8fefbb0a7a8357a737494d2956
2022-01-25 06:44:09 -08:00
Tobias Henkel 5c4e8d7ddd Route streams to different zones via finger gateway
In some distributed deployments we need to route traffic via single
entry points that need to dispatch the traffic. For this use case make
all components aware of their zone so it is possible to compute if
traffic needs to go via an intermediate finger gateway or not.

Therefore we register the gearman function 'fingergw:info:<zone>' if
the fingergw is zoned. That way the scheduler will be able to route
streams from different zones via finger gateways that are responsible
for their zone.

Change-Id: I655427283205ea02de6f0f271b4aa5092ac05278
2021-06-10 14:09:37 +02:00
Antoine Musso 4aca407bd6 Add client_id to RPC client
A Gearman client can set a client id which is then used on the server
side to identify the connection. Lack of a client_id makes it harder to
follow the flow when looking at logs:

 gear.Connection.b'unknown'  INFO Connected to 127.0.0.1 port 4730
 gear.Server Accepted connection
  <gear.ServerConnection ... name: None ...>
                                   ^^^^

In RPCClient, introduce a client_id argument which is passed to
gear.Client().
Update callers to set a meaningful client_id.

Change-Id: Idbd63f15b0cde3d77fe969c7650f4eb18aec1ef6
2020-01-28 10:16:19 +01:00
Matthieu Huin a0015014c9
enqueue: make trigger deprecated
The patchset or ref, pipeline and project should be enough to trigger an
enqueue. The trigger argument is not validated or used anymore when
enqueueing via RPC.

Change-Id: I9166e6d44291070f01baca9238f04feedcee7f5b
2019-12-10 07:33:30 +01:00
David Shrewsbury e1460154d9 Add autohold-info CLI command
New command for the zuul CLI client to retrieve autohold details.
Currently, the only new information included is the 'current_count'
field, but this will later be extended to include held nodes.

Change-Id: Ieae2aea73123b5467d825d4738be07481bb15348
2019-09-16 10:47:27 -04:00
David Shrewsbury 716ac1f2e1 Store autohold requests in zookeeper
Storing autohold requests in ZooKeeper, rather than in-memory,
allows us to remember requests across restarts, and is a necessity
for future work to scale out the scheduler.

Future changes to build on this will allow us to store held node
information with the change for easy node identification, and to
delete any held nodes for a request using the zuul CLI.

A new 'zuul autohold-delete' command is added since hold requests
are no longer automatically deleted.

This makes the autohold API:
   zuul autohold: Create a new hold request
   zuul autohold-list: List current hold requests
   zuul autohold-delete: Delete a hold request

Change-Id: I6130175d1dc7d6c8ce8667f9b14ae9377737d280
2019-09-16 08:47:53 -04:00
mhuin 9d86c00111 Zuul CLI: allow access via REST
Users can set the [webclient] section in their zuul.conf file so that the CLI
relies on REST calls rather than RPC. The CLI accepts a new --auth-token
argument allowing remote users to use privileged REST endpoints.

Change-Id: I5a07fccfd787246c4c494db592b575fbdf90ddb1
2019-07-30 10:46:17 +02:00
Tobias Henkel fb4c6402a4
Use gearman client keepalive
If the gearman server vanishes (e.g. due to a VM crash) some clients
like the merger may not notice that it is gone. They just wait forever
for data to be received on an inactive connection. In our case the VM
containing the zuul-scheduler crashed and after the restart of the
scheduler all mergers were waiting for data on the stale connection
which blocked a successful scheduler restart.  Using tcp keepalive we
can detect that situation and let broken inactive connections be
killed by the kernel.

Depends-On: I8589cd45450245a25539c051355b38d16ee9f4b9
Change-Id: I30049d59d873d64f3b69c5587c775827e3545854
2018-12-11 21:28:59 +01:00
Matthieu Huin c2c5ce26bf Add a dequeue command to zuul client
Add the ability for an operator to dequeue a change from a pipeline.

Change-Id: I4524291807c8b97b62cfaa31fb5d46dc48adbac9
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2018-07-27 04:21:07 +00:00
mhuin e4bf201286 zuul autohold: allow operator to specify nodes TTL
Add the option --node-hold-expiration to `zuul autohold`. This parameter
allows an operator to specify how long a node set should remain in
HOLD state after a build failure.

Change-Id: I25020d1722de97426e6699653ff72eba03c46b16
Depends-On: I9a09728e5728c537ee44721f5d5e774dc0dcefa7
2018-03-26 10:32:18 +02:00
Krzysztof Klimonda 37d5403629 Support autoholding nodes for specific changes/refs
Add support for "scoped" autohold requests, making it possible
to create requests that match a given ref filter and hold nodes
for build that matches the filter.

Introduce two new arguments to `zuul autohold`: --ref and --change,
with --ref accepting regex that builds are matched against, and
--change being a shortcut that creates a filter for the specific change.

Change-Id: I801ba1af4b1bda46abff07791dd96828f2738621
2018-02-08 19:26:08 +01:00
David Shrewsbury c4676133ae New client command for printing autohold requests
Adds a new zuul CLI command (autohold-list) to list all of the
current autohold requests.

Change-Id: Ide69f47bfe5c904d05de0ec25d890551e248140e
2017-10-16 12:41:57 -04:00
David Shrewsbury cc6d2fdcd1 Fix autohold RPC protocol
Do not use _name suffix in parameter names in the RPC protocol,
for consistency.

Change-Id: I221ec29260cd0a632b0c56b2d192537afc931b02
2017-07-31 16:16:36 -04:00
David Shrewsbury 36b2adf52a Add required reason for hold
Change-Id: Ia3b5b513731c784780bc8aa61f388b2a42d7d794
2017-07-31 15:40:13 -04:00
David Shrewsbury ffab07a844 Implement autohold
Adds the 'autohold' client option, the scheduler implementation
of it, and a unit test for it.

The autohold is automatically removed from the in-memory data
structure once we've reached the number of requested runs of
the job.

Story: 2000905
Change-Id: Ieac0b5fee6801313fa23cce69520eb348735ad99
2017-07-31 14:53:43 -04:00
Monty Taylor 51139a0682 Add web-based console log streaming
zuul now provides socket-based console streaming, which is super cool.
In order to have jenkins parity with web streaming, we need to provide a
websocket (javascript in browsers can't really connect to random ports
on servers)

After surveying the existing python websocket options, basically all of
them are based around twisted, eventlet, gevent or asyncio. It's not
just a thing we can easily deal with from our current webob/paste
structure, because it is a change to the fundamental HTTP handling.
While we could write our own websocket server implementation that was
threaded like the rest of zuul, that's a pretty giant amount of work.

Instead, we can run an async-based server that's just for the
websockets, so that we're not all of a sudden putting async code into
the rest of zuul and winding up frankensteined. Since this is new code,
using asyncio and python3 seems like an excellent starting place.

aiohttp supports running a websocket server in a thread. It also
supports doing other HTTP/REST calls, so by going aiohttp we can set
ourselves up for a single answer for the HTTP tier.

In order to keep us from being an open socket relay, we'll expect two
parameters as the first message on the websocket - what's the zuul build
uuid, and what log file do we want to stream. (the second thing,
multiple log files, isn't supported yet by the rest of zuul, but one can
imagine a future where we'd like to support that too, so it's in the
protocol) The websocket server will then ask zuul over gearman for the
IP and port associated with the build and logfile and will start
streaming it to the socket.

Ultimately we'll want the status page to make links of the form:

  /console.html?uuid=<uuid>&logfile=console.log

and we'll want to have apache map the websocket server to something like
/console.

Co-Authored-By: Monty Taylor <mordred@inaugust.com>

Change-Id: Idd0d3f9259e81fa9a60d7540664ce8d5ad2c298f
2017-07-10 10:32:28 -04:00
Paul Belanger 0a21f0a1d5
Add ssl support to gearman / gearman_server
Enable SSL support for gearman. We also created an new SSLZuulBaseTest
class to provide a simple way to use SSL end to end where possible. A
future patch will enable support in zookeeper.

Change-Id: Ia8b89bab475d758cc6a021988f8d79ead8836a9d
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2017-06-14 10:10:45 -04:00
Clint Byrum e5c4afa94c Use gear Text interface
This makes the transition to python3 much smoother.

Change-Id: I9d8638dd98502bdd91cbe6caf3d94ce197f06c6f
Depends-On: If6bfc35d916cfb84d630af59f4fde4ccae5187d4
Depends-On: I93bfe33f898294f30a82c0a24a18a081f9752354
2017-05-19 06:39:15 -07:00
Paul Belanger baca313dd5 Add tenant support to zuul client
Here we are adding tenant support and re-enabling unit tests for
enqueue and promote.

Change-Id: I384128b9b14be1dc3c4a0c914dcaf13d30f1792f
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2016-11-14 08:47:42 -05:00
James E. Blair 91e3459805 Add enqueue-ref command to client
Change-Id: Icf496a4d54e346f6dea01c8822e7ef7e5ef8f097
2015-07-31 17:00:50 -07:00
James E. Blair eb98aba7a2 Set gearman timeout to 300
In practice we are seeing that geard can occasionally get disrupted
and then temporarily backlogged enough that it exceeds the 30 second
timeout for submitting a job.  To make Zuul less fragile in this case,
increase the timeouts for any requests submitted to gearman.

Change-Id: I12741bb259c1a78fa2446d764318f84df34bac67
2014-12-12 11:00:10 -08:00
Joshua Hesketh 85af4e92b9 Add support to list running jobs to zuul client
Change-Id: I16ccc02aa1a3b0cd8648b6ea05fc20c89c92a571
2014-03-31 12:26:43 +11:00
James E. Blair 36658cf7bd Add a promote client command
Takes one or more changes and promotes them to the head of the queue.

Also, change the command line syntax for the enqueue command to accept
change IDs in the form 'change,patchset' in order to match the syntax
of promote, as well as be potentially more compatible with future
triggers.

Change-Id: Ic7ded9587c68217c060328bf4c3518e32fe659e3
2013-12-09 08:13:23 -08:00
James E. Blair ad28e91698 Add a zuul client
Add a command line client called 'zuul' that supports one command
to start with: 'enqueue'.  It allows an operator (one with access
to the gearman server) to enqueue an arbitrary change in a specified
pipeline.  It uses gearman to communicate with the Zuul server, which
now has an added RPC listener component to answer such requests via
gearman.

Add tests for the client RPC interface.

Raise an exception if a Gerrit query does not produce a change.  Unlike
events from Gerrit, user (or admin) submitted events over the RPC bus
are more likely to reference invalid changes.  To validate those, the
Gerrit trigger will raise an exception (and remove from its cache) changes
which prove to be invalid.

Change-Id: Ife07683a736c15f4db44a0f9881f3f71b78716b2
2013-12-02 08:32:01 -08:00