在 gitlab-runner 中通过 tox 运行强盗行为不正确
Runnning bandit via tox in gitlab-runner does not behave correctly
当我在 gitlab-runner
环境中通过 tox
运行 bandit
时,它的行为与我通过 tox
运行 它的行为不同在我的 Ubuntu 环境中。
- gitlab-运行ner环境 -> 项目源目录递归分析但跳过文件
- ubuntu环境 -> 项目源码目录递归分析
在ubuntu环境中运行时的调用是:tox -e bandit
在gitlab-运行ner环境中运行时的调用是:gitlab-runner exec docker bandit
在 gitlab-运行ner 环境的情况下,相关消息是([source-root-directory]
作为 src
根目录):
Files skipped (4):
[source-root-directory]/__init__.py (syntax error while parsing AST from file)
[source-root-directory]/[some-file].py (syntax error while parsing AST from file)
[source-root-directory]/[some-other-file].py (syntax error while parsing AST from file)
...
tox.ini
的相关摘录是([source-root-directory]
作为 src
根目录):
[tox]
envlist = py27, py34
[testenv:bandit]
deps = {[testenv]deps}
commands = bandit {posargs:-r [source-dir]}
.gitlab-ci.yml
的相关摘录是:
bandit:
stage: test
image: python:latest
script:
- pip install tox
- tox -e bandit
allow_failure: true
您应该检查您使用的 运行 和 Python 的工具版本在两个环境中是否相同。 python:latest
目前正在使用 python 3.7 而 Ubuntu 可能是 运行 2.7
当我在 gitlab-runner
环境中通过 tox
运行 bandit
时,它的行为与我通过 tox
运行 它的行为不同在我的 Ubuntu 环境中。
- gitlab-运行ner环境 -> 项目源目录递归分析但跳过文件
- ubuntu环境 -> 项目源码目录递归分析
在ubuntu环境中运行时的调用是:tox -e bandit
在gitlab-运行ner环境中运行时的调用是:gitlab-runner exec docker bandit
在 gitlab-运行ner 环境的情况下,相关消息是([source-root-directory]
作为 src
根目录):
Files skipped (4):
[source-root-directory]/__init__.py (syntax error while parsing AST from file)
[source-root-directory]/[some-file].py (syntax error while parsing AST from file)
[source-root-directory]/[some-other-file].py (syntax error while parsing AST from file)
...
tox.ini
的相关摘录是([source-root-directory]
作为 src
根目录):
[tox]
envlist = py27, py34
[testenv:bandit]
deps = {[testenv]deps}
commands = bandit {posargs:-r [source-dir]}
.gitlab-ci.yml
的相关摘录是:
bandit:
stage: test
image: python:latest
script:
- pip install tox
- tox -e bandit
allow_failure: true
您应该检查您使用的 运行 和 Python 的工具版本在两个环境中是否相同。 python:latest
目前正在使用 python 3.7 而 Ubuntu 可能是 运行 2.7