aboutsummaryrefslogtreecommitdiffstats
path: root/resources
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2018-09-18 12:50:16 +0200
committerTibor Frank <tifrank@cisco.com>2018-09-18 14:13:47 +0200
commit5ad9b364cbd45a0b25d73412b9777ac14df92b0a (patch)
treebb1c836a98bf98423855df6056eb4379fe70e6d4 /resources
parent9440d0f9cfca758b48297350bba52d853cc483ef (diff)
CSIT-1288: Prepare data to be sent by Jenkins
- Add creation of tar.gz file Change-Id: I525c713bb3e157cd94337222781066252c3fa517 Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources')
-rw-r--r--resources/tools/presentation/generator_alerts.py10
-rw-r--r--resources/tools/presentation/specification_CPTA.yaml4
-rw-r--r--resources/tools/presentation/utils.py4
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()