-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLI | Add Vorpal Engine Logic (AST-38523) (#767)
* add vorpal engine logic * add vorpal engine logic * fix linter errors and integration test compilation * fix linter errors and integration test compilation * fix integration test compilation * fix linter * fix unit tests and added mock vorpal wrapper * fix integration tests compilation * fix integration tests compilation * fix integration tests compilation * fix unit test * fix unit test * fix unit test * change vorpalWrapper initialization logic to handle edge cases * change vorpalWrapper initialization logic to handle edge cases * change vorpalWrapper initialization logic to handle edge cases * added different process configuration to mac-linux and windows * added unit tests * add testify to depguard * fix unit tests * added integration tests * extract method of vorpal installation logic * added integration tests * added integration tests * fix unit tests * fix unit tests * fix tests and move ConfigureIndependentProcess functionality to osinstaller * fix tests and move and resolve conversations * added packageEnforcementEnabled FF check in IsAllowedEngine func * added packageEnforcementEnabled FF check in IsAllowedEngine func * chenge jwtMock * resolve conversations * resolve conversations * resolve linter * resolve linter * resolve linter * resolve linter * resolve conversation * add integration test license check * add test * add test * fix test * increase time initializing vorpal service * fix vorpal installation condition * add integration test * increase timeout for waiting for server to 5 seconds * Added serving field to avoid unnecessary health check calls * resolve conversations * add imports * resolve conversations * resolve conversations * revert omitempty in scanDetails * revert omitempty in scanDetails * update osinstaller --------- Co-authored-by: AlvoBen <alvo@post.bgu.ac.il>
- Loading branch information
Showing
24 changed files
with
740 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package vorpal | ||
|
||
import ( | ||
"github.com/checkmarx/ast-cli/internal/commands/util/printer" | ||
commonParams "github.com/checkmarx/ast-cli/internal/params" | ||
"github.com/checkmarx/ast-cli/internal/services" | ||
"github.com/checkmarx/ast-cli/internal/wrappers" | ||
"github.com/checkmarx/ast-cli/internal/wrappers/grpcs" | ||
"github.com/spf13/cobra" | ||
"github.com/spf13/viper" | ||
) | ||
|
||
func RunScanVorpalCommand(jwtWrapper wrappers.JWTWrapper, featureFlagsWrapper wrappers.FeatureFlagsWrapper) func(cmd *cobra.Command, args []string) error { | ||
return func(cmd *cobra.Command, args []string) error { | ||
vorpalLatestVersion, _ := cmd.Flags().GetBool(commonParams.VorpalLatestVersion) | ||
fileSourceFlag, _ := cmd.Flags().GetString(commonParams.SourcesFlag) | ||
agent, _ := cmd.Flags().GetString(commonParams.AgentFlag) | ||
var port = viper.GetInt(commonParams.VorpalPortKey) | ||
vorpalWrapper := grpcs.NewVorpalGrpcWrapper(port) | ||
vorpalParams := services.VorpalScanParams{ | ||
FilePath: fileSourceFlag, | ||
VorpalUpdateVersion: vorpalLatestVersion, | ||
IsDefaultAgent: agent == commonParams.DefaultAgent, | ||
} | ||
wrapperParams := services.VorpalWrappersParam{ | ||
JwtWrapper: jwtWrapper, | ||
FeatureFlagsWrapper: featureFlagsWrapper, | ||
VorpalWrapper: vorpalWrapper, | ||
} | ||
scanResult, err := services.CreateVorpalScanRequest(vorpalParams, wrapperParams) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
err = printer.Print(cmd.OutOrStdout(), scanResult, printer.FormatJSON) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package scarealtime | ||
package vorpal | ||
|
||
import ( | ||
"os" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.