-
Notifications
You must be signed in to change notification settings - Fork 91
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
Add Swift Package Manager component detection support #1316
base: main
Are you sure you want to change the base?
Add Swift Package Manager component detection support #1316
Conversation
@@ -2,6 +2,8 @@ name: Publish snapshot of test scan | |||
|
|||
env: | |||
CD_DETECTOR_EXPERIMENTS: 1 | |||
PipReportSkipFallbackOnFailure: "true" | |||
PIP_INDEX_URL: "https://pypi.python.org/simple" |
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.
The snapshot reference for the verification tests needs to be updated with the same environment as the verification pipeline or otherwise it will fail.
@microsoft-github-policy-service agree company="Microsoft" |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1316 +/- ##
=======================================
+ Coverage 89.3% 89.4% +0.1%
=======================================
Files 379 384 +5
Lines 30082 30580 +498
Branches 1840 1851 +11
=======================================
+ Hits 26870 27368 +498
+ Misses 2821 2820 -1
- Partials 391 392 +1 ☔ View full report in Codecov by Sentry. |
@@ -54,7 +56,7 @@ jobs: | |||
run: | |||
dotnet run scan --Verbosity Verbose --SourceDirectory ${{ github.workspace }}/test/Microsoft.ComponentDetection.VerificationTests/resources --Output ${{ github.workspace }}/output | |||
--DockerImagesToScan "docker.io/library/debian@sha256:9b0e3056b8cd8630271825665a0613cc27829d6a24906dc0122b3b4834312f7d,mcr.microsoft.com/cbl-mariner/base/core@sha256:c1bc83a3d385eccbb2f7f7da43a726c697e22a996f693a407c35ac7b4387cd59,docker.io/library/alpine@sha256:1304f174557314a7ed9eddb4eab12fed12cb0cd9809e4c28f29af86979a3c870" | |||
--DetectorArgs DockerReference=EnableIfDefaultOff,SPDX22SBOM=EnableIfDefaultOff,SimplePip=EnableIfDefaultOff | |||
--DetectorArgs DockerReference=EnableIfDefaultOff,SPDX22SBOM=EnableIfDefaultOff |
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.
I removed SimplePip
so that both snapshot generation and verification have the same enabled components. SimplePip
was disabled from the verification pipeline in PR #1259
Component detection does not currently support detection of Swift Package Manager. This package manager is the new default for swift-related projects now that CocoaPods (supported by Component detection) is on maintenance mode.
This new detector adds basic support to SwiftPM by parsing the JSON file
Package.resolved
that is generated when dependencies are resolved. This file is usually present in repositories and after building a Swift Package and its contents are enough to detect both direct and transitive dependencies.This detector does not parse the
Package.swift
file (hard to parse and does not include transitive dependencies) and does not differentiate between build dependencies, transitive dependencies, and direct dependencies (it is not possible by just parsingPackage.resolved
).This detector will register two kind of components: a
SwiftPMComponent
and aGitComponent
. I have decided to also register a Git component because SwiftPM does not rely in a repository infrastructure such as NPM, it directly downloads other Swift Packages from the git repositories. I need feedback in this regard, since I do not know what is the best practice (maybe having two registered components for the same dependency is not a good idea?)I had to invest time in troubleshooting the verification tests because I was not passing them. The issue is that the reference snapshot has less packages because the environments differ for
PipReport
since PR #1259. I have added the same environment vars to the snapshot-publish pipeline although maybe @pauld-msft could take a look at this PR to verify that my modification is correct.