third-party-ci-tools/monitoring/ci-status
Matt Smith 5530e30eb9 Adding ci-status command line tool
This is a tool I developed to provide quick access to ThirdParty CI
stats from the command line.  Designed to be easily extensible, it's
built on top of Gerrit SSH Queries and thus requries Gerrit SSH access
to run

Change-Id: I9a76cff22858776ed95508f0b07140dce2b8863a
2016-07-08 15:39:55 -07:00
..
ci-status.py Adding ci-status command line tool 2016-07-08 15:39:55 -07:00
README.rst Adding ci-status command line tool 2016-07-08 15:39:55 -07:00
requirements.txt Adding ci-status command line tool 2016-07-08 15:39:55 -07:00

CI Status Tool

Used for a quick stats collection on Third Party CIs for various OpenStack projects.

Example usage:

$ ./ci-status.py -v -u datera-ci \\
        -k /home/user/.ssh/id_rsa \\
        -c "Datera CI" -a datera-dsvm-full -t 2 \\
        -j openstack/cinder \\
        --failures --number-of-reports --is-reporting \\
        --jenkins_disagreement

Output:

Gerrit Query: ssh -i /home/user/.ssh/id_rsa -p 29418 dater
a-ci@review.openstack.org "gerrit query --format=JSON --comments --current-
patch-set project:openstack/cinder NOT age:2d  reviewer:Datera CI "

##### DATERA-DSVM-FULL #####

####### --number-of-reports arg result #######

40 results in 2 days

###### --is-reporting arg result #######

Review: 263026 --> 2016-07-07T17:02:15+00:00

###### --failures arg result #######

20% failures

###### --jenkins-disagreement arg result #######

0% -1 Jenkins && +1 CI
20% +1 Jenkins && -1 CI

Minimal usage:

$ ./ci-status.py -u datera-ci -k /home/user/.ssh/id_rsa \\
        -j openstack/cinder -c "Datera CI" -a datera-dsvm-full \\
        --is-reporting

Output:

##### DATERA-DSVM-FULL #####
Review: 263026 --> 2016-07-07T17:02:15+00:00

Passthrough query usage:

$ ./ci-status.py -u datera-ci -k /home/user/.ssh/id_rsa \\
        -q "reviewer:{Some Body} -j openstack/cinder"

Output:

Will be a large dictionary

Config example:

# In .gerritqueryrc file in your $HOME directory
# (or passed in via config option)

[DEFAULT]
verbose=True
host=review.openstack.org
username=datera-ci
port=29418
query_project=openstack/cinder
keyfile=/home/user/.ssh/id_rsa

# I would not recommend putting any other flags into this config
# file otherwise you could introduce silent errors
# For example:

# Adding these fields
ci_account=datera-ci
ci_runner_name=datera-dsvm-full

# Then running this command
# $ ./ci-status.py -c mellanox-ci --is-reporting

# Would report a false negative for Datera. A CI
# will show as non-reporting if you provide the
# ci_account name of one CI and the ci_runner_name of
# a different CI.  The tool has no way to tell that
# these values do not belong together and will just
# report that the CI has not posted within the specified
# timeframe.

The "--all" flag:

# In order to use this flag, you must first run this command:
$ ./ci-status.py --scrape-wiki --force -j openstack/your_project


# It will fill your .gerritquerycache file with information about
# the various CIs for your desired OpenStack project

# Now you're free to run commands with the --all flag
$ ./ci-status -j openstack/you_project --all --is-reporting