From c067e89a0df973a3e25adfd03799f2bac515ed39 Mon Sep 17 00:00:00 2001 From: Jonathan Serafini Date: Tue, 17 Sep 2024 16:28:56 -0400 Subject: [PATCH 1/4] add main branch scan timeout --- README.md | 10 +++++++++- action.yaml | 9 ++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d239c30..dccd89d 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,15 @@ 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. -### `scan_timeout` (Optional, number) +### `scan_timeout` (Optional, number) deprecated The optional timeout after which the Github check will be marked as failed. This defaults to 120 seconds. +### `scan_diff_timeout` (Optional, number) + +The optional timeout on a diff scan after which the Github check will be marked as failed. This defaults to 120 seconds. + +### `scan_main_timeout` (Optional, number) + +The optional timeout on a main scan after which the Github check will be marked as failed. This defaults to 2 hours. + diff --git a/action.yaml b/action.yaml index 18b4eaa..b9e3fa9 100644 --- a/action.yaml +++ b/action.yaml @@ -45,6 +45,12 @@ inputs: scan_timeout: description: "Maximum amount of time a diff scan should complete in" default: "" + scan_diff_timeout: + description: "Maximum amount of time a diff scan should complete in" + default: "" + scan_main_timeout: + description: "Maximum amount of time a main scan should complete in" + default: "" runs: using: "composite" steps: @@ -59,7 +65,8 @@ runs: BOOST_GIT_MAIN_BRANCH: ${{ inputs.main_branch }} BOOST_IGNORE_FAILURE: ${{ inputs.ignore_failure }} BOOST_LOG_LEVEL: ${{ inputs.log_level }} - BOOST_DIFF_SCAN_TIMEOUT: ${{ inputs.scan_timeout }} + BOOST_DIFF_SCAN_TIMEOUT: ${{ inputs.scan_diff_timeout == "" && inputs.scan_timeout || inputs.scan_diff_timeout }} + BOOST_MAIN_SCAN_TIMEOUT: ${{ inputs.scan_main_timeout }} BOOST_PRE_SCAN: ${{ inputs.pre_scan_cmd }} BOOST_SCAN_LABEL: ${{ inputs.scan_label }} BOOST_SCAN_PATH: ${{ inputs.scan_path }} From ac76473d4b9a97ffc904aeee2bd1d52f725551ec Mon Sep 17 00:00:00 2001 From: Jonathan Serafini Date: Tue, 17 Sep 2024 16:34:48 -0400 Subject: [PATCH 2/4] test --- action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yaml b/action.yaml index b9e3fa9..02b3f1d 100644 --- a/action.yaml +++ b/action.yaml @@ -65,7 +65,7 @@ runs: BOOST_GIT_MAIN_BRANCH: ${{ inputs.main_branch }} BOOST_IGNORE_FAILURE: ${{ inputs.ignore_failure }} BOOST_LOG_LEVEL: ${{ inputs.log_level }} - BOOST_DIFF_SCAN_TIMEOUT: ${{ inputs.scan_diff_timeout == "" && inputs.scan_timeout || inputs.scan_diff_timeout }} + BOOST_DIFF_SCAN_TIMEOUT: ${{ (inputs.scan_diff_timeout == "") && inputs.scan_timeout || inputs.scan_diff_timeout }} BOOST_MAIN_SCAN_TIMEOUT: ${{ inputs.scan_main_timeout }} BOOST_PRE_SCAN: ${{ inputs.pre_scan_cmd }} BOOST_SCAN_LABEL: ${{ inputs.scan_label }} From 529f76c6b9fde948c2e4d26372bf36d876ffd65f Mon Sep 17 00:00:00 2001 From: Jonathan Serafini Date: Tue, 17 Sep 2024 16:40:06 -0400 Subject: [PATCH 3/4] test --- action.yaml | 5 +++-- lib/scan.sh | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/action.yaml b/action.yaml index 02b3f1d..73d2488 100644 --- a/action.yaml +++ b/action.yaml @@ -43,7 +43,7 @@ inputs: description: "Optional relative path to scan" default: "" scan_timeout: - description: "Maximum amount of time a diff scan should complete in" + description: "Maximum amount of time a diff scan should complete in (deprecated)" default: "" scan_diff_timeout: description: "Maximum amount of time a diff scan should complete in" @@ -65,7 +65,8 @@ runs: BOOST_GIT_MAIN_BRANCH: ${{ inputs.main_branch }} BOOST_IGNORE_FAILURE: ${{ inputs.ignore_failure }} BOOST_LOG_LEVEL: ${{ inputs.log_level }} - BOOST_DIFF_SCAN_TIMEOUT: ${{ (inputs.scan_diff_timeout == "") && inputs.scan_timeout || inputs.scan_diff_timeout }} + BOOST_SCAN_TIMEOUT: ${{ scan_timeout }} + BOOST_DIFF_SCAN_TIMEOUT: ${{ inputs.scan_diff_timeout }} BOOST_MAIN_SCAN_TIMEOUT: ${{ inputs.scan_main_timeout }} BOOST_PRE_SCAN: ${{ inputs.pre_scan_cmd }} BOOST_SCAN_LABEL: ${{ inputs.scan_label }} diff --git a/lib/scan.sh b/lib/scan.sh index 0e0090e..c12db0e 100755 --- a/lib/scan.sh +++ b/lib/scan.sh @@ -20,6 +20,8 @@ init.config () { log.info "initializing configuration" + export BOOST_DIFF_SCAN_TIMEOUT=${BOOST_DIFF_SCAN_TIMEOUT:-${BOOST_SCAN_TIMEOUT:-}} + export BOOST_TMP_DIR=${BOOST_TMP_DIR:-${WORKSPACE_TMP:-${TMPDIR:-/tmp}}} export BOOST_EXE=${BOOST_EXE:-${BOOST_TMP_DIR}/boost-cli/latest} From 3deede024a050b2bb32e7fcbf1855493b5bf5ed9 Mon Sep 17 00:00:00 2001 From: Jonathan Serafini Date: Tue, 17 Sep 2024 16:43:18 -0400 Subject: [PATCH 4/4] fix --- action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yaml b/action.yaml index 73d2488..cff1f03 100644 --- a/action.yaml +++ b/action.yaml @@ -65,7 +65,7 @@ runs: BOOST_GIT_MAIN_BRANCH: ${{ inputs.main_branch }} BOOST_IGNORE_FAILURE: ${{ inputs.ignore_failure }} BOOST_LOG_LEVEL: ${{ inputs.log_level }} - BOOST_SCAN_TIMEOUT: ${{ scan_timeout }} + BOOST_SCAN_TIMEOUT: ${{ inputs.scan_timeout }} BOOST_DIFF_SCAN_TIMEOUT: ${{ inputs.scan_diff_timeout }} BOOST_MAIN_SCAN_TIMEOUT: ${{ inputs.scan_main_timeout }} BOOST_PRE_SCAN: ${{ inputs.pre_scan_cmd }}