From f60f6d7a8569c5006d32c44c27f4584f10ffe57a Mon Sep 17 00:00:00 2001 From: Gage Hugo Date: Tue, 21 Aug 2018 11:01:26 -0500 Subject: [PATCH] Consolidate pep8/bandit zuul gating This change adds the global zuul pep8 tox job, which runs both bandit and pep8 using tox. This also removes the two other airship specific lint-pep8 and bandit zuul jobs since they are both covered by the default openstack global one. Also cleaned up the tox.ini by moving the requirements into the test-requirements.txt file. Change-Id: Iccf6228ab9e6d621d3047994b3adc192d67273c9 --- .zuul.yaml | 26 ++--------------------- requirements-frozen.txt | 1 - test-requirements.txt | 5 +++++ tools/zuul/playbooks/pep8-linter.yaml | 20 ----------------- tools/zuul/playbooks/security-bandit.yaml | 20 ----------------- tox.ini | 14 ++++++------ 6 files changed, 13 insertions(+), 73 deletions(-) delete mode 100644 tools/zuul/playbooks/pep8-linter.yaml delete mode 100644 tools/zuul/playbooks/security-bandit.yaml diff --git a/.zuul.yaml b/.zuul.yaml index 7170d8e3..791d5e0d 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -13,23 +13,21 @@ - project: check: jobs: + - openstack-tox-pep8 - airship-promenade-lint-ws - airship-promenade-docker-build-gate - airship-promenade-doc-build - - airship-promenade-lint-pep8 - airship-promenade-lint-chart - airship-promenade-unit-py35 - - airship-promenade-security-bandit gate: jobs: + - openstack-tox-pep8 - airship-promenade-lint-ws - airship-promenade-docker-build-gate - airship-promenade-doc-build - - airship-promenade-lint-pep8 - airship-promenade-lint-chart - airship-promenade-unit-py35 - - airship-promenade-security-bandit post: jobs: @@ -49,16 +47,6 @@ timeout: 300 nodeset: airship-promenade-single-node -- job: - name: airship-promenade-lint-pep8 - description: | - Lints Python files against the PEP8 standard - run: tools/zuul/playbooks/pep8-linter.yaml - timeout: 300 - nodeset: airship-promenade-single-node - files: - - ^.*\.py$ - - job: name: airship-promenade-lint-chart description: | @@ -79,16 +67,6 @@ files: - ^.*\.py$ -- job: - name: airship-promenade-security-bandit - description: | - Executes the Bandit security scanner against Python files - run: tools/zuul/playbooks/security-bandit.yaml - timeout: 300 - nodeset: airship-promenade-single-node - files: - - ^.*\.py$ - - job: name: airship-promenade-doc-build description: | diff --git a/requirements-frozen.txt b/requirements-frozen.txt index aa52e367..27a1e17b 100644 --- a/requirements-frozen.txt +++ b/requirements-frozen.txt @@ -19,7 +19,6 @@ extras==1.0.0 falcon==1.2.0 fasteners==0.14.1 fixtures==3.0.0 -flake8==2.6.2 futurist==1.7.0 google-auth==1.5.0 greenlet==0.4.13 diff --git a/test-requirements.txt b/test-requirements.txt index e079f8a6..c10567bf 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1 +1,6 @@ pytest +flake8>=3.3.0 +bandit>=1.5 +yapf +sphinx>=1.6.2 +sphinx_rtd_theme==0.2.4 diff --git a/tools/zuul/playbooks/pep8-linter.yaml b/tools/zuul/playbooks/pep8-linter.yaml deleted file mode 100644 index 93de5945..00000000 --- a/tools/zuul/playbooks/pep8-linter.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# 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. - -- hosts: primary - tasks: - - name: Execute the make target for PEP8 linting - make: - chdir: "{{ zuul.project.src_dir }}" - target: tests-pep8 - register: result - failed_when: result.failed diff --git a/tools/zuul/playbooks/security-bandit.yaml b/tools/zuul/playbooks/security-bandit.yaml deleted file mode 100644 index 7f26370d..00000000 --- a/tools/zuul/playbooks/security-bandit.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# 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. - -- hosts: primary - tasks: - - name: Execute the make target for security scanning - make: - chdir: "{{ zuul.project.src_dir }}" - target: tests-security - register: result - failed_when: result.failed diff --git a/tox.ini b/tox.ini index 86ae66f8..00c8d19e 100644 --- a/tox.ini +++ b/tox.ini @@ -22,23 +22,22 @@ commands = pytest {posargs} [testenv:bandit] -deps = bandit==1.4.0 +deps = + -r{toxinidir}/test-requirements.txt commands = bandit -r promenade [testenv:docs] whitelist_externals = rm deps = - sphinx>=1.6.2 - sphinx_rtd_theme==0.2.4 - -r{toxinidir}/requirements-frozen.txt -r{toxinidir}/test-requirements.txt commands = rm -rf doc/build sphinx-build -b html doc/source doc/build [testenv:fmt] -deps = yapf==0.20.0 +deps = + -r{toxinidir}/test-requirements.txt commands = yapf -ir {toxinidir}/promenade {toxinidir}/tests {toxinidir}/tools/image_tags.py @@ -59,8 +58,7 @@ commands = [testenv:pep8] deps = - yapf==0.20.0 - flake8==3.5.0 + -r{toxinidir}/test-requirements.txt commands = - yapf -rd {toxinidir}/promenade {toxinidir}/tests {toxinidir}/tools/image_tags.py flake8 {toxinidir}/promenade + bandit -r promenade