diff options
-rw-r--r-- | jjb/dovetail/dovetail-ci-jobs.yml | 6 | ||||
-rwxr-xr-x | jjb/dovetail/dovetail-run.sh | 4 | ||||
-rw-r--r-- | jjb/opnfv/opnfv-docs.yml | 6 | ||||
-rw-r--r-- | jjb/qtip/qtip-cleanup.sh | 10 | ||||
-rw-r--r-- | utils/test/dashboard/dashboard/elastic2kibana/main.py | 97 | ||||
-rw-r--r-- | utils/test/dashboard/dashboard/elastic2kibana/templates/duration.json | 45 | ||||
-rw-r--r-- | utils/test/dashboard/dashboard/elastic2kibana/templates/success_percentage.json | 45 | ||||
-rw-r--r-- | utils/test/dashboard/dashboard/elastic2kibana/templates/tests_failures.json | 45 |
8 files changed, 183 insertions, 75 deletions
diff --git a/jjb/dovetail/dovetail-ci-jobs.yml b/jjb/dovetail/dovetail-ci-jobs.yml index 91362ef3a..9d2f69da9 100644 --- a/jjb/dovetail/dovetail-ci-jobs.yml +++ b/jjb/dovetail/dovetail-ci-jobs.yml @@ -149,6 +149,12 @@ - 'dovetail-cleanup' - 'dovetail-{testsuite}' + publishers: + - archive: + artifacts: 'results/**/*' + allow-empty: true + fingerprint: true + ######################## # builder macros ######################## diff --git a/jjb/dovetail/dovetail-run.sh b/jjb/dovetail/dovetail-run.sh index 5653d3e9e..6453425ce 100755 --- a/jjb/dovetail/dovetail-run.sh +++ b/jjb/dovetail/dovetail-run.sh @@ -42,7 +42,11 @@ echo "Dovetail: Pulling image opnfv/dovetail:${DOCKER_TAG}" docker pull opnfv/dovetail:$DOCKER_TAG >$redirect # Run docker +echo "Dovetail: docker running..." sudo docker run ${opts} ${envs} ${labconfig} ${sshkey} opnfv/dovetail:${DOCKER_TAG} \ "/home/opnfv/dovetail/scripts/run.py" +echo "Dovetail: store results..." +sudo cp -r /home/opnfv/dovetail/results ./ + echo "Dovetail: done!" diff --git a/jjb/opnfv/opnfv-docs.yml b/jjb/opnfv/opnfv-docs.yml index 743657334..0ac8aa7e0 100644 --- a/jjb/opnfv/opnfv-docs.yml +++ b/jjb/opnfv/opnfv-docs.yml @@ -14,11 +14,13 @@ stream: - master: branch: '{stream}' + doc-version: '' gs-pathname: '' disabled: false - colorado: branch: 'stable/{stream}' - gs-pathname: '/{stream}' + doc-version: '2.0' + gs-pathname: '/{stream}/{doc-version}' disabled: false ######################## @@ -82,7 +84,7 @@ - string: name: GS_URL default: '$GS_BASE{gs-pathname}' - description: "Directory where the build artifact will be located upon the completion of the build." + description: "Directory where the build artifact will be located upon the completion of the build." scm: - gerrit-trigger-scm: diff --git a/jjb/qtip/qtip-cleanup.sh b/jjb/qtip/qtip-cleanup.sh index b923aa2a8..95babb318 100644 --- a/jjb/qtip/qtip-cleanup.sh +++ b/jjb/qtip/qtip-cleanup.sh @@ -6,15 +6,12 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -echo "Cleaning up QTIP docker containers/images..." - # Remove previous running containers if exist if [[ ! -z $(docker ps -a | grep opnfv/qtip) ]]; then echo "Removing existing opnfv/qtip containers..." - running_containers=$(docker ps | grep opnfv/qtip | awk '{print $1}') - docker stop ${running_containers} - all_containers=$(docker ps -a | grep opnfv/qtip | awk '{print $1}') - docker rm ${all_containers} + # workaround: sometimes it throws an error when stopping qtip container. + # To make sure ci job unblocked, remove qtip container by force without stopping it. + docker rm -f $(docker ps -a | grep opnfv/qtip | awk '{print $1}') fi # Remove existing images if exist @@ -27,4 +24,3 @@ if [[ ! -z $(docker images | grep opnfv/qtip) ]]; then docker rmi opnfv/qtip:$tag done fi - diff --git a/utils/test/dashboard/dashboard/elastic2kibana/main.py b/utils/test/dashboard/dashboard/elastic2kibana/main.py index c1cbc308e..37ce03e52 100644 --- a/utils/test/dashboard/dashboard/elastic2kibana/main.py +++ b/utils/test/dashboard/dashboard/elastic2kibana/main.py @@ -3,6 +3,7 @@ import json import urlparse import argparse +from jinja2 import PackageLoader, Environment from common import logger_utils, elastic_access from conf import testcases @@ -51,12 +52,13 @@ class KibanaDashboard(dict): scenario, self.visualization)) - self._visualization_title = self._kibana_visualizations[0].vis_state_title + self._visualization_title = self._kibana_visualizations[0].vis_title def _publish_visualizations(self): for visualization in self._kibana_visualizations: url = urlparse.urljoin(base_elastic_url, '/.kibana/visualization/{}'.format(visualization.id)) logger.debug("publishing visualization '{}'".format(url)) + # logger.error("_publish_visualization: %s" % visualization) elastic_access.publish_json(visualization, es_creds, url) def _construct_panels(self): @@ -163,67 +165,30 @@ class KibanaSearchSourceJSON(dict): self["filter"].append({"match": {"pod_name": {"query": pod, "type": "phrase"}}}) -class VisualizationState(dict): +class VisualizationBuilder(object): def __init__(self, visualization): - super(VisualizationState, self).__init__() - name = visualization.get('name') - fields = visualization.get('fields') - - if name == 'tests_failures': - mode = 'grouped' - metric_type = 'sum' - self['type'] = 'histogram' - else: - # duration or success_percentage - mode = 'stacked' - metric_type = 'avg' - self['type'] = 'line' - - self['params'] = { - "shareYAxis": True, - "addTooltip": True, - "addLegend": True, - "smoothLines": False, - "scale": "linear", - "interpolate": "linear", - "mode": mode, - "times": [], - "addTimeMarker": False, - "defaultYExtents": False, - "setYExtents": False, - "yAxis": {} - } + super(VisualizationBuilder, self).__init__() + self.visualization = visualization - self['aggs'] = [] + def build(self): + name = self.visualization.get('name') + fields = self.visualization.get('fields') - i = 1 + aggs = [] + index = 1 for field in fields: - self['aggs'].append({ - "id": str(i), - "type": metric_type, - "schema": "metric", - "params": { - "field": field.get('field') - } - }) - i += 1 - - self['aggs'].append({ - "id": str(i), - "type": 'date_histogram', - "schema": "segment", - "params": { - "field": "start_date", - "interval": "auto", - "customInterval": "2h", - "min_doc_count": 1, - "extended_bounds": {} - } + aggs.append({ + "id": index, + "field": field.get("field") }) + index += 1 + + env = Environment(loader=PackageLoader('elastic2kibana', 'templates')) + env.filters['jsonify'] = json.dumps + template = env.get_template('{}.json'.format(name)) + vis = template.render(aggs=aggs) + return json.loads(vis) - self['listeners'] = {} - self['title'] = ' '.join(['{} {}'.format(x['type'], x['params']['field']) for x in self['aggs'] - if x['schema'] == 'metric']) class KibanaVisualization(dict): @@ -243,24 +208,24 @@ class KibanaVisualization(dict): :return: """ super(KibanaVisualization, self).__init__() - vis_state = VisualizationState(visualization) - self.vis_state_title = vis_state['title'] + vis = VisualizationBuilder(visualization).build() + self.vis_title = vis['title'] self['title'] = '{} {} {} {} {} {}'.format(project_name, case_name, - self.vis_state_title, + self.vis_title, installer, pod, scenario) self.id = self['title'].replace(' ', '-').replace('/', '-') - self['visState'] = json.dumps(vis_state, separators=(',', ':')) + self['visState'] = json.dumps(vis, separators=(',', ':')) self['uiStateJSON'] = "{}" - self['description'] = "Kibana visualization for project_name '{}', case_name '{}', data '{}', installer '{}'," \ + self['description'] = "Kibana visualization for project_name '{}', case_name '{}', metric '{}', installer '{}'," \ " pod '{}' and scenario '{}'".format(project_name, - case_name, - self.vis_state_title, - installer, - pod, - scenario) + case_name, + self.vis_title, + installer, + pod, + scenario) self['scenario'] = 1 self['kibanaSavedObjectMeta'] = {"searchSourceJSON": json.dumps(KibanaSearchSourceJSON(project_name, case_name, diff --git a/utils/test/dashboard/dashboard/elastic2kibana/templates/duration.json b/utils/test/dashboard/dashboard/elastic2kibana/templates/duration.json new file mode 100644 index 000000000..f50a668db --- /dev/null +++ b/utils/test/dashboard/dashboard/elastic2kibana/templates/duration.json @@ -0,0 +1,45 @@ +{% set aggs = aggs|default([]) -%} + +{ + "title": "duration", + "type": "line", + "listeners": {}, + "params": { + "addLegend": true, + "shareYAxis": true, + "addTooltip": true, + "smoothLines": false, + "scale": "linear", + "interpolate": "linear", + "times": [], + "addTimeMarker": false, + "defaultYExtents": false, + "setYExtents": false, + "yAxis": {}, + "mode": "stacked" + }, + "aggs": [ + {% for agg in aggs %} + { + "id": {{agg.id }}, + "type": "avg", + "schema": "metric", + "params": { + "field": "{{agg.field}}" + } + }, + {% endfor %} + { + "id": {{ aggs|length + 1 }}, + "type": "date_histogram", + "schema": "segment", + "params": { + "field": "start_date", + "interval": "auto", + "customInterval": "2h", + "min_doc_count": 1, + "extended_bounds": {} + } + } + ] +} diff --git a/utils/test/dashboard/dashboard/elastic2kibana/templates/success_percentage.json b/utils/test/dashboard/dashboard/elastic2kibana/templates/success_percentage.json new file mode 100644 index 000000000..993070844 --- /dev/null +++ b/utils/test/dashboard/dashboard/elastic2kibana/templates/success_percentage.json @@ -0,0 +1,45 @@ +{% set aggs = aggs|default([]) -%} + +{ + "title": "success_percentage", + "type": "line", + "listeners": {}, + "params": { + "addLegend": true, + "shareYAxis": true, + "addTooltip": true, + "smoothLines": false, + "scale": "linear", + "interpolate": "linear", + "times": [], + "addTimeMarker": false, + "defaultYExtents": false, + "setYExtents": false, + "yAxis": {}, + "mode": "stacked" + }, + "aggs": [ + {% for agg in aggs %} + { + "id": {{agg.id }}, + "type": "avg", + "schema": "metric", + "params": { + "field": "{{agg.field}}" + } + }, + {% endfor %} + { + "id": {{ aggs|length + 1 }}, + "type": "date_histogram", + "schema": "segment", + "params": { + "field": "start_date", + "interval": "auto", + "customInterval": "2h", + "min_doc_count": 1, + "extended_bounds": {} + } + } + ] +} diff --git a/utils/test/dashboard/dashboard/elastic2kibana/templates/tests_failures.json b/utils/test/dashboard/dashboard/elastic2kibana/templates/tests_failures.json new file mode 100644 index 000000000..01f9ba89e --- /dev/null +++ b/utils/test/dashboard/dashboard/elastic2kibana/templates/tests_failures.json @@ -0,0 +1,45 @@ +{% set aggs = aggs|default([]) -%} + +{ + "title": "tests_failures", + "type": "histogram", + "listeners": {}, + "params": { + "addLegend": true, + "shareYAxis": true, + "addTooltip": true, + "smoothLines": false, + "scale": "linear", + "interpolate": "linear", + "times": [], + "addTimeMarker": false, + "defaultYExtents": false, + "setYExtents": false, + "yAxis": {}, + "mode": "grouped" + }, + "aggs": [ + {% for agg in aggs %} + { + "id": {{agg.id }}, + "type": "sum", + "schema": "metric", + "params": { + "field": "{{agg.field}}" + } + }, + {% endfor %} + { + "id": {{ aggs|length + 1 }}, + "type": "date_histogram", + "schema": "segment", + "params": { + "field": "start_date", + "interval": "auto", + "customInterval": "2h", + "min_doc_count": 1, + "extended_bounds": {} + } + } + ] +} |