Commit Graph

16 Commits

Author SHA1 Message Date
Sorin Sbarnea 3d1411f3a1 Enable configuration via environment variables
Refactors configuration loading in order to simplify it and to
allow overriding defaults using environment variables.

This behavior is similar to other tools like pip or ansible, which
can load any configurable option from env.

This step ease migration towards containerized use, where we do not
want to keep any secrets inside containers and we may want to
avoid volume mounting, especially when testing.

Change-Id: I0d3a9f19b0ba8d1604d0ca63db01296a3219fb47
2020-09-17 10:59:38 +01:00
Sorin Sbarnea c6f07d7f93 Use pytest for queries
Switches queries testing to use of pytest which provides the following:
- test generator for each query (parametrize)
- ability to test a single query test
- generate html report with test results, making easier to investigate
  failures.
- parallel executions
- minor bugfix which prevented running queries from running with py38
  as the  config parser requires only strings (None being invalid).

Change-Id: I982c694a5160a9ecfd117d177d30b911cfe53425
2020-09-10 10:24:37 +00:00
Sorin Sbarnea 97ca1c24c3 Drop py27 and add py38 jobs
- Dropping py27 as is out of support
- Enable py38 testing, already default python on several distros.
- removes six as a dependency as is no longer needed for pure py3

Change-Id: I1e825073abc6cd55aa2fdc363358f2701152c57b
2020-09-08 10:21:02 +01:00
Sorin Sbarnea f68a8719af Bumped flake8
- Upgraded hacking(flake8)
- Added more modern tox linters environment (pep8 alias)
- Temporary added skips for broken newer rules
- Fixed few basic rule violations
- Moved flake8 config to setup.cfg (tox.ini is not recommended)

Change-Id: I75b3ce5d2ce965a9dc5bdfaa49b2aacd8f0195ad
2020-05-23 08:54:14 +01:00
Matt Riedemann fbdbbc0f40 Switch gerrit URL to review.opendev.org
As of the great renaming of 2019 we need to update the
openstack gerrit URL default to review.opendev.org.

Change-Id: I2e3f7e7fb03be0deba0c95995265376dbce3c5b6
Story: #2005498
Task: #30599
2019-04-22 11:55:55 -04:00
Matt Riedemann 2abdc593e8 Fix ALL_FAILS_QUERY
The playbook location changed and is no longer in project-config
so just make the query generic on the sub-directory rather than
the git repo.

Change-Id: I8532c193992adef0e996a3f42e9e84f491000c32
2019-03-04 15:53:24 -05:00
Clark Boylan cdf6ee031e Fix all fails query not matching any jobs
Monty updated the post-ssh.yaml playbook in project config to do other
post tasks and renamed it to post.yaml as a result. Change
If01bdd7b7656b1a9ebaa5d5d7d021f82093db8ac has all the details.

We need to accomodate that in the all fails query of e-r by updating the
all fails query to look for post.yaml instead of post-ssh.yaml. Note
that there are no query matches for post-ssh.yaml so we don't need an
interim period if matching both.

Change-Id: I208675c2258b6c635925c7b9ea9fae5afd000565
2019-01-17 13:40:34 -08:00
Sorin Sbarnea 6c4f466282 Made elastic-recheck py3 compatible
- Adds py36/py37 jobs.
- Fixed invalid syntax errors
- Bumps dependencies to versions that are py3 compatible

Change-Id: I0cebc35993b259cc86470c5ceb1016462a1d649b
Related-Bug: #1803402
2018-11-29 20:15:07 +00:00
Clark Boylan 53f45539c0 Fix all fails query
There were two problems with the all fails query as sorted out by
manually running the query in kibana. First the query didn't properly
group the two sides of the job log ending query. They were separated by
an OR and were meant to be grouped together as one clause in the query.

Second zuul now requires the .yaml suffix on playbook names so the query
looking for the post ssh playbook needs to end with .yaml.

Change-Id: I951b2824fe6934eca667d1b14f8caf63428da89a
2017-11-30 15:42:57 -08:00
Clark Boylan 69b588cb2b Balance parens in all fails query
Updating uncategorized failures is currently failing on a query parse
error in elasticsearch. This appears to be due to unbalanced parens in
the new all fails query. Rebalance the parens by removing the extra
leading paren.

Change-Id: I05626c563a9a053e396782c54dae4c6fa7d6e269
2017-10-27 10:10:19 -07:00
David Moreau-Simard 97f6408b54
Add support for Zuulv3-specific parameters in elastic-recheck
This commit ensures elastic-recheck is able to support zuul v2 and v3
simultaneously:

- Add message queries based on v3 completion messages
- Include job-output.txt where console.html was expected

Change-Id: If3d7990d892a9698a112d9ff1dd5160998a4efe6
Depends-On: I7e34206d7968bf128e140468b9a222ecbce3a8f1
2017-10-26 19:18:16 -04:00
Paul Belanger 1af432d0a5 Switch to jobs_re for config setting
To avoid confusion, switch everything to use jobs_re for recheckwatch
config.

Change-Id: I1a84db6ec346a32f38e00560c1b322e7d377d434
Needed-By: I1e2369225c9bd83296684af0dd9ea0514d9098c4
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2017-08-07 13:53:53 -04:00
Ihar Hrachyshka 69807fc6eb Capture all dsvm jobs with the default jobs regex
This should make elastic recheck to capture queries in projects like
neutron where the previous regex was not working for quite some time.

(In neutron gate, full job is called
gate-tempest-dsvm-neutron-full-ubuntu-xenial; there are some jobs that
don't even have 'tempest' in their names that should still participate
in the elastic recheck, like grenade jobs, or rally; all of them have
'dsvm' part though).

Speaking of the regex, probably it should have also be applied to
separate job names before classifying them. But I'll leave it for a
follow-up.

Change-Id: If98951d13ba82833444ef4ffbb7c6be179126f2b
2016-11-10 11:09:49 +00:00
Ramy Asselin f4ddadc834 Fix test_queries regression
In change Ic6f115a6882494bf4c087ded4d7cafa557765c28, test_queries.py
was not updated to use the new Config class.
It causes the non-voting test to fail for the 'wrong' reasons.

Change-Id: Ib729d5d360619bf289bc9c91f2a3f856f525a947
2016-10-12 15:53:28 -07:00
Ramy Asselin 5261615d24 Make uncategorized_fails.py configurable
There are a few hardcoded strings and numbers in uncategorized_fails.
Make these configurable so that it is easier to reuse this tool.
Also add some debug logging.

Change-Id: Ie62ce83bb43dcc8d9b382fe6719fe57eacc5727b
2016-09-21 12:14:21 -07:00
Ramy Asselin 49999256f4 Make Elastic Recheck Watch more reusable
Refactor to use a config class to hold all the
params needed so that they can be more easily
overridden and reused across all the
elastic-recheck tools.

In addition, use the new class to make the
jobs_regex and ci_username configurable.

Change-Id: Ic6f115a6882494bf4c087ded4d7cafa557765c28
2016-09-20 18:11:30 -07:00