diff --git a/benchmark/export.py b/benchmark/export.py index c3269c2426edce4352229ae94603fc83b3c46b21..54c336ca712e20378ff0bd873a8c3064eaf00d8a 100755 --- a/benchmark/export.py +++ b/benchmark/export.py @@ -45,6 +45,6 @@ for datapoint in results: print("Sending {}...".format(commit), end='') date = subprocess.check_output(['git', 'show', commit, '-s', '--pretty=%cI']).strip().decode('UTF-8') headers = {'X-Project': args.project, 'X-Branch': args.branch, 'X-Commit': commit, 'X-Config': args.config, 'X-Date': date} - r = requests.post(args.server+"/build_times_8.6", data=times, headers=headers, auth=(args.user, args.password)) + r = requests.post(args.server+"/build_times", data=times, headers=headers, auth=(args.user, args.password)) print(" {}".format(r.text.strip())) r.raise_for_status() diff --git a/benchmark/gitlab-extract.py b/benchmark/gitlab-extract.py index 0c83d51df40987b37fee68b2191b6c1a62baa413..de38705e6def683844afd4bee6bf5f855b81c506 100755 --- a/benchmark/gitlab-extract.py +++ b/benchmark/gitlab-extract.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -import argparse, pprint, sys, glob, zipfile +import argparse, pprint, sys, glob, zipfile, subprocess import requests import parse_log @@ -40,6 +40,9 @@ parser.add_argument("-c", "--commits", parser.add_argument("-a", "--artifacts", dest="artifacts", help="Location of the artifacts (following GitLab's folder structure). If not given (which should be the common case), the artifacts will be downloaded from GitLab.") +parser.add_argument("-b", "--blacklist-branch", + dest="blacklist_branch", + help="Skip the commit if it is contained in the given branch.") args = parser.parse_args() log_file = sys.stdout if args.file == "-" else open(args.file, "a") @@ -60,7 +63,13 @@ BREAK = False for commit in parse_log.parse_git_commits(args.commits): if BREAK: break - print("Fetching {}...".format(commit)) + # test to skip the commit + if args.blacklist_branch is not None: + branches = subprocess.check_output(["git", "branch", "-r", "--contains", commit]).decode("utf-8") + if args.blacklist_branch in map(lambda x: x.strip(), branches.split('\n')): + continue + # Find out more about the commit + print("Fetching {}...".format(commit), end='') commit_data = req("/projects/{}/repository/commits/{}".format(project['id'], commit)) if commit_data.status_code != 200: raise Exception("Commit not found?") @@ -68,10 +77,12 @@ for commit in parse_log.parse_git_commits(args.commits): if builds.status_code != 200: raise Exception("Build not found?") # iterate over builds by decreasing ID, and look for the artifact + found_build = False for build in builds.json(): if build['status'] in ('created', 'pending', 'running'): # build still not yet done, don't fetch this or any later commit BREAK = True + print(" build still in progress, aborting") break if build['status'] != 'success': # build failed or cancelled, skip to next @@ -100,4 +111,8 @@ for commit in parse_log.parse_git_commits(args.commits): log_file.write(build_times.text) log_file.flush() # don't fetch another build + found_build = True + print(" success") break + if not found_build: + print(" found no succeessful build") diff --git a/benchmark/parse_log.py b/benchmark/parse_log.py index 29ce97312ee85e33862c5ff35045ac5ecb9c73fa..310c7822df555c58493cb5ef1d72d44bb9d434c8 100644 --- a/benchmark/parse_log.py +++ b/benchmark/parse_log.py @@ -41,7 +41,7 @@ def parse(file, parse_times = PARSE_FULL): times[name] = time continue # nothing else we know about, ignore - print("Ignoring line",line) + print("Ignoring line",line,"(in commit {})".format(commit)) # end of file. previous commit, if any, is done now. if commit is not None: yield Result(commit, times)