diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2019-11-02 12:18:22 +0100 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2019-11-02 19:31:58 +0100 |
commit | 60cfa2b933919786c5c65f9ed0817b3c8686d854 (patch) | |
tree | 384ebeb73f13e517472c11582740ad21a2a341c6 /xtesting/ci | |
parent | 70ad812e04ed9f1c2a5fdd60c128d177db8ab480 (diff) |
Publish artifacts to S3 repository
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 <cedric.ollivier@orange.com>
(cherry picked from commit d012f3ac3ec4aa2730532be095956867d797aefb)
Diffstat (limited to 'xtesting/ci')
-rw-r--r-- | xtesting/ci/run_tests.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/xtesting/ci/run_tests.py b/xtesting/ci/run_tests.py index c8e99663..7379f092 100644 --- a/xtesting/ci/run_tests.py +++ b/xtesting/ci/run_tests.py @@ -66,6 +66,9 @@ class RunTestsParser(object): 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. @@ -86,6 +89,7 @@ class Runner(object): 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')) @@ -175,6 +179,8 @@ class Runner(object): 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: @@ -227,12 +233,14 @@ class Runner(object): 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() |