Skip to content

Commit 0649d37

Browse files
committed
feat: add env DO_NOT_NPM_INSTALL
1 parent 79066e4 commit 0649d37

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

env/common.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ var CliTlsAllowInsecure bool
2626
var DoNotBuild bool
2727
var WaitAfterScannerScan bool
2828
var StorageUploadSBom string
29+
var DoNotNpmInstall bool
2930

3031
func init() {
3132
ctm := os.Getenv("COMMAND_TIMEOUT")
@@ -43,6 +44,7 @@ func init() {
4344
DoNotBuild2, _ := strconv.ParseBool(os.Getenv("MPS_DO_NOT_BUILD"))
4445
DoNotBuild = DoNotBuild || DoNotBuild2
4546
WaitAfterScannerScan, _ = strconv.ParseBool(os.Getenv("WAIT_AFTER_SCANNER_SCAN"))
47+
DoNotNpmInstall, _ = strconv.ParseBool(os.Getenv("DO_NOT_NPM_INSTALL"))
4648
}
4749

4850
func TlsAllowInsecure() bool {

module/npm/npm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func ScanNpmProject(ctx context.Context) ([]model.Module, error) {
148148

149149
func doNpmInstallInDir(ctx context.Context, dir string) error {
150150
logger := logctx.Use(ctx)
151-
if env.DoNotBuild {
151+
if env.DoNotBuild || env.DoNotNpmInstall {
152152
logger.Warn("lockfile not found, and auto build is disabled, skip")
153153
return autoBuildDisabled
154154
}

0 commit comments

Comments
 (0)