Skip to content

Commit fc63d0e

Browse files
added-disable-asca-update-key-in-config
1 parent 1f26f40 commit fc63d0e

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-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: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ import (
77
"os"
88
"os/exec"
99
"path/filepath"
10+
"strings"
1011
"time"
1112

1213
"github.com/checkmarx/ast-cli/internal/commands/asca/ascaconfig"
1314
"github.com/checkmarx/ast-cli/internal/logger"
1415
"github.com/checkmarx/ast-cli/internal/params"
16+
commonParams "github.com/checkmarx/ast-cli/internal/params"
1517
"github.com/checkmarx/ast-cli/internal/services/osinstaller"
1618
"github.com/checkmarx/ast-cli/internal/services/realtimeengine"
1719
"github.com/checkmarx/ast-cli/internal/wrappers"
@@ -158,8 +160,8 @@ func buildAscaIgnoreMap(ignored []grpcs.AscaIgnoreFinding) map[string]bool {
158160

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

0 commit comments

Comments
 (0)