fix(ci): audit the package's dependencies, not the tool venv
CI / test (3.12) (pull_request) Successful in 28s
CI / test (3.13) (pull_request) Successful in 26s
CI / test (3.11) (pull_request) Successful in 2m31s

The device-types pilot failed pip-audit on pip 25.0.1 of the venv that also
held bandit and pip-audit. The package now goes into a venv of its own with
a current pip; its frozen set (URL installs left out) is what pip-audit
checks.
This commit is contained in:
christianmanivong committed 2026-10-22 19:14:55 +02:00
1 parent 0b21f62553
commit ba133d9de3
2 files changed
+20 -9

No files matched your search

+16 -9
View File
@@ -137,18 +137,25 @@ jobs:
with:
python-version: "3.12"
- name: Install
# Two venvs: the tools, and the package alone. Auditing the tools' venv
# reported the runner's own pip instead of anything the package brings.
run: |
python -m venv .venv
echo "$PWD/.venv/bin" >> "$GITHUB_PATH"
.venv/bin/pip install -q "$STANDARD" bandit pip-audit
if [ -n "${{ inputs.pre-install }}" ]; then .venv/bin/pip install -q ${{ inputs.pre-install }}; fi
.venv/bin/pip install -q .
python -m venv .tools
.tools/bin/pip install -q --upgrade pip
.tools/bin/pip install -q "$STANDARD" bandit pip-audit
python -m venv .audit
.audit/bin/pip install -q --upgrade pip
if [ -n "${{ inputs.pre-install }}" ]; then .audit/bin/pip install -q ${{ inputs.pre-install }}; fi
.audit/bin/pip install -q .
- name: bandit
run: bandit -q -r "$(napalm-standard package)"
run: .tools/bin/bandit -q -r "$(.tools/bin/napalm-standard package)"
- name: pip-audit
# The installed set: what a user gets today from the package's ranges.
# A package not on PyPI yet (the driver itself, a git pre-install) is skipped with a note.
run: pip-audit --skip-editable --progress-spinner off
# What a user gets today from the package's ranges. Packages installed from
# a URL (the package itself, a git pre-install) are not on PyPI's index yet.
run: |
.audit/bin/pip freeze --all | grep -vE ' @ |^-e ' > audit-requirements.txt
cat audit-requirements.txt
.tools/bin/pip-audit -r audit-requirements.txt --no-deps --disable-pip --progress-spinner off
build:
runs-on: ubuntu-latest