From 9ed42604d070495d9f7fd158daa5cfcd4cc7b31c Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Thu, 7 Jan 2016 15:24:30 -0800 Subject: [PATCH] Validate grafyaml based on master Rather than installing grafyaml from pypi, install it with zuul-cloner so that it may be validated with the contents of master (or even changes in review). We run grafyaml continuously deployed from source rather than installing from pypi, so this more closely matches what we actually want to validate. Change-Id: I26663e5c70883b910fced6c32ae364734542b5a5 --- test-requirements.txt | 1 - tools/grafyaml-validate.sh | 49 ++++++++++++++++++++++++++++++++++++++ tox.ini | 2 +- 3 files changed, 50 insertions(+), 2 deletions(-) create mode 100755 tools/grafyaml-validate.sh diff --git a/test-requirements.txt b/test-requirements.txt index cc3e88fb3c..d1f248880a 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,4 +1,3 @@ hacking>=0.10,<0.11 bashate>=0.2 -grafyaml -e git://git.openstack.org/openstack-infra/nodepool#egg=nodepool diff --git a/tools/grafyaml-validate.sh b/tools/grafyaml-validate.sh new file mode 100755 index 0000000000..5d1564c0b0 --- /dev/null +++ b/tools/grafyaml-validate.sh @@ -0,0 +1,49 @@ +#!/bin/bash -e + +# Copyright 2016 IBM Corp. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +ROOT=`pwd` +if [ -z $VIRTUAL_ENV ]; then + echo "VIRTUAL_ENV environment variable not found" + echo "Run this script with 'tox -e grafyaml' and with recent versions" + echo "of tox and virtualenv installed." + exit 1 +fi + +cd $VIRTUAL_ENV +if [ ! -e /usr/zuul-env/bin/zuul-cloner ] && + [ ! -e $VIRTUAL_ENV/bin/zuul-cloner ]; +then + echo "Need to install zuul-cloner" + git clone https://git.openstack.org/openstack-infra/zuul + cd zuul + pip install . + cd .. +fi + +if [ -e /usr/zuul-env/bin/zuul-cloner ]; then + ZC=/usr/zuul-env/bin/zuul-cloner +else + ZC=$VIRTUAL_ENV/bin/zuul-cloner +fi +echo "Zuul-cloner is $ZC" + +$ZC --cache-dir /opt/git https://git.openstack.org openstack-infra/grafyaml +cd openstack-infra/grafyaml +pip install . +cd ../.. + +cd $ROOT +grafana-dashboard validate grafana diff --git a/tox.ini b/tox.ini index 8a05920354..0b4456a8d0 100644 --- a/tox.ini +++ b/tox.ini @@ -46,7 +46,7 @@ select = H231 [testenv:grafyaml] basepython = python2.7 -commands = grafana-dashboard validate grafana +commands = {toxinidir}/tools/grafyaml-validate.sh [testenv:jjb] basepython = python2.7