Update flake8 to verify patch scripts
To prevent the warning about a newer version of pip available, the following env setting was added PIP_DISABLE_PIP_VERSION_CHECK=1 To prevent sub-calls to tox from using the default pip cache location, rather than whatever a user may override using xdg env variables, the following has been added: passenv = XDG_CACHE_HOME The python patch scripts are now validated by flake8. All flake8 tox targets are triggered from a single zuul job. Story: 2004515 Task: 38581 Change-Id: I105512edbd3da15480355e30c0dd14933584a47b Signed-off-by: albailey <Al.Bailey@windriver.com>
This commit is contained in:
parent
da4662673c
commit
e3be9a2776
23
.zuul.yaml
23
.zuul.yaml
|
@ -8,11 +8,10 @@
|
||||||
jobs:
|
jobs:
|
||||||
- openstack-tox-linters
|
- openstack-tox-linters
|
||||||
- py3-bandit
|
- py3-bandit
|
||||||
- patch-tox-flake8
|
- py3-flake8
|
||||||
- patch-tox-pylint
|
- patch-tox-pylint
|
||||||
- patch-tox-py27
|
- patch-tox-py27
|
||||||
- patch-tox-py36
|
- patch-tox-py36
|
||||||
- patch-alarm-tox-flake8
|
|
||||||
- patch-alarm-tox-pylint
|
- patch-alarm-tox-pylint
|
||||||
- patch-alarm-tox-py27
|
- patch-alarm-tox-py27
|
||||||
- patch-alarm-tox-py36
|
- patch-alarm-tox-py36
|
||||||
|
@ -20,11 +19,10 @@
|
||||||
jobs:
|
jobs:
|
||||||
- openstack-tox-linters
|
- openstack-tox-linters
|
||||||
- py3-bandit
|
- py3-bandit
|
||||||
- patch-tox-flake8
|
- py3-flake8
|
||||||
- patch-tox-pylint
|
- patch-tox-pylint
|
||||||
- patch-tox-py27
|
- patch-tox-py27
|
||||||
- patch-tox-py36
|
- patch-tox-py36
|
||||||
- patch-alarm-tox-flake8
|
|
||||||
- patch-alarm-tox-pylint
|
- patch-alarm-tox-pylint
|
||||||
- patch-alarm-tox-py27
|
- patch-alarm-tox-py27
|
||||||
- patch-alarm-tox-py36
|
- patch-alarm-tox-py36
|
||||||
|
@ -36,16 +34,13 @@
|
||||||
tox_envlist: bandit
|
tox_envlist: bandit
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: patch-tox-flake8
|
name: py3-flake8
|
||||||
parent: tox
|
parent: tox
|
||||||
required-projects:
|
required-projects:
|
||||||
- starlingx/config
|
- starlingx/config
|
||||||
- starlingx/fault
|
- starlingx/fault
|
||||||
files:
|
|
||||||
- cgcs-patch/cgcs-patch/*
|
|
||||||
vars:
|
vars:
|
||||||
tox_envlist: flake8
|
tox_envlist: flake8
|
||||||
tox_extra_args: -c cgcs-patch/cgcs-patch/tox.ini
|
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: patch-tox-pylint
|
name: patch-tox-pylint
|
||||||
|
@ -83,18 +78,6 @@
|
||||||
tox_envlist: py36
|
tox_envlist: py36
|
||||||
tox_extra_args: -c cgcs-patch/cgcs-patch/tox.ini
|
tox_extra_args: -c cgcs-patch/cgcs-patch/tox.ini
|
||||||
|
|
||||||
- job:
|
|
||||||
name: patch-alarm-tox-flake8
|
|
||||||
parent: tox
|
|
||||||
required-projects:
|
|
||||||
- starlingx/config
|
|
||||||
- starlingx/fault
|
|
||||||
files:
|
|
||||||
- patch-alarm/patch-alarm/*
|
|
||||||
vars:
|
|
||||||
tox_envlist: flake8
|
|
||||||
tox_extra_args: -c patch-alarm/patch-alarm/tox.ini
|
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: patch-alarm-tox-pylint
|
name: patch-alarm-tox-pylint
|
||||||
parent: tox
|
parent: tox
|
||||||
|
|
|
@ -23,8 +23,12 @@ setenv = VIRTUAL_ENV={envdir}
|
||||||
PYTHONDONTWRITEBYTECODE=1
|
PYTHONDONTWRITEBYTECODE=1
|
||||||
PYTHONHASHSEED=0
|
PYTHONHASHSEED=0
|
||||||
PYTHONWARNINGS=default::DeprecationWarning
|
PYTHONWARNINGS=default::DeprecationWarning
|
||||||
|
PIP_DISABLE_PIP_VERSION_CHECK=1
|
||||||
|
|
||||||
sitepackages = True
|
passenv =
|
||||||
|
XDG_CACHE_HOME
|
||||||
|
|
||||||
|
sitepackages = False
|
||||||
install_command = pip install \
|
install_command = pip install \
|
||||||
-v -v -v \
|
-v -v -v \
|
||||||
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \
|
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \
|
||||||
|
|
|
@ -23,8 +23,12 @@ setenv = VIRTUAL_ENV={envdir}
|
||||||
PYTHONDONTWRITEBYTECODE=1
|
PYTHONDONTWRITEBYTECODE=1
|
||||||
PYTHONHASHSEED=0
|
PYTHONHASHSEED=0
|
||||||
PYTHONWARNINGS=default::DeprecationWarning
|
PYTHONWARNINGS=default::DeprecationWarning
|
||||||
|
PIP_DISABLE_PIP_VERSION_CHECK=1
|
||||||
|
|
||||||
sitepackages = True
|
passenv =
|
||||||
|
XDG_CACHE_HOME
|
||||||
|
|
||||||
|
sitepackages = False
|
||||||
install_command = pip install \
|
install_command = pip install \
|
||||||
-v -v -v \
|
-v -v -v \
|
||||||
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \
|
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \
|
||||||
|
|
|
@ -6,7 +6,8 @@ SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from kubernetes import client, config
|
from kubernetes import client
|
||||||
|
from kubernetes import config
|
||||||
|
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
|
@ -37,19 +38,19 @@ def get_kube_apiserver_versions():
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
running_versions = get_kube_apiserver_versions()
|
running_versions = get_kube_apiserver_versions()
|
||||||
if len(running_versions) is 0:
|
if len(running_versions) == 0:
|
||||||
fatal_error("Could not determine kube-apiserver version")
|
fatal_error("Could not determine kube-apiserver version")
|
||||||
|
|
||||||
# Running version must be at least v1.16.1
|
# Running version must be at least v1.16.1
|
||||||
test_version = 'v1.16.1'
|
test_version = 'v1.16.1'
|
||||||
for running_version in running_versions:
|
for running_version in running_versions:
|
||||||
if LooseVersion(running_version) < LooseVersion(test_version):
|
if LooseVersion(running_version) < LooseVersion(test_version):
|
||||||
fatal_error("A kube-apiserver is running %s, but must be at least %s" %
|
fatal_error("A kube-apiserver is running %s, but must be"
|
||||||
(running_version, test_version))
|
" at least %s" % (running_version, test_version))
|
||||||
|
|
||||||
# Success
|
# Success
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,8 @@ SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from kubernetes import client, config
|
from kubernetes import client
|
||||||
|
from kubernetes import config
|
||||||
|
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
|
@ -37,20 +38,19 @@ def get_kube_apiserver_versions():
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
running_versions = get_kube_apiserver_versions()
|
running_versions = get_kube_apiserver_versions()
|
||||||
if len(running_versions) is 0:
|
if len(running_versions) == 0:
|
||||||
fatal_error("Could not determine kube-apiserver version")
|
fatal_error("Could not determine kube-apiserver version")
|
||||||
|
|
||||||
# Running version must be no higher than v1.16.1
|
# Running version must be no higher than v1.16.1
|
||||||
test_version = 'v1.16.1'
|
test_version = 'v1.16.1'
|
||||||
for running_version in running_versions:
|
for running_version in running_versions:
|
||||||
if LooseVersion(running_version) > LooseVersion(test_version):
|
if LooseVersion(running_version) > LooseVersion(test_version):
|
||||||
fatal_error("A kube-apiserver is running %s, but must be no higher than %s" %
|
fatal_error("A kube-apiserver is running %s, but must be no higher"
|
||||||
(running_version, test_version))
|
" than %s" % (running_version, test_version))
|
||||||
|
|
||||||
# Success
|
# Success
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,8 @@ SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from kubernetes import client, config
|
from kubernetes import client
|
||||||
|
from kubernetes import config
|
||||||
|
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
|
@ -37,20 +38,19 @@ def get_kube_apiserver_versions():
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
running_versions = get_kube_apiserver_versions()
|
running_versions = get_kube_apiserver_versions()
|
||||||
if len(running_versions) is 0:
|
if len(running_versions) == 0:
|
||||||
fatal_error("Could not determine kube-apiserver version")
|
fatal_error("Could not determine kube-apiserver version")
|
||||||
|
|
||||||
# Running version must be at least v1.16.2
|
# Running version must be at least v1.16.2
|
||||||
test_version = 'v1.16.2'
|
test_version = 'v1.16.2'
|
||||||
for running_version in running_versions:
|
for running_version in running_versions:
|
||||||
if LooseVersion(running_version) < LooseVersion(test_version):
|
if LooseVersion(running_version) < LooseVersion(test_version):
|
||||||
fatal_error("A kube-apiserver is running %s, but must be at least %s" %
|
fatal_error("A kube-apiserver is running %s, but must be"
|
||||||
(running_version, test_version))
|
" at least %s" % (running_version, test_version))
|
||||||
|
|
||||||
# Success
|
# Success
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,8 @@ SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from kubernetes import client, config
|
from kubernetes import client
|
||||||
|
from kubernetes import config
|
||||||
|
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
|
@ -37,21 +38,19 @@ def get_kube_apiserver_versions():
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
running_versions = get_kube_apiserver_versions()
|
running_versions = get_kube_apiserver_versions()
|
||||||
if len(running_versions) is 0:
|
if len(running_versions) == 0:
|
||||||
fatal_error("Could not determine kube-apiserver version")
|
fatal_error("Could not determine kube-apiserver version")
|
||||||
|
|
||||||
# Running version must be no higher than v1.16.2
|
# Running version must be no higher than v1.16.2
|
||||||
test_version = 'v1.16.2'
|
test_version = 'v1.16.2'
|
||||||
for running_version in running_versions:
|
for running_version in running_versions:
|
||||||
if LooseVersion(running_version) > LooseVersion(test_version):
|
if LooseVersion(running_version) > LooseVersion(test_version):
|
||||||
fatal_error("A kube-apiserver is running %s, but must be no higher than %s" %
|
fatal_error("A kube-apiserver is running %s, but must be"
|
||||||
(running_version, test_version))
|
" no higher than %s" % (running_version, test_version))
|
||||||
|
|
||||||
# Success
|
# Success
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
hacking>=2.0<2.1
|
||||||
|
|
||||||
|
pycodestyle>=2.0.0 # MIT License
|
||||||
|
mock>=2.0.0 # BSD
|
||||||
bashate >= 0.2
|
bashate >= 0.2
|
||||||
PyYAML >= 3.1.0
|
PyYAML >= 3.1.0
|
||||||
yamllint >= 0.5.2
|
yamllint >= 0.5.2
|
||||||
hacking!=0.13.0,<0.14,>=0.12.0
|
|
||||||
# The following are for py27 and py36
|
|
||||||
#mock # BSD
|
|
||||||
#nose # LGPL
|
|
||||||
|
|
34
tox.ini
34
tox.ini
|
@ -14,28 +14,40 @@ minversion = 2.3
|
||||||
skipsdist = True
|
skipsdist = True
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
install_command = pip install -U {opts} {packages}
|
|
||||||
setenv = VIRTUAL_ENV={envdir}
|
|
||||||
OS_STDOUT_CAPTURE=1
|
|
||||||
OS_STDERR_CAPTURE=1
|
|
||||||
OS_TEST_TIMEOUT=60
|
|
||||||
PYTHONDONTWRITEBYTECODE=True
|
|
||||||
cgcs_patch_dir = {toxinidir}/cgcs-patch/cgcs-patch
|
cgcs_patch_dir = {toxinidir}/cgcs-patch/cgcs-patch
|
||||||
cgcs_patch_src_dir = {[testenv]cgcs_patch_dir}/cgcs_patch
|
cgcs_patch_src_dir = {[testenv]cgcs_patch_dir}/cgcs_patch
|
||||||
patch_alarm_dir = {toxinidir}/patch-alarm/patch-alarm
|
patch_alarm_dir = {toxinidir}/patch-alarm/patch-alarm
|
||||||
patch_alarm_src_dir = {[testenv]patch_alarm_dir}/patch_alarm
|
patch_alarm_src_dir = {[testenv]patch_alarm_dir}/patch_alarm
|
||||||
|
|
||||||
|
setenv =
|
||||||
|
VIRTUAL_ENV={envdir}
|
||||||
|
OS_STDOUT_CAPTURE=1
|
||||||
|
OS_STDERR_CAPTURE=1
|
||||||
|
OS_TEST_TIMEOUT=60
|
||||||
|
PYTHONDONTWRITEBYTECODE=True
|
||||||
|
PIP_DISABLE_PIP_VERSION_CHECK=1
|
||||||
|
|
||||||
|
passenv =
|
||||||
|
XDG_CACHE_HOME
|
||||||
|
|
||||||
commands = find {toxinidir} -type f -not -path '{toxinidir}/.tox/*' -not -path '*/__pycache__/*' -name '*.py[c|o]' -delete
|
commands = find {toxinidir} -type f -not -path '{toxinidir}/.tox/*' -not -path '*/__pycache__/*' -name '*.py[c|o]' -delete
|
||||||
|
|
||||||
|
install_command = pip install -U \
|
||||||
|
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \
|
||||||
|
{opts} {packages}
|
||||||
|
|
||||||
deps = -r{toxinidir}/requirements.txt
|
deps = -r{toxinidir}/requirements.txt
|
||||||
-r{toxinidir}/test-requirements.txt
|
-r{toxinidir}/test-requirements.txt
|
||||||
-e{[testenv]cgcs_patch_dir}
|
-e{[testenv]cgcs_patch_dir}
|
||||||
-e{[testenv]patch_alarm_dir}
|
-e{[testenv]patch_alarm_dir}
|
||||||
|
|
||||||
whitelist_externals = find
|
whitelist_externals = find
|
||||||
|
|
||||||
[testenv:linters]
|
[testenv:linters]
|
||||||
basepython = python3
|
basepython = python3
|
||||||
whitelist_externals = bash
|
whitelist_externals = bash
|
||||||
commands =
|
commands =
|
||||||
bash -c "find {toxinidir} \
|
bash -c "find {toxinidir} \
|
||||||
-not \( -type d -name .?\* -prune \) \
|
-not \( -type d -name .?\* -prune \) \
|
||||||
-type f \
|
-type f \
|
||||||
-not -name \*~ \
|
-not -name \*~ \
|
||||||
|
@ -46,12 +58,17 @@ commands =
|
||||||
-wholename \*/devstack/\* \
|
-wholename \*/devstack/\* \
|
||||||
\) \
|
\) \
|
||||||
-print0 | xargs -0 bashate -v -e 'E*' -iE006"
|
-print0 | xargs -0 bashate -v -e 'E*' -iE006"
|
||||||
bash -c "find {toxinidir} \
|
bash -c "find {toxinidir} \
|
||||||
\( -name .tox -prune \) \
|
\( -name .tox -prune \) \
|
||||||
-o -type f -name '*.yaml' \
|
-o -type f -name '*.yaml' \
|
||||||
-print0 | xargs -0 yamllint"
|
-print0 | xargs -0 yamllint"
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
|
filename=
|
||||||
|
*.preapply
|
||||||
|
*.preremove
|
||||||
|
|
||||||
|
[testenv:flake8]
|
||||||
basepython = python3
|
basepython = python3
|
||||||
whitelist_externals = cp
|
whitelist_externals = cp
|
||||||
find
|
find
|
||||||
|
@ -60,6 +77,7 @@ recreate = True
|
||||||
commands = {[testenv]commands}
|
commands = {[testenv]commands}
|
||||||
tox -c cgcs-patch/cgcs-patch -e flake8
|
tox -c cgcs-patch/cgcs-patch -e flake8
|
||||||
tox -c patch-alarm/patch-alarm -e flake8
|
tox -c patch-alarm/patch-alarm -e flake8
|
||||||
|
flake8 {toxinidir}/patch-scripts/kube-upgrade
|
||||||
|
|
||||||
[testenv:venv]
|
[testenv:venv]
|
||||||
basepython = python3
|
basepython = python3
|
||||||
|
|
Loading…
Reference in New Issue