diff options
Diffstat (limited to 'resources')
-rw-r--r-- | resources/tools/presentation/generator_alerts.py | 10 | ||||
-rw-r--r-- | resources/tools/presentation/specification_CPTA.yaml | 4 | ||||
-rw-r--r-- | resources/tools/presentation/utils.py | 4 |
3 files changed, 15 insertions, 3 deletions
diff --git a/resources/tools/presentation/generator_alerts.py b/resources/tools/presentation/generator_alerts.py index 71913eb0b5..77302b6168 100644 --- a/resources/tools/presentation/generator_alerts.py +++ b/resources/tools/presentation/generator_alerts.py @@ -18,6 +18,7 @@ from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from os.path import isdir +from utils import execute_command from errors import PresentationError @@ -262,6 +263,15 @@ class Alerting(object): except IOError: logging.error("Not possible to write the file '{0}.html'.". format(file_name)) + + zip_file = config.get("zip-output", None) + if zip_file: + logging.info("Writing the file '{0}/{1}' ...". + format(config["output-dir"], zip_file)) + execute_command("tar czvf {dir}/{zip} {dir}/{input}.*".format( + dir=config["output-dir"], + zip=zip_file, + input=config["output-file"])) else: raise AlertingError("Alert of type '{0}' is not implemented.". format(alert["type"])) diff --git a/resources/tools/presentation/specification_CPTA.yaml b/resources/tools/presentation/specification_CPTA.yaml index 8c5217bb2f..8dfd9419fb 100644 --- a/resources/tools/presentation/specification_CPTA.yaml +++ b/resources/tools/presentation/specification_CPTA.yaml @@ -131,7 +131,9 @@ output-dir: "_build/_static/vpp" # The name of the output files. ASCII text and HTML formats are # generated. - output-file: "jenkins-alert-failed-tests" + output-file: "trending-failed-tests" + # If defined, all output files are zipped into this file. + zip-output: "failed-tests.tar.gz" data-sets: diff --git a/resources/tools/presentation/utils.py b/resources/tools/presentation/utils.py index 2cc85c24d1..51bb1d0305 100644 --- a/resources/tools/presentation/utils.py +++ b/resources/tools/presentation/utils.py @@ -120,8 +120,8 @@ def execute_command(cmd): :param cmd: Command to execute. :type cmd: str - :returns: Return code of the executed command. - :rtype: int + :returns: Return code of the executed command, stdout and stderr. + :rtype: tuple(int, str, str) """ env = environ.copy() |