Enable bandit for utitilies

Story: 2008929
Task: 42530

Change-Id: Id63488414ae16b384549fcf8cbd9805b5b1a81ad
Signed-off-by: Chen, Haochuan Z <haochuan.z.chen@intel.com>
This commit is contained in:
Chen, Haochuan Z 2021-05-27 07:46:09 +08:00
parent 931887828b
commit 317b9bf435
6 changed files with 63 additions and 2 deletions

View File

@ -4,10 +4,14 @@
jobs:
- openstack-tox-linters
- stx-tox-pylint
- utilities-ceph-manager-tox-bandit
- utilities-ceph-client-tox-bandit
gate:
jobs:
- openstack-tox-linters
- stx-tox-pylint
- utilities-ceph-manager-tox-bandit
- utilities-ceph-client-tox-bandit
post:
jobs:
- stx-utilities-upload-git-mirror
@ -35,6 +39,30 @@
secret: stx-utilities-github-secret
pass-to-parent: true
- job:
name: utilities-ceph-manager-tox-bandit
parent: tox
description: |
Run bandit test for utilities ceph-mananger
nodeset: ubuntu-bionic
files:
- ./ceph/ceph-manager/ceph-manager/*
vars:
tox_envlist: bandit
tox_extra_args: -c ./ceph/ceph-manager/ceph-manager/tox.ini
- job:
name: utilities-ceph-client-tox-bandit
parent: tox
description: |
Run bandit test for utilities python-cephclient
nodeset: ubuntu-bionic
files:
- ./ceph/python-cephclient/python-cephclient/*
vars:
tox_envlist: bandit
tox_extra_args: -c ./ceph/python-cephclient/python-cephclient/tox.ini
- secret:
name: stx-utilities-github-secret
data:

View File

@ -2,9 +2,10 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
bandit;python_version>="3.0"
mock
flake8
eventlet
pytest
oslo.log
oslo.i18n
oslo.i18n

View File

@ -22,3 +22,18 @@ commands =
[flake8]
exclude = .venv,.git,.tox,dist,doc,etc,*glance/locale*,*lib/python*,*egg,build
[bandit]
# The following bandit tests are being skipped:
# H104 file contains only comments (ie: license)
# B110: Try, Except, Pass detected.
#
# Note: 'skips' entry cannot be split across multiple lines
#
skips = B104,B110
exclude = tests
[testenv:bandit]
basepython = python3
deps = -r{toxinidir}/test-requirements.txt
commands = bandit --ini tox.ini -n 5 -r ceph_manager

View File

@ -2,5 +2,10 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
bandit;python_version>="3.0"
mock
flake8
eventlet
pytest
oslo.log
oslo.i18n

View File

@ -1,7 +1,7 @@
[tox]
envlist = py27,pep8
skipsdist = True
toxworkdir = /tmp/{env:USER}_ceph_manager_tox
toxworkdir = /tmp/{env:USER}_python_cephclient_tox
[testenv]
setenv = VIRTUAL_ENV={envdir}
@ -17,3 +17,11 @@ commands =
[flake8]
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build
[bandit]
exclude = tests
[testenv:bandit]
basepython = python3
deps = -r{toxinidir}/test-requirements.txt
commands = bandit --ini tox.ini -n 5 -r cephclient

View File

@ -98,3 +98,7 @@ commands = pylint {posargs} \
commands =
{[testenv:bashate]commands}
{[testenv:flake8]commands}
[testenv:bandit]
basepython = python3
description = Dummy environment to allow bandit to be run in subdir tox