Commit Graph

12 Commits

Author SHA1 Message Date
Felix Edel 8b7535b7a0 Don't fail on missing change_queues key in status json
Since the pipeline state is stored in ZooKeeper, there could be cases
where the change_queues key is missing in the status json. This makes
API requests fail:

2022-02-22 17:56:18,390 ERROR cherrypy.error.139989033522128: [22/Feb/2022:17:56:18] HTTP
Traceback (most recent call last):
  File "/opt/zuul/lib/python3.8/site-packages/cherrypy/_cprequest.py", line 638, in respond
    self._do_respond(path_info)
  File "/opt/zuul/lib/python3.8/site-packages/cherrypy/_cprequest.py", line 697, in _do_respond
    response.body = self.handler()
  File "/opt/zuul/lib/python3.8/site-packages/cherrypy/lib/encoding.py", line 223, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/opt/zuul/lib/python3.8/site-packages/cherrypy/lib/jsontools.py", line 59, in json_handler
    value = cherrypy.serving.request._json_inner_handler(*args, **kwargs)
  File "/opt/zuul/lib/python3.8/site-packages/cherrypy/_cpdispatch.py", line 54, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/opt/zuul/lib/python3.8/site-packages/zuul/web/__init__.py", line 1050, in status_change
    return result_filter.filterPayload(payload)
  File "/opt/zuul/lib/python3.8/site-packages/zuul/web/__init__.py", line 193, in filterPayload
    for change_queue in pipeline['change_queues']:
KeyError: 'change_queues'

Fix this by using a .get() call rather than directly accessing the
dictionary key by name.

A similar issue was already fixed in [1].

[1]: https://review.opendev.org/c/zuul/zuul/+/829018

Change-Id: I947f58f02c3da7dad35d1fc186c7026800f7cbdd
2022-02-23 08:25:54 +01:00
James E. Blair f70319e5a5 Update zuul-changes for use with zuul-client
The gearman RPC methods are being removed, so this needs a change
to work with one of the web-based methods.  The most simpla end
forward-looking method is zuul-client, so update it to use that.

Change-Id: If3f6ca4bae2b2beddb3bb71b36fdcba112722186
2021-12-14 09:17:07 -08: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
Tobias Henkel 7d983fd51f Make tenant and pipeline optional in zuul-changes
When using zuul-changes to save pipeline states one currently needs to
have a list of all tenant/pipeline combinations in the deployment. In
large deployments this can be a hassle. Making tenant and pipeline
optional makes this quite easy to save a complete pipeline state of
the entire zuul deployment.

Change-Id: Ibfa0bf3e3d23c729e24c208699294ef143f20945
2019-08-02 06:50:43 +02:00
Tristan Cacqueray 2f1260c2f9 scheduler: return project_canonical in status page
This change fix zuul-changes.py usage when there are ambiguous project names.

Change-Id: Icebb4f065d4f2df478e801873ff9abead01b0aa8
2018-07-27 13:08:56 +00:00
Tristan Cacqueray 559af7048b zuul-changes: update for the new api url
The Zuul api url changed, this change updates the zuul-changes.py
script.

Change-Id: Id45f9a8a7e1542bef55097dd89f93a9addc91e1b
2018-04-12 03:20:48 +00:00
Monty Taylor 9010dc50f4
Remove .json suffix from web routes
For the existing simple cases, like builds, jobs and status, having the json
suffix is a perfectly reasonable thing. However, in the next patch it starts
to get weird. When we add support for specific changes or specific jobs, we
we grow URLs like:

  /openstack/status.json
  /openstack/status/change/537010,2.json

Those read weird, because change/537010,2 is much more like an argument or
specialiation of status. The thing that reads weird is the status call having
 .json but the change-specific call just being status/, not
the trailing .json on the change url.

Removing the json suffix gets us:

  /openstack/status
  /openstack/status/change/537010,2

which feels better as the status portion of the url remains consistent.

This is done first in the stack so that as we add tests for new
endpoints we can get them right the first time rather than having a big
rename patch at the end (which is what this started as)

Change-Id: I4baf33fdacaf46943fbd192743551bb27bd618de
2018-02-19 09:27:31 -06:00
James E. Blair d05469e8bf Update zuul-changes script for v3
We need a tenant name on the enqueue command line.

Change-Id: I93a250ab9b7cf904dcffcb58e908ae813e40405e
2017-09-29 09:04:15 -07:00
Morgan Fainberg 4c6a774419
Python 3 Fixes: Use print() not print
For Python 3 fixes, use print() instead of the python 2 "print"
bareword syntax.

Change-Id: Ib77544d111aab6a1bd52555bcbd1dad9955d0074
2016-06-02 07:28:23 +03:00
James E. Blair 574ec76a60 Update zuul-changes to use the enqueue command
Change-Id: I990cd0282f8e6d7706dc1bb6b6573b929623a171
2015-03-03 15:46:04 +11:00
Monty Taylor 6bef8ef87a 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
2013-06-24 22:20:13 +00:00
James E. Blair c3b8eff63c Add a utility script for mass-comments.
The script prints a gerrit review command for every change in
a given zuul pipeline.

Change-Id: Ibdee87ea64c977e7589cbc3ee9567e866cb78341
Reviewed-on: https://review.openstack.org/23784
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Approved: Jeremy Stanley <fungi@yuggoth.org>
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Tested-by: Jenkins
2013-03-08 17:41:40 +00:00