oe-build-perf-test: tag results committed to Git
Create a Git tag when committing results to a Git repository. This patch also implements --commit-results-tag command line option for controlling the tag name. The value is a format string where the following fields may be used: - {git_branch} - target branch being tested - {git_commit} - target commit being tested - {tester_host} - hostname of the tester machine Tagging can be disabled by giving an empty string to --commit-results-tag. The option has no effect if --commit-results is not defined. (From OE-Core rev: 60059ff5b81d6ba9ba344161d51d1290559ac2df) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
28333b3a2d
commit
06b2c75c7e
|
@ -188,7 +188,7 @@ class BuildPerfTestResult(unittest.TextTestResult):
|
||||||
fobj.write(','.join(values) + '\n')
|
fobj.write(','.join(values) + '\n')
|
||||||
|
|
||||||
|
|
||||||
def git_commit_results(self, repo_path, branch=None):
|
def git_commit_results(self, repo_path, branch=None, tag=None):
|
||||||
"""Commit results into a Git repository"""
|
"""Commit results into a Git repository"""
|
||||||
repo = GitRepo(repo_path, is_topdir=True)
|
repo = GitRepo(repo_path, is_topdir=True)
|
||||||
if not branch:
|
if not branch:
|
||||||
|
@ -223,6 +223,15 @@ class BuildPerfTestResult(unittest.TextTestResult):
|
||||||
if repo.get_current_branch() == branch:
|
if repo.get_current_branch() == branch:
|
||||||
log.info("Updating %s HEAD to latest commit", repo_path)
|
log.info("Updating %s HEAD to latest commit", repo_path)
|
||||||
repo.run_cmd('reset --hard')
|
repo.run_cmd('reset --hard')
|
||||||
|
|
||||||
|
# Create (annotated) tag
|
||||||
|
if tag:
|
||||||
|
# Replace keywords
|
||||||
|
tag = tag.format(git_branch=self.git_branch,
|
||||||
|
git_commit=self.git_commit,
|
||||||
|
tester_host=self.hostname)
|
||||||
|
repo.run_cmd(['tag', '-a', '-m', msg, tag, commit])
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
if os.path.exists(tmp_index):
|
if os.path.exists(tmp_index):
|
||||||
os.unlink(tmp_index)
|
os.unlink(tmp_index)
|
||||||
|
|
|
@ -139,6 +139,9 @@ def parse_args(argv):
|
||||||
parser.add_argument('--commit-results-branch', metavar='BRANCH',
|
parser.add_argument('--commit-results-branch', metavar='BRANCH',
|
||||||
default="{git_branch}",
|
default="{git_branch}",
|
||||||
help="Commit results to branch BRANCH.")
|
help="Commit results to branch BRANCH.")
|
||||||
|
parser.add_argument('--commit-results-tag', metavar='TAG',
|
||||||
|
default="{git_branch}/{git_commit}",
|
||||||
|
help="Tag results commit with TAG.")
|
||||||
|
|
||||||
return parser.parse_args(argv)
|
return parser.parse_args(argv)
|
||||||
|
|
||||||
|
@ -193,7 +196,8 @@ def main(argv=None):
|
||||||
result.update_globalres_file(args.globalres_file)
|
result.update_globalres_file(args.globalres_file)
|
||||||
if args.commit_results:
|
if args.commit_results:
|
||||||
result.git_commit_results(args.commit_results,
|
result.git_commit_results(args.commit_results,
|
||||||
args.commit_results_branch)
|
args.commit_results_branch,
|
||||||
|
args.commit_results_tag)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
Loading…
Reference in New Issue