test api: wrapper for retrieving CAS release tags

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk 2020-05-25 09:15:27 -04:00
parent a3b57818d1
commit 8def35c986

View File

@ -3,6 +3,8 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
import os
from core.test_run import TestRun
from connection.local_executor import LocalExecutor
@ -19,3 +21,13 @@ def get_current_commit_message():
return local_executor.run(
f"cd {TestRun.usr.repo_dir} &&"
f'git show HEAD -s --pretty=format:"%B"').stdout
def get_release_tags():
repo_path = os.path.join(TestRun.usr.working_dir, ".git")
output = TestRun.executor.run_expect_success(f"git --git-dir={repo_path} tag").stdout
# Tags containing '-' or '_' are not CAS release versions
tags = [v for v in output.splitlines() if "-" not in v and "_" not in v]
return tags