Skip to content

Commit 66c9422

Browse files
authored
Added toxenv for snyk scanning (#926)
<!-- Contributing guide: https://github.com/openvinotoolkit/datumaro/blob/develop/CONTRIBUTING.md --> ### Summary This one would be used to perform snyk code scanning from the internal development environment only because the API endpoint cannot be accessed from the external. Once we setup the self-hosted CI instance, this one will be used by code-scanning workflow to automate snyk scanning & reporting. before that, this will be used to generate snyk report manually. <!-- Resolves #111 and #222. Depends on #1000 (for series of dependent commits). This PR introduces this capability to make the project better in this and that. - Added this feature - Removed that feature - Fixed the problem #1234 --> ### How to test <!-- Describe the testing procedure for reviewers, if changes are not fully covered by unit tests or manual testing can be complicated. --> ### Checklist <!-- Put an 'x' in all the boxes that apply --> - [ ] I have added unit tests to cover my changes.​ - [ ] I have added integration tests to cover my changes.​ - [ ] I have added the description of my changes into [CHANGELOG](https://github.com/openvinotoolkit/datumaro/blob/develop/CHANGELOG.md).​ - [ ] I have updated the [documentation](https://github.com/openvinotoolkit/datumaro/tree/develop/docs) accordingly ### License - [ ] I submit _my code changes_ under the same [MIT License](https://github.com/openvinotoolkit/datumaro/blob/develop/LICENSE) that covers the project. Feel free to contact the maintainers if that's a concern. - [ ] I have updated the license header for each file (see an example below). ```python # Copyright (C) 2023 Intel Corporation # # SPDX-License-Identifier: MIT ```
1 parent 4672276 commit 66c9422

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tox.ini

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
isolated_build = true
33
skip_missing_interpreters = true
44

5+
[testenv]
6+
deps =
7+
-r{toxinidir}/requirements.txt
58

69
[testenv:pre-commit]
710
basepython = python3
@@ -15,3 +18,28 @@ deps =
1518
bandit
1619
commands =
1720
- bandit -r -c {toxinidir}/ipas_default.config {toxinidir}/ -f txt -o {toxworkdir}/bandit-report.txt
21+
22+
[testenv:snyk-scan]
23+
deps =
24+
{[testenv]deps}
25+
allowlist_externals =
26+
bash
27+
curl
28+
wget
29+
chmod
30+
rm
31+
*snyk*
32+
commands =
33+
bash -c "pip freeze > snyk-req.txt"
34+
curl https://static.snyk.io/cli/latest/snyk-linux -o {toxworkdir}/snyk
35+
chmod +x {toxworkdir}/snyk
36+
{toxworkdir}/snyk config set endpoint={env:SNYK_ENDPOINT}
37+
{toxworkdir}/snyk config set disable-analytics=1
38+
- {toxworkdir}/snyk test --file=snyk-req.txt --package-manager=pip --sarif-file-output={toxworkdir}/snyk.sarif --json-file-output={toxworkdir}/snyk.json
39+
- {toxworkdir}/snyk monitor --file=snyk-req.txt --package-manager=pip
40+
wget -P .tox/ https://github.com/snyk/snyk-to-html/releases/download/v2.3.6/snyk-to-html-linux
41+
chmod +x {toxworkdir}/snyk-to-html-linux
42+
{toxworkdir}/snyk-to-html-linux -i {toxworkdir}/snyk.json -o {toxworkdir}/snyk.html -d
43+
rm {toxworkdir}/snyk
44+
rm {toxworkdir}/snyk-to-html-linux
45+
rm snyk-req.txt

0 commit comments

Comments
 (0)