Use tox for grafyaml validation

Currently this calls out to grafyaml-validate.sh which tries to
install zuul-cloner and then pull grafyaml from that.

Since zuulv3 doesn't *have* zuul-cloner, this means the job is broken
for local testing.  It works in the gate only because zuul-cloner
compatability shims are installed.

To maintain the testing-against-master behaviour, the dependent change
provides the grafyaml source in the environment; otherwise we go to
git directly.

Depends-On: https://review.openstack.org/572251
Change-Id: I3d5cd062414b77aaa70d2669730fda870ca0168e
This commit is contained in:
Ian Wienand 2018-06-05 13:21:04 +10:00
parent ecc74d2dcb
commit ee2efa10e1
2 changed files with 3 additions and 50 deletions

View File

@ -1,49 +0,0 @@
#!/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

View File

@ -73,8 +73,10 @@ exclude = .tox,.test
ignore = E125,E129,E402,H,W503
[testenv:grafyaml]
deps =
{env:GRAFYAML_SRC:git+git://git.openstack.org/openstack-infra/grafyaml#egg=grafyaml}
basepython = python2.7
commands = {toxinidir}/tools/grafyaml-validate.sh
commands = grafana-dashboard validate grafana
[testenv:bindep]
# Do not install any requirements. We want this to be fast and work even if