Tox and Zuul job for the bandit code scan in stx/monitoring

Setting up the bandit tool for the scanning of HIGH severity issues
in the python codes under Starlingx/monitoring 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.

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

Change-Id: Ibcbe1dd2e380f80c4cbf6f2a7cf49065dc890803
Signed-off-by: Sharath Kumar K <sharath.kumar@intel.com>
This commit is contained in:
Sharath Kumar K 2020-05-08 11:48:25 +02:00
parent 4d9f256bb5
commit 8ef034919c
3 changed files with 9 additions and 0 deletions

View File

@ -1,5 +1,7 @@
---
- project:
templates:
- stx-bandit-jobs
check:
jobs:
- openstack-tox-linters

View File

@ -1,3 +1,4 @@
# hacking pulls in flake8
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
bashate >= 0.2
bandit!=1.6.0,>=1.1.0,<2.0.0

View File

@ -53,3 +53,9 @@ commands =
commands =
{[testenv:bashate]commands}
{[testenv:flake8]commands}
[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