Skip to content

Instantly share code, notes, and snippets.

@omaciel
Last active December 22, 2015 18:39
Show Gist options
  • Save omaciel/6514786 to your computer and use it in GitHub Desktop.
Save omaciel/6514786 to your computer and use it in GitHub Desktop.
from scout import *
import argparse
import sys
JENKINS_BRN = 'http://smqa-r210-01.lab.eng.brq.redhat.com:8080/job'
JENKINS_RDU = 'http://hudson.rhq.lab.eng.bos.redhat.com:8080/hudson/job'
PLAN_COVERAGE = [
{'name': 'katello-api-pyCoverage', 'url': JENKINS_BRN},
{'name': 'katello-gui-coverage', 'url': JENKINS_RDU},
]
PLAN_UPSTREAM = [
{'name': 'cron-katello-api-matrix', 'url': JENKINS_BRN},
{'name': 'cron_katello-e2e', 'url': JENKINS_BRN},
{'name': 'katello-gui', 'url': JENKINS_RDU},
{'name': 'headpin-gui', 'url': JENKINS_RDU},
{'name': 'official-headpin-cli', 'url': JENKINS_RDU},
]
PLAN_DOWNSTREAM = [
{'name': 'sat6-cli-matrix', 'url': JENKINS_BRN},
{'name': 'sat6-e2e', 'url': JENKINS_BRN},
{'name': 'official-sam-cli', 'url': JENKINS_RDU},
{'name': 'satellite6-gui', 'url': JENKINS_RDU},
{'name': 'sam-gui', 'url': JENKINS_RDU},
]
PLANS = [PLAN_COVERAGE, PLAN_UPSTREAM, PLAN_DOWNSTREAM]
data = {
'Coverage': [],
'Upstream': [],
'Downstream': [],
}
def fetch(user, passwd, jobs):
data = []
for job in jobs:
resp = fetch_build_data(user, passwd, job['url'], job['name'])
data.append(resp)
return data
def jenkins_report(title, jobs):
print title
for job in jobs:
print "%(date)s - %(name)s - %(status)s - ( PASS: %(passed)s | SKIPPED: %(skipped)s | FAILED: %(failed)s = %(total)s )" % job
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('-u', '--username', type=str, dest='username', default='admin', help='Valid system username')
parser.add_argument('-p', '--password', type=str, dest='password', default='admin', help='Valid system user password')
[options, ignored_options] = parser.parse_known_args()
if options.username is None or options.password is None:
parser.print_usage()
sys.exit(-1)
jenkins_report('Coverage', fetch(options.username, options.password, PLAN_COVERAGE))
jenkins_report('Upstream', fetch(options.username, options.password, PLAN_UPSTREAM))
jenkins_report('Downstream', fetch(options.username, options.password, PLAN_DOWNSTREAM))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment