Adds a Bashate target to tox.ini.

This will now run bashate on all shell scripts. We could ignore the
following list of bashate errors:

- E006: Line longer than 79 columns (as many scripts use jinja
        templating, this is very difficult)
- E040: Syntax error determined using `bash -n` (as many scripts
        use jinja templating, this will often fail and the syntax
        error will be discovered in execution anyway)

Change-Id: I6f6d454ac54a0ac98d8b8a092fa522cba092a592
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This commit is contained in:
Gael Chamoulaud 2017-02-06 15:01:25 +01:00
parent 619c512594
commit 5533b8f7a1
12 changed files with 57 additions and 34 deletions

View File

@ -11,8 +11,7 @@ BUILD_RESULT=$?
UNCOMMITTED_NOTES=$(git status --porcelain | \
awk '$1 == "M" && $2 ~ /releasenotes\/notes/ {print $2}')
if [ "${UNCOMMITTED_NOTES}" ]
then
if [ "${UNCOMMITTED_NOTES}" ]; then
cat <<EOF
REMINDER: The following changes to release notes have not been committed:

View File

@ -28,7 +28,10 @@ openstack overcloud image upload {% if bash_deploy_ramdisk %}--old-deploy-image{
## * Upload images to glance, this step is specific to nodepool based deployments.
## ::
glance image-create --container-format bare --disk-format qcow2 --name overcloud-full --file overcloud-full.qcow2
glance image-create --container-format bare \
--disk-format qcow2 \
--name overcloud-full \
--file overcloud-full.qcow2
{% endif %}

View File

@ -10,12 +10,16 @@ CONTROLLER0=$(nova list | grep controller-0 | awk '{print $12}' | cut -f2 -d=)
{% if release == 'newton' or release == 'mitaka' %}
# Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1348222
for CONTROLLER in $CONTROLLERS; do $SSH heat-admin@$CONTROLLER sudo pip install redis; done
for CONTROLLER in $CONTROLLERS; do
$SSH heat-admin@$CONTROLLER sudo pip install redis;
done
{% endif %}
{% if release == 'mitaka' %}
# Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1357229
for CONTROLLER in $CONTROLLERS; do $SSH heat-admin@$CONTROLLER "sudo sed -i -e 's/^After=.*/After=syslog.target network.target/g' /usr/lib/systemd/system/openstack-heat-engine.service"; done
for CONTROLLER in $CONTROLLERS; do
$SSH heat-admin@$CONTROLLER "sudo sed -i -e 's/^After=.*/After=syslog.target network.target/g' /usr/lib/systemd/system/openstack-heat-engine.service";
done
{% endif %}
{% if release == 'newton' or release == 'mitaka' %}

View File

@ -12,7 +12,7 @@ set -eux
## * Create cleanup env function for heat
## ::
function cleanup() {
function cleanup {
{% if release in ['kilo', 'liberty', 'rhos-7'] %}
heat stack-delete {{ validate_stack_name }}
{% else %}

View File

@ -1,5 +1,6 @@
hacking<0.11,>=0.10
bashate>=0.2 # Apache-2.0
ansible-lint
sphinx!=1.3b1,<1.4,>=1.2.1 # BSD
oslosphinx>=4.7.0 # Apache-2.0

16
tox.ini
View File

@ -21,6 +21,21 @@ commands = bindep test
[testenv:docs]
commands = python setup.py build_sphinx
[testenv:bashate]
commands =
# Run bashate check for all bash scripts
# Ignores the following rules:
# E006: Line longer than 79 columns (as many scripts use jinja
# templating, this is very difficult)
# E040: Syntax error determined using `bash -n` (as many scripts
# use jinja templating, this will often fail and the syntax
# error will be discovered in execution anyway)
bash -c "grep --recursive --binary-files=without-match \
--files-with-match '^.!.*\(ba\)\?sh$' \
--exclude-dir .tox \
--exclude-dir .git \
{toxinidir} | xargs bashate --error . --verbose --ignore=E006,E040"
[testenv:pep8]
commands =
# Run hacking/flake8 check for all python files
@ -46,6 +61,7 @@ commands = bash -c ci-scripts/releasenotes_tox.sh
[testenv:linters]
commands =
{[testenv:bashate]commands}
{[testenv:pep8]commands}
{[testenv:ansible-lint]commands}