Commit 49142779 authored by Ralf Jung's avatar Ralf Jung
Browse files

update gitlab-extract to handle the double-CI-build (Coq 8.5 and 8.6)

parent e6aeb885
...@@ -51,27 +51,34 @@ if project is None: ...@@ -51,27 +51,34 @@ if project is None:
sys.stderr.write("Project not found.\n") sys.stderr.write("Project not found.\n")
sys.exit(1) sys.exit(1)
BREAK = False
for commit in parse_log.parse_git_commits(args.commits): for commit in parse_log.parse_git_commits(args.commits):
print("Fetching {}...".format(commit)) print("Fetching {}...".format(commit))
commit_data = req("/projects/{}/repository/commits/{}".format(project['id'], commit)) commit_data = req("/projects/{}/repository/commits/{}".format(project['id'], commit))
if commit_data.status_code != 200: if commit_data.status_code != 200:
raise Exception("Commit not found?") raise Exception("Commit not found?")
builds = req("/projects/{}/repository/commits/{}/builds".format(project['id'], commit)) builds = req("/projects/{}/repository/commits/{}/builds".format(project['id'], commit))
if builds.status_code != 200: if builds.status_code != 200:
# no build raise Exception("Build not found?")
continue # iterate over builds by decreasing ID, and look for the artifact
build = first(sorted(builds.json(), key = lambda b: -int(b['id']))) for build in builds.json():
if build is None or build['status'] == 'failed': if build['status'] in ('created', 'pending', 'running'):
# build failed (or missing...??) # build still not yet done, don't fetch this or any later commit
continue BREAK = True
if build['status'] == 'running':
# build still running, don't fetch this or any later commit
break break
if build['status'] != 'success':
# build failed or cancelled, skip to next
# now fetch the build times # now fetch the build times
build_times = requests.get("{}/builds/{}/artifacts/file/build-time.txt".format(project['web_url'], build['id'])) build_times = requests.get("{}/builds/{}/artifacts/file/build-time.txt".format(project['web_url'], build['id']))
if build_times.status_code != 200: if build_times.status_code != 200:
raise Exception("No artifact at build?") # no artifact at this build, try another one
# Output in the log file format # Output in the log file format
log_file.write("# {}\n".format(commit)) log_file.write("# {}\n".format(commit))
log_file.write(build_times.text) log_file.write(build_times.text)
log_file.flush() log_file.flush()
# don't fetch another one
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment