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: Iab37a8090515936732e390b1f7c6d281e014e31c
This commit is contained in:
Gage Hugo 2018-08-21 14:06:48 -05:00
parent 7c98b5c4cb
commit ad7e855cf8
5 changed files with 13 additions and 77 deletions

View File

@ -13,19 +13,17 @@
- project:
check:
jobs:
- openstack-tox-pep8
- airship-pegleg-linter
- airship-pegleg-doc-build
- airship-pegleg-lint-pep8
- airship-pegleg-unit-py35
- airship-pegleg-security-bandit
- airship-pegleg-docker-build-gate
gate:
jobs:
- openstack-tox-pep8
- airship-pegleg-linter
- airship-pegleg-doc-build
- airship-pegleg-lint-pep8
- airship-pegleg-unit-py35
- airship-pegleg-security-bandit
- airship-pegleg-docker-build-gate
post:
jobs:
@ -44,20 +42,6 @@
run: tools/gate/playbooks/zuul-linter.yaml
nodeset: airship-pegleg-single-node
- job:
name: airship-pegleg-lint-pep8
description: |
Lints Python files against the PEP8 standard
run: tools/gate/playbooks/pep8-linter.yaml
timeout: 300
nodeset: airship-pegleg-single-node
irrelevant-files:
- ^.*\.rst$
- ^doc/.*$
- ^etc/.*$
- ^releasenotes/.*$
- ^setup.cfg$
- job:
name: airship-pegleg-unit-py35
description: |
@ -72,20 +56,6 @@
- ^releasenotes/.*$
- ^setup.cfg$
- job:
name: airship-pegleg-security-bandit
description: |
Executes the Bandit security scanner against Python files
run: tools/gate/playbooks/security-bandit.yaml
timeout: 300
nodeset: airship-pegleg-single-node
irrelevant-files:
- ^.*\.rst$
- ^doc/.*$
- ^etc/.*$
- ^releasenotes/.*$
- ^setup.cfg$
- job:
name: airship-pegleg-doc-build
description: |

View File

@ -3,8 +3,11 @@ pytest==3.2.1
pytest-cov==2.5.1
mock==2.0.0
# Formatting
yapf==0.20.0
# Linting
flake8==3.3.0
# Security
bandit==1.4.0
bandit>=1.5.0

View File

@ -15,19 +15,22 @@ commands =
{posargs}
[testenv:fmt]
deps = yapf==0.20.0
basepython=python3
deps =
-r{toxinidir}/test-requirements.txt
commands =
yapf --style=pep8 -ir {toxinidir}/pegleg {toxinidir}/tests
[testenv:pep8]
basepython=python3
deps =
yapf==0.20.0
flake8==3.5.0
-r{toxinidir}/test-requirements.txt
commands =
yapf -rd {toxinidir}/pegleg {toxinidir}/tests
flake8 {toxinidir}/pegleg
bandit -r pegleg -n 5
[testenv:bandit]
basepython=python3
commands = bandit -r pegleg -n 5
[flake8]

View File

@ -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: py_lint
register: result
failed_when: result.failed

View File

@ -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: security
register: result
failed_when: result.failed