-
Notifications
You must be signed in to change notification settings - Fork 561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support yarn workspaces projects in --all-projects #2341
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see my comments
60afda4
to
e031c82
Compare
e031c82
to
8a6346e
Compare
c27ef30
to
fe81b83
Compare
Ready for review, still have some manual verification left to do before it can be merged |
4612af1
to
39312ef
Compare
QA completed, please see the PR description for tested scenarios & their results |
By default include Yarn workspace projects for duscovery during --all-projects as well. Filter out any files that were scanned as part of a workspace before forewarding on the rest of the detected manifests to be scanned by the individual plugins.
What does this PR do?
Support detecting & scanning Yarn workspace projects
--all-projects
.Process all projects as yarn workspaces first since many files are related to each other and could belong to a workspace, then process the rest as usual.
Where should the reviewer start?
https://github.com/snyk/snyk/pull/2341/files#diff-2194ffc6b9f5b3533db3a8c636c6fcde3d7f163e92de6d915a5dc542a576fb82R48
How should this be manually tested?
Run
snyk test --all-projects
in a yarn workspaces projectsWhat are the relevant tickets?
https://github.com/snyk/snyk/issues/1561
Screenshots
Scenario 1:
snyk test --all-projects
detects all the Yarn workspace projects + the non-workspace project.Scenario 2:
snyk test --all-projects --json
has the same output all the Yarn workspace projects via--yarn-workspaces
with the addition of the non-workspace project.Scenario 3:
Out of sync error during
--yarn-workspaces
scan is resulting in the same error code and behaviour as an error in another project type during--all-projects
Note:
--all-projects
by default does not log the errors and instead shows them in debug mode. So the difference in the error seen is expected.No supported manifests error during
--yarn-workspaces
scan is resulting in the same error code and message as during--all-projects
Scenario 4:
Scenario 5:
snyk-dev test --all-projects --strict-out-of-sync=false
andsnyk-dev test --yarn-workspaces --strict-out-of-sync=false
both detect and scan all the projects in a yarn workspace monorepoScenario 6⚠️ :
--all-projects
does not fail if 1 project fails, it logs it and keeps going. So scanning a out of sync workspace now follows the same login when scanned with--all-projects
to ensure backwards compatible & expected behaviour. The same behaviour as with--yarn-workspaces
can be achieved by adding--fail-fast
flag.Scenario 7:
Exit codes match when 100% of the projects fail to scan via
--all-projects
and--yarn-workspaces
Scenario 8:
--all-projects --dev --json
matches the data from--yarn-workspaces --dev --json
+ finds an extra non workspace projects.Scenario 9:
snyk monitor --all-projects
matches the same projects fromsnyk monitor --yarn-workspaces
+ applies all the Snyk org ignores