From 9a810ff89ca61c3cd93d39d5fe9bd80a3eeaa282 Mon Sep 17 00:00:00 2001 From: Morgan Richomme Date: Wed, 16 Nov 2016 18:16:43 +0100 Subject: Refactor reporting dir - dockerization - create util function for all the test projects - create a common config files - add unit tests - pep8 JIRA: RELENG-162 Change-Id: Ib209be4233084100ff238a7aeb2843ccc24a6f1e Signed-off-by: Morgan Richomme --- reporting/docker/Dockerfile | 43 ++++++++++++++++++++++++++ reporting/docker/reporting.sh | 65 +++++++++++++++++++++++++++++++++++++++ reporting/docker/requirements.pip | 12 ++++++++ 3 files changed, 120 insertions(+) create mode 100644 reporting/docker/Dockerfile create mode 100755 reporting/docker/reporting.sh create mode 100644 reporting/docker/requirements.pip (limited to 'reporting/docker') diff --git a/reporting/docker/Dockerfile b/reporting/docker/Dockerfile new file mode 100644 index 0000000..789df91 --- /dev/null +++ b/reporting/docker/Dockerfile @@ -0,0 +1,43 @@ +######################################## +# Docker container for OPNFV-REPORTING +######################################## +# Purpose: run opnfv-reporting to provide consistent Testing reporting +# +# Maintained by Morgan Richomme +# Build: +# $ docker build -t opnfv/testreporting:tag . +## +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +# + +FROM nginx:stable + +MAINTAINER Morgan Richomme +LABEL version="danube.1.0" description="OPNFV Test Reporting Docker container" + +ARG BRANCH=master + +ENV HOME /home/opnfv +ENV working_dir /home/opnfv/utils/test/reporting +ENV TERM xterm +ENV COLORTERM gnome-terminal +ENV CONFIG_REPORTING_YAML /home/opnfv/utils/test/reporting/reporting.yaml + +# Packaged dependencies +RUN apt-get update && apt-get install -y \ +ssh \ +git-core \ +wkhtmltopdf \ +--no-install-recommends + +RUN pip install --upgrade pip + +RUN pip install -r ${working_dir}/docker/requirements.txt +RUN git clone --depth 1 https://gerrit.opnfv.org/gerrit/releng /home/opnfv + +WORKDIR ${working_dir} +CMD ["bash", "./docker/reporting.sh"] +CMD ["bash", "mv display /usr/share/nginx/html"] diff --git a/reporting/docker/reporting.sh b/reporting/docker/reporting.sh new file mode 100755 index 0000000..5d4ea11 --- /dev/null +++ b/reporting/docker/reporting.sh @@ -0,0 +1,65 @@ +#!/bin/bash +cd .. + +export PYTHONPATH="${PYTHONPATH}:." +export CONFIG_REPORTING_YAML=./reporting.yaml + +declare -a versions=(colorado master) +declare -a projects=(functest yardstick) + +project=$1 +reporting_type=$2 + +# create Directories if needed +for i in "${versions[@]}" +do + for j in "${projects[@]}" + do + mkdir -p display/$i/$j + done +done + +# copy images, js, css, 3rd_party +cp -Rf 3rd_party display +cp -Rf css display +cp -Rf html/* display +cp -Rf img display +cp -Rf js display + +# if nothing is precised run all the reporting generation +# projet | option +# $1 | $2 +# functest | status, vims, tempest +# yardstick | + +if [ -z "$1" ]; then + echo "********************************" + echo " Functest reporting " + echo "********************************" + echo "reporting vIMS..." + python ./functest/reporting-vims.py + echo "reporting vIMS...OK" + sleep 10 + echo "reporting Tempest..." + python ./functest/reporting-tempest.py + echo "reporting Tempest...OK" + sleep 10 + echo "reporting status..." + python ./functest/reporting-status.py + echo "Functest reporting status...OK" + + echo "********************************" + echo " Yardstick reporting " + echo "********************************" + python ./yardstick/reporting-status.py + echo "Yardstick reporting status...OK" +else + if [ -z "$2" ]; then + reporting_type="status" + fi + echo "********************************" + echo " $project/$reporting_type reporting " + echo "********************************" + python ./$project/reporting-$reporting_type.py +fi + diff --git a/reporting/docker/requirements.pip b/reporting/docker/requirements.pip new file mode 100644 index 0000000..21d5ba9 --- /dev/null +++ b/reporting/docker/requirements.pip @@ -0,0 +1,12 @@ +# +# +# author: Morgan Richomme (morgan.richomme@orange.com) +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +# +pdfkit==0.5.0 +PyYAML==3.11 +simplejson==3.8.1 -- cgit 1.2.3-korg