Skip to content

Commit 3b93eaa

Browse files
Added-disable-asca-update-key-in-config(AST-119734) (#1382)
* added-disable-asca-update-key-in-config * import-changed --------- Co-authored-by: Rahul Pidde <[email protected]>
1 parent 6cf6447 commit 3b93eaa

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

internal/params/binds.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,5 @@ var EnvVarsBinds = []struct {
8585
{MultipartPresignedPathKey, MultipartPresignedPathEnv, "api/uploads/multipart-presigned"},
8686
{CompleteMultiPartUploadPathKey, CompleteMultipartUploadPathEnv, "api/uploads/complete-multipart-upload"},
8787
{MultipartFileSizeKey, MultipartFileSizeEnv, "2"},
88+
{DisableASCALatestVersionKey, DisableASCALatestVersionEnv, ""},
8889
}

internal/params/envs.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,5 @@ const (
8888
MultipartPresignedPathEnv = "CX_MULTIPART_PRESIGNED_URL_PATH"
8989
CompleteMultipartUploadPathEnv = "CX_COMPLETE_MULTIPART_UPLOAD_PATH"
9090
MultipartFileSizeEnv = "MULTIPART_FILE_SIZE"
91+
DisableASCALatestVersionEnv = "DISABLE_ASCA_UPDATE"
9192
)

internal/params/keys.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,5 @@ var (
8787
MultipartPresignedPathKey = strings.ToLower(MultipartPresignedPathEnv)
8888
CompleteMultiPartUploadPathKey = strings.ToLower(CompleteMultipartUploadPathEnv)
8989
MultipartFileSizeKey = strings.ToLower(MultipartFileSizeEnv)
90+
DisableASCALatestVersionKey = strings.ToLower(DisableASCALatestVersionEnv)
9091
)

internal/services/asca.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"os"
88
"os/exec"
99
"path/filepath"
10+
"strings"
1011
"time"
1112

1213
"github.com/checkmarx/ast-cli/internal/commands/asca/ascaconfig"
@@ -158,8 +159,8 @@ func buildAscaIgnoreMap(ignored []grpcs.AscaIgnoreFinding) map[string]bool {
158159

159160
func manageASCAInstallation(ascaParams AscaScanParams, ascaWrappers AscaWrappersParam) error {
160161
ASCAInstalled, _ := osinstaller.FileExists(ascaconfig.Params.ExecutableFilePath())
161-
162-
if !ASCAInstalled || ascaParams.ASCAUpdateVersion {
162+
if !ASCAInstalled || (ascaParams.ASCAUpdateVersion && strings.TrimSpace(strings.ToLower(viper.GetString(params.DisableASCALatestVersionKey))) != "true") {
163+
logger.PrintIfVerbose("Ensuring ASCA is installed or is up to date")
163164
if err := checkLicense(ascaParams.IsDefaultAgent, ascaWrappers); err != nil {
164165
_ = ascaWrappers.ASCAWrapper.ShutDown()
165166
return err

0 commit comments

Comments
 (0)