File tree 4 files changed +35
-5
lines changed
mapping/src/commonMain/kotlin
model/src/commonMain/kotlin
model/src/commonMain/kotlin
workers/scanner/src/main/kotlin/scanner 4 files changed +35
-5
lines changed Original file line number Diff line number Diff line change @@ -578,7 +578,8 @@ fun ScannerJobConfiguration.mapToApi() = ApiScannerJobConfiguration(
578
578
skipExcluded,
579
579
sourceCodeOrigins?.map { it.mapToApi() },
580
580
config?.mapValues { it.value.mapToApi() },
581
- keepAliveWorker
581
+ keepAliveWorker,
582
+ submoduleFetchStrategy.mapToApi()
582
583
)
583
584
584
585
fun ApiScannerJobConfiguration.mapToModel () = ScannerJobConfiguration (
@@ -590,7 +591,8 @@ fun ApiScannerJobConfiguration.mapToModel() = ScannerJobConfiguration(
590
591
skipExcluded,
591
592
sourceCodeOrigins?.map { it.mapToModel() },
592
593
config?.mapValues { it.value.mapToModel() },
593
- keepAliveWorker
594
+ keepAliveWorker,
595
+ submoduleFetchStrategy.mapToModel()
594
596
)
595
597
596
598
fun Secret.mapToApi () = ApiSecret (name, description)
Original file line number Diff line number Diff line change @@ -187,7 +187,14 @@ data class ScannerJobConfiguration(
187
187
* Keep the worker alive after it has finished. This is useful for manual problem analysis directly
188
188
* within the pod's execution environment.
189
189
*/
190
- val keepAliveWorker : Boolean = false
190
+ val keepAliveWorker : Boolean = false ,
191
+
192
+ /* *
193
+ * Specifies how submodules are fetched when resolving provenances. Currently supported only for Git repositories.
194
+ * If set to [SubmoduleFetchStrategy.FULLY_RECURSIVE] (default), all submodules are fetched recursively. If set
195
+ * to [SubmoduleFetchStrategy.TOP_LEVEL_ONLY], only the top-level submodules are fetched.
196
+ */
197
+ val submoduleFetchStrategy : SubmoduleFetchStrategy = SubmoduleFetchStrategy .FULLY_RECURSIVE
191
198
)
192
199
193
200
/* *
Original file line number Diff line number Diff line change @@ -196,7 +196,14 @@ data class ScannerJobConfiguration(
196
196
* Keep the worker alive after it has finished. This is useful for manual problem analysis directly
197
197
* within the pod's execution environment.
198
198
*/
199
- val keepAliveWorker : Boolean = false
199
+ val keepAliveWorker : Boolean = false ,
200
+
201
+ /* *
202
+ * Specifies how submodules are fetched when resolving provenances. Currently supported only for Git repositories.
203
+ * If set to [SubmoduleFetchStrategy.FULLY_RECURSIVE] (default), all submodules are fetched recursively. If set
204
+ * to [SubmoduleFetchStrategy.TOP_LEVEL_ONLY], only the top-level submodules are fetched.
205
+ */
206
+ val submoduleFetchStrategy : SubmoduleFetchStrategy = SubmoduleFetchStrategy .FULLY_RECURSIVE
200
207
)
201
208
202
209
/* *
Original file line number Diff line number Diff line change @@ -58,6 +58,19 @@ class ScannerRunner(
58
58
): OrtScannerResult {
59
59
val pluginConfigs = context.resolvePluginConfigSecrets(config.config)
60
60
61
+ // If the submodule fetch strategy is set to TOP_LEVEL_ONLY, for git use a plugin config that prevents that
62
+ // submodules are fetched recursively.
63
+ val vcsPluginConfigs = if (config.submoduleFetchStrategy == SubmoduleFetchStrategy .TOP_LEVEL_ONLY ) {
64
+ mapOf (
65
+ VcsType .GIT .toString() to PluginConfig (
66
+ options = mapOf (" updateNestedSubmodules" to " false" )
67
+ )
68
+ )
69
+ } else {
70
+ emptyMap()
71
+ }
72
+ val canonicalVcsPluginConfigs = createCanonicalVcsPluginConfigs(vcsPluginConfigs)
73
+
61
74
val packageProvenanceCache = PackageProvenanceCache ()
62
75
val packageProvenanceStorage = OrtServerPackageProvenanceStorage (db, scannerRunId, packageProvenanceCache)
63
76
val nestedProvenanceStorage = OrtServerNestedProvenanceStorage (db, packageProvenanceCache)
@@ -85,7 +98,8 @@ class ScannerRunner(
85
98
? : listOf (SourceCodeOrigin .ARTIFACT , SourceCodeOrigin .VCS )
86
99
)
87
100
88
- val workingTreeCache = DefaultWorkingTreeCache ()
101
+ val workingTreeCache = DefaultWorkingTreeCache ().addVcsPluginConfigs(vcsPluginConfigs)
102
+
89
103
val provenanceDownloader = DefaultProvenanceDownloader (downloaderConfig, workingTreeCache)
90
104
val packageProvenanceResolver = DefaultPackageProvenanceResolver (
91
105
scanStorages.packageProvenanceStorage,
You can’t perform that action at this time.
0 commit comments