Tox and Zuul job for the bandit code scan in starlingx/metal

Setting up the bandit tool for the scanning of HIGH severity issues
in the python codes under Starlingx/metal folder.
Expecting this merge will enable zuul job for CI/CD of bandit scan.

Configuration files:
1. tox.ini for adding bandit environment and command.
2. test-requirements.txt for adding bandit version.
3. .zuul.yaml file for adding bandit job and configuring under
   check job to run code scan every time before code commit.

Test:
Run tox -e bandit command inside the fault folder to validate the
bandit scan and result.

Please note:
Changes will be implemented in batches and  this is Batch4 change.

Story: 2007541
Task: 39622
Depends-On: https://review.opendev.org/#/c/721294/

Change-Id: I7b91a51e0e411b46670f84c2b2a6c7749f9d0521
Signed-off-by: Sharath Kumar K <sharath.kumar@intel.com>
This commit is contained in:
Sharath Kumar K 2020-05-04 16:47:45 +02:00
parent f8c508ca06
commit ec62232936
3 changed files with 8 additions and 0 deletions

View File

@ -4,6 +4,7 @@
- stx-api-ref-jobs - stx-api-ref-jobs
- publish-stx-docs - publish-stx-docs
- stx-release-notes-jobs - stx-release-notes-jobs
- stx-bandit-jobs
check: check:
jobs: jobs:
- openstack-tox-linters - openstack-tox-linters

View File

@ -2,3 +2,4 @@ bashate >= 0.2
PyYAML >= 3.1.0 PyYAML >= 3.1.0
yamllint >= 0.5.2 yamllint >= 0.5.2
flake8 flake8
bandit!=1.6.0,>=1.1.0,<2.0.0

View File

@ -107,3 +107,9 @@ whitelist_externals = rm
basepython = python3 basepython = python3
whitelist_externals = cat whitelist_externals = cat
commands = cat /etc/mtc.ini commands = cat /etc/mtc.ini
[testenv:bandit]
basepython = python3
description = Bandit code scan for *.py files under config folder
deps = -r{toxinidir}/test-requirements.txt
commands = bandit -r {toxinidir}/ -x '**/.tox/**,**/.eggs/**' -lll