Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BST-12445: add main branch scan timeout #12

Merged
merged 4 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,18 @@ Optional path within the git repository to execute scanners in.

When this parameter is specified, you must also provide a `scan_label` to identify the component.

### `scanTimeout` (Optional, number)
### `scanTimeout` (Optional, number) deprecated

The optional timeout after which the Github check will be marked as failed. This defaults to 120 seconds.

### `scanDiffTimeout` (Optional, number)

The optional timeout for non-main scans after which the Github check will be marked as failed. This defaults to 120 seconds.

### `scanMainTimeout` (Optional, number)

The optional timeout for main scans after which the Github check will be marked as failed. This defaults to 2 hours.

### `workingDirectory` (Optional, string)

Optional path to change into before executing any commands.
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ stages:
- task: BoostSecurityScanDev@1
inputs:
apiToken: $(api_token)
registryModule: boostsecurityio/native-scanner
registryModule: boostsecurityio/scanner
- stage: PackageProd
condition: eq(variables.isMain, 'true')
dependsOn: Test
Expand Down Expand Up @@ -116,5 +116,5 @@ stages:
- task: BoostSecurityScan@1
inputs:
apiToken: $(api_token)
registryModule: boostsecurityio/native-scanner
registryModule: boostsecurityio/scanner

17 changes: 15 additions & 2 deletions source/src/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ const BoostParamEnvMap: BoostParamEnvMap = {
scanLabel: "BOOST_SCAN_LABEL",
scannerId: "BOOST_SCANNER_ID",
scanPath: "BOOST_SCAN_PATH",
scanTimeout: "BOOST_DIFF_SCAN_TIMEOUT",
scanTimeout: "BOOST_DIFF_SCAN_TIMEOUT", // deprecated
scanDiffTimeout: "BOOST_DIFF_SCAN_TIMEOUT",
scanMainTimeout: "BOOST_MAIN_SCAN_TIMEOUT",
tmpDir: "BOOST_TMP_DIR",
workingDirectory: "BOOST_WORKING_DIRECTORY",
}
Expand All @@ -54,7 +56,9 @@ class BoostParamsVars {
scanLabel: string | undefined = ""
scannerId: string | undefined = ""
scanPath: string | undefined = ""
scanTimeout: string | undefined = ""
scanTimeout: string | undefined = "" // deprecated
scanDiffTimeout: string | undefined = ""
scanMainTimeout: string | undefined = ""
tmpDir: string = ""
workingDirectory: string | undefined = ""
}
Expand All @@ -65,6 +69,13 @@ export class BoostParams extends BoostParamsVars {
this.loadInputs(tl)
this.loadEnv(env)
this.loadDefaults(env)

if (this.scanTimeout !== undefined) {
if (this.scanDiffTimeout === undefined) {
this.scanDiffTimeout = this.scanTimeout
this.scanTimeout = undefined
}
}
}

public asBoostEnv(): Record<string, string> {
Expand Down Expand Up @@ -107,6 +118,8 @@ export class BoostParams extends BoostParamsVars {
this.scannerId = tl.getInput("scannerId")
this.scanPath = tl.getInput("scanPath")
this.scanTimeout = tl.getInput("scanTimeout")
this.scanDiffTimeout = tl.getInput("scanDiffTimeout")
this.scanMainTimeout = tl.getInput("scanMainTimeout")
this.workingDirectory = tl.getInput("workingDirectory")
}

Expand Down
2 changes: 2 additions & 0 deletions source/tests/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ describe("BoostParams", () => {
["BOOST_SCANNER_ID", "scannerId"],
["BOOST_SCAN_PATH", "scanPath"],
["BOOST_DIFF_SCAN_TIMEOUT", "scanTimeout"],
["BOOST_DIFF_SCAN_TIMEOUT", "scanDiffTimeout"],
["BOOST_MAIN_SCAN_TIMEOUT", "scanMainTimeout"],
["BOOST_WORKING_DIRECTORY", "workingDirectory"],
]

Expand Down
Loading