diff --git a/artifactory/commands/yarn/yarn.go b/artifactory/commands/yarn/yarn.go index 01a62713c..848d6454c 100644 --- a/artifactory/commands/yarn/yarn.go +++ b/artifactory/commands/yarn/yarn.go @@ -3,7 +3,7 @@ package yarn import ( "bufio" "encoding/json" - "fmt" + "errors" "os" "os/exec" "path/filepath" @@ -60,25 +60,24 @@ func (yc *YarnCommand) SetArgs(args []string) *YarnCommand { return yc } -func (yc *YarnCommand) Run() error { +func (yc *YarnCommand) Run() (err error) { log.Info("Running Yarn...") - var err error if err = yc.validateSupportedCommand(); err != nil { - return err + return } if err = yc.readConfigFile(); err != nil { - return err + return } var filteredYarnArgs []string yc.threads, _, _, _, filteredYarnArgs, yc.buildConfiguration, err = commandUtils.ExtractYarnOptionsFromArgs(yc.yarnArgs) if err != nil { - return err + return } if err = yc.preparePrerequisites(); err != nil { - return err + return } var missingDepsChan chan string @@ -86,7 +85,7 @@ func (yc *YarnCommand) Run() error { if yc.collectBuildInfo { missingDepsChan, err = yc.prepareBuildInfo() if err != nil { - return err + return } go func() { for depId := range missingDepsChan { @@ -97,17 +96,16 @@ func (yc *YarnCommand) Run() error { restoreYarnrcFunc, err := commandUtils.BackupFile(filepath.Join(yc.workingDirectory, YarnrcFileName), YarnrcBackupFileName) if err != nil { - return RestoreConfigurationsAndError(nil, restoreYarnrcFunc, err) + return errors.Join(err, restoreYarnrcFunc()) } - backupEnvMap, err := ModifyYarnConfigurations(yc.executablePath, yc.registry, yc.npmAuthIdent) if err != nil { - return RestoreConfigurationsAndError(nil, restoreYarnrcFunc, err) + return errors.Join(err, restoreYarnrcFunc()) } yc.buildInfoModule.SetArgs(filteredYarnArgs) if err = yc.buildInfoModule.Build(); err != nil { - return RestoreConfigurationsAndError(nil, restoreYarnrcFunc, err) + return errors.Join(err, restoreYarnrcFunc()) } if yc.collectBuildInfo { @@ -116,11 +114,11 @@ func (yc *YarnCommand) Run() error { } if err = RestoreConfigurationsFromBackup(backupEnvMap, restoreYarnrcFunc); err != nil { - return err + return } log.Info("Yarn finished successfully.") - return nil + return } func (yc *YarnCommand) ServerDetails() (*config.ServerDetails, error) { @@ -165,13 +163,6 @@ func (yc *YarnCommand) readConfigFile() error { return err } -func RestoreConfigurationsAndError(envVarsBackup map[string]*string, restoreNpmrcFunc func() error, err error) error { - if restoreErr := RestoreConfigurationsFromBackup(envVarsBackup, restoreNpmrcFunc); restoreErr != nil { - return fmt.Errorf("two errors occurred:\n%s\n%s", restoreErr.Error(), err.Error()) - } - return err -} - func (yc *YarnCommand) preparePrerequisites() error { log.Debug("Preparing prerequisites.") var err error diff --git a/xray/utils/analyzermanager.go b/xray/utils/analyzermanager.go index 733b09ab0..12784921c 100644 --- a/xray/utils/analyzermanager.go +++ b/xray/utils/analyzermanager.go @@ -23,7 +23,7 @@ const ( EntitlementsMinVersion = "3.66.5" ApplicabilityFeatureId = "contextual_analysis" AnalyzerManagerZipName = "analyzerManager.zip" - defaultAnalyzerManagerVersion = "1.3.2.2006984" + defaultAnalyzerManagerVersion = "1.3.2.2019257" minAnalyzerManagerVersionForSast = "1.3" analyzerManagerDownloadPath = "xsc-gen-exe-analyzer-manager-local/v1" analyzerManagerDirName = "analyzerManager"