@@ -51,7 +51,7 @@ type FrogbotDetails struct {
5151
5252type RepoAggregator []Repository
5353
54- // NewRepoAggregator returns an initialized RepoAggregator with an empty repository
54+ // Returns an initialized RepoAggregator with an empty repository
5555func newRepoAggregator () RepoAggregator {
5656 return RepoAggregator {{Params : Params {Scan : Scan {Projects : []Project {{}}}}}}
5757}
@@ -336,6 +336,7 @@ type Git struct {
336336 PullRequestDetails vcsclient.PullRequestInfo
337337 RepositoryCloneUrl string
338338 UseLocalRepository bool
339+ UploadSbomToVcs * bool `yaml:"uploadSbomToVcs,omitempty"`
339340}
340341
341342func (g * Git ) GetRepositoryHttpsCloneUrl (gitClient vcsclient.VcsClient ) (string , error ) {
@@ -377,6 +378,17 @@ func (g *Git) setDefaultsIfNeeded(gitParamsFromEnv *Git, commandName string) (er
377378 return
378379 }
379380 }
381+
382+ // We don't need to examine gitParamsFromEnv since GitDependencyGraphSubmissionEnv value is not fetched upon gitParamsFromEnv creation
383+ if g .UploadSbomToVcs == nil || ! * g .UploadSbomToVcs {
384+ if g .UploadSbomToVcs == nil {
385+ envValue , err := getBoolEnv (GitDependencyGraphSubmissionEnv , true )
386+ if err != nil {
387+ return err
388+ }
389+ g .UploadSbomToVcs = & envValue
390+ }
391+ }
380392 return
381393}
382394
@@ -394,15 +406,13 @@ func (g *Git) extractScanPullRequestEnvParams(gitParamsFromEnv *Git) (err error)
394406 }
395407 }
396408 if g .UseMostCommonAncestorAsTarget == nil || ! * g .UseMostCommonAncestorAsTarget {
397- defaultValue := true
398- if g .UseMostCommonAncestorAsTarget != nil {
399- defaultValue = * g .UseMostCommonAncestorAsTarget
400- }
401- envValue , err := getBoolEnv (UseMostCommonAncestorAsTargetEnv , defaultValue )
402- if err != nil {
403- return err
409+ if g .UseMostCommonAncestorAsTarget == nil {
410+ envValue , err := getBoolEnv (UseMostCommonAncestorAsTargetEnv , true )
411+ if err != nil {
412+ return err
413+ }
414+ g .UseMostCommonAncestorAsTarget = & envValue
404415 }
405- g .UseMostCommonAncestorAsTarget = & envValue
406416 }
407417 g .AvoidExtraMessages , err = getBoolEnv (AvoidExtraMessages , false )
408418 return
@@ -508,7 +518,7 @@ func GetFrogbotDetails(commandName string) (frogbotDetails *FrogbotDetails, err
508518 return
509519}
510520
511- // getConfigAggregator returns a RepoAggregator based on frogbot-config.yml and environment variables.
521+ // Returns a RepoAggregator based on frogbot-config.yml and environment variables.
512522func getConfigAggregator (xrayVersion , xscVersion string , gitClient vcsclient.VcsClient , gitParamsFromEnv * Git , jfrogServer * coreconfig.ServerDetails , commandName string ) (RepoAggregator , error ) {
513523 configFileContent , err := getConfigFileContent (gitClient , gitParamsFromEnv , commandName )
514524 if err != nil {
@@ -520,7 +530,7 @@ func getConfigAggregator(xrayVersion, xscVersion string, gitClient vcsclient.Vcs
520530 return BuildRepoAggregator (xrayVersion , xscVersion , gitClient , configFileContent , gitParamsFromEnv , jfrogServer , commandName )
521531}
522532
523- // getConfigFileContent retrieves the content of the frogbot-config.yml file
533+ // Retrieves the content of the frogbot-config.yml file
524534func getConfigFileContent (gitClient vcsclient.VcsClient , gitParamsFromEnv * Git , commandName string ) ([]byte , error ) {
525535 var errMissingConfig * ErrMissingConfig
526536
@@ -543,7 +553,7 @@ func getConfigFileContent(gitClient vcsclient.VcsClient, gitParamsFromEnv *Git,
543553 return configFileContent , err
544554}
545555
546- // BuildRepoAggregator receives the content of a frogbot-config.yml file, along with the Git (built from environment variables) and ServerDetails parameters.
556+ // Receives the content of a frogbot-config.yml file, along with the Git (built from environment variables) and ServerDetails parameters.
547557// Returns a RepoAggregator instance with all the defaults and necessary fields.
548558func BuildRepoAggregator (xrayVersion , xscVersion string , gitClient vcsclient.VcsClient , configFileContent []byte , gitParamsFromEnv * Git , server * coreconfig.ServerDetails , commandName string ) (resultAggregator RepoAggregator , err error ) {
549559 var cleanAggregator RepoAggregator
@@ -566,7 +576,7 @@ func BuildRepoAggregator(xrayVersion, xscVersion string, gitClient vcsclient.Vcs
566576 return
567577}
568578
569- // unmarshalFrogbotConfigYaml uses the yaml.Unmarshaler interface to parse the yamlContent.
579+ // Uses the yaml.Unmarshaler interface to parse the yamlContent.
570580// If there is no config file, the function returns a RepoAggregator with an empty repository.
571581func unmarshalFrogbotConfigYaml (yamlContent []byte ) (result RepoAggregator , err error ) {
572582 if len (yamlContent ) == 0 {
@@ -739,7 +749,7 @@ func SanitizeEnv() error {
739749 return nil
740750}
741751
742- // ReadConfigFromFileSystem looks for .frogbot/frogbot-config.yml from the given path and return its content. The path is relative and starts from the root of the project.
752+ // Looks for .frogbot/frogbot-config.yml from the given path and return its content. The path is relative and starts from the root of the project.
743753// If the config file is not found in the relative path, it will search in parent dirs.
744754func ReadConfigFromFileSystem (configRelativePath string ) (configFileContent []byte , err error ) {
745755 log .Debug ("Reading config from file system. Looking for" , osFrogbotConfigPath )
0 commit comments