Skip to content

Instantly share code, notes, and snippets.

@kmaglione
Created July 7, 2020 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmaglione/097abec5ed1d8a748ca8e0cd8bd597c5 to your computer and use it in GitHub Desktop.
Save kmaglione/097abec5ed1d8a748ca8e0cd8bd597c5 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# vim:se sts=4 sw=4 et fenc=utf-8 ft=python:
import json
import sys
import requests
headers = {
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0',
}
def get(path):
return requests.get('https://treeherder.mozilla.org/api/' + path,
headers=headers)
def get_results(path):
return get(path).json()['results']
PROJECT = 'mozilla-central'
PROJECT_URL = 'project/%s/' % PROJECT
PUSHES_URL = PROJECT_URL + 'push/'
JOBS_URL = PROJECT_URL + 'jobs/'
ARTIFACTS_URL = ('https://firefox-ci-tc.services.mozilla.com'
'/api/queue/v1/task/{task_id}/runs/{retry_id}/artifacts')
for push in get_results(PUSHES_URL):
jobs_url = '%s?push_id=%s&count=2000' % (JOBS_URL, push['id'])
for job in get_results(jobs_url):
if not (job['job_group_symbol'] == 'test-info' and
job['job_type_symbol'] == 'fission' and
job['state'] == 'completed' and
job['result'] == 'success'):
continue
artifacts_url = ARTIFACTS_URL.format(**job)
for result in requests.get(artifacts_url).json()['artifacts']:
if result['name'].endswith('test-info-fission.json'):
del push['revisions']
url = '%s/%s' % (artifacts_url, result['name'])
data = requests.get(url).json()
data['push'] = push
json.dump(data, sys.stdout, indent=2)
sys.exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment