Skip to content

Commit

Permalink
fix(codeqlExecuteScan): added parameters threads and ram (SAP#4269)
Browse files Browse the repository at this point in the history
  • Loading branch information
daskuznetsova authored Mar 13, 2023
1 parent 8084ce1 commit 9774eaa
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 1 deletion.
22 changes: 21 additions & 1 deletion cmd/codeqlExecuteScan.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,18 @@ func runCodeqlExecuteScan(config *codeqlExecuteScanOptions, telemetryData *telem

if len(language) > 0 {
cmd = append(cmd, "--language="+language)
} else if len(config.Language) > 0 {
} else {
cmd = append(cmd, "--language="+config.Language)
}

if len(config.Threads) > 0 {
cmd = append(cmd, "--threads="+config.Threads)
}

if len(config.Ram) > 0 {
cmd = append(cmd, "--ram="+config.Ram)
}

//codeql has an autobuilder which tries to build the project based on specified programming language
if len(config.BuildCommand) > 0 {
cmd = append(cmd, "--command="+config.BuildCommand)
Expand All @@ -209,6 +217,12 @@ func runCodeqlExecuteScan(config *codeqlExecuteScanOptions, telemetryData *telem

cmd = nil
cmd = append(cmd, "database", "analyze", "--format=sarif-latest", fmt.Sprintf("--output=%vtarget/codeqlReport.sarif", config.ModulePath), config.Database)
if len(config.Threads) > 0 {
cmd = append(cmd, "--threads="+config.Threads)
}
if len(config.Ram) > 0 {
cmd = append(cmd, "--ram="+config.Ram)
}
cmd = codeqlQuery(cmd, config.QuerySuite)
err = execute(utils, cmd, GeneralConfig.Verbose)
if err != nil {
Expand All @@ -220,6 +234,12 @@ func runCodeqlExecuteScan(config *codeqlExecuteScanOptions, telemetryData *telem

cmd = nil
cmd = append(cmd, "database", "analyze", "--format=csv", fmt.Sprintf("--output=%vtarget/codeqlReport.csv", config.ModulePath), config.Database)
if len(config.Threads) > 0 {
cmd = append(cmd, "--threads="+config.Threads)
}
if len(config.Ram) > 0 {
cmd = append(cmd, "--ram="+config.Ram)
}
cmd = codeqlQuery(cmd, config.QuerySuite)
err = execute(utils, cmd, GeneralConfig.Verbose)
if err != nil {
Expand Down
22 changes: 22 additions & 0 deletions cmd/codeqlExecuteScan_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions resources/metadata/codeqlExecuteScan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,21 @@ spec:
- STAGES
- STEPS
default: false
- name: threads
type: string
description: "Use this many threads for the codeql operations."
scope:
- PARAMETERS
- STAGES
- STEPS
default: "0"
- name: ram
type: string
description: "Use this much ram (MB) for the codeql operations."
scope:
- PARAMETERS
- STAGES
- STEPS
- name: analyzedRef
type: string
description: "Name of the ref that was analyzed."
Expand Down

0 comments on commit 9774eaa

Please sign in to comment.