-
Notifications
You must be signed in to change notification settings - Fork 79
/
Copy pathscanmultiplerepositories.go
28 lines (24 loc) · 1.08 KB
/
scanmultiplerepositories.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package scanrepository
import (
"errors"
"github.com/jfrog/frogbot/v2/utils"
"github.com/jfrog/froggit-go/vcsclient"
)
type ScanMultipleRepositories struct {
// dryRun is used for testing purposes, mocking part of the git commands that requires networking
dryRun bool
// When dryRun is enabled, dryRunRepoPath specifies the repository local path to clone
dryRunRepoPath string
}
func (saf *ScanMultipleRepositories) Run(repoAggregator utils.RepoAggregator, client vcsclient.VcsClient, frogbotRepoConnection *utils.UrlAccessChecker) (err error) {
scanRepositoryCmd := &ScanRepositoryCmd{dryRun: saf.dryRun, dryRunRepoPath: saf.dryRunRepoPath, baseWd: saf.dryRunRepoPath}
for repoNum := range repoAggregator {
repoAggregator[repoNum].OutputWriter.SetHasInternetConnection(frogbotRepoConnection.IsConnected())
scanRepositoryCmd.XrayVersion = repoAggregator[repoNum].XrayVersion
scanRepositoryCmd.XscVersion = repoAggregator[repoNum].XscVersion
if e := scanRepositoryCmd.scanAndFixRepository(&repoAggregator[repoNum], client); e != nil {
err = errors.Join(err, e)
}
}
return
}