From d012f3ac3ec4aa2730532be095956867d797aefb Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Sat, 2 Nov 2019 12:18:22 +0100 Subject: Publish artifacts to S3 repository MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It simplifies Jenkins or Gitlab jobs by automatically publishing all artifacts via the framework. It leverages on Amazon Web Services (AWS) SDK [1] which supports the current cases (OPNFV, Xtesting Ansible role [2], etc.). [1] https://boto3.amazonaws.com/v1/documentation/api/latest/index.html?id=docs_gateway [2] https://github.com/collivier/ansible-role-xtesting Change-Id: I66e380c4da29fb0f973472a2c59ae0ea3c44fcfd Signed-off-by: Cédric Ollivier --- xtesting/ci/run_tests.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'xtesting/ci') diff --git a/xtesting/ci/run_tests.py b/xtesting/ci/run_tests.py index 5e2b49e5..71e8cfd4 100644 --- a/xtesting/ci/run_tests.py +++ b/xtesting/ci/run_tests.py @@ -65,6 +65,9 @@ class RunTestsParser(): self.parser.add_argument("-r", "--report", help="Push results to " "database (default=false).", action="store_true") + self.parser.add_argument("-p", "--push", help="Push artifacts to " + "S3 repository (default=false).", + action="store_true") def parse_args(self, argv=None): """Parse arguments. @@ -85,6 +88,7 @@ class Runner(): self.overall_result = Result.EX_OK self.clean_flag = True self.report_flag = False + self.push_flag = False self.tiers = tier_builder.TierBuilder( pkg_resources.resource_filename('xtesting', 'ci/testcases.yaml')) @@ -174,6 +178,8 @@ class Runner(): LOGGER.info("Test result:\n\n%s\n", test_case) if self.clean_flag: test_case.clean() + if self.push_flag: + test_case.publish_artifacts() except ImportError: LOGGER.exception("Cannot import module %s", run_dict['module']) except AttributeError: @@ -226,12 +232,14 @@ class Runner(): for tier in tiers_to_run: self.run_tier(tier) - def main(self, **kwargs): + def main(self, **kwargs): # pylint: disable=too-many-branches """Entry point of class Runner""" if 'noclean' in kwargs: self.clean_flag = not kwargs['noclean'] if 'report' in kwargs: self.report_flag = kwargs['report'] + if 'push' in kwargs: + self.push_flag = kwargs['push'] try: LOGGER.info("Deployment description:\n\n%s\n", env.string()) self.source_envfile() -- cgit