Fix: Allow SNYK scanner to take additional options 21/71321/1
authorJessica Wagantall <jwagantall@linuxfoundation.org>
Mon, 6 Mar 2023 21:30:43 +0000 (13:30 -0800)
committerJessica Wagantall <jwagantall@linuxfoundation.org>
Mon, 6 Mar 2023 21:30:43 +0000 (13:30 -0800)
Add SNYK_CLI_OPTIONS parameter which can be used to pass additional Snyk
CLI options as per https://docs.snyk.io/snyk-cli/cli-reference.

Signed-off-by: Jessica Wagantall <jwagantall@linuxfoundation.org>
Change-Id: I7fb8157a263d03f3780beb044e2e7c5093c2877b

docs/jjb/lf-maven-jobs.rst
jjb/lf-maven-jobs.yaml
releasenotes/notes/add-maven-snyk-cli-options-92c8508767f05a61.yaml [new file with mode: 0644]
shell/snyk-cli-scanner-run.sh

index be166c1..e9b7dde 100644 (file)
@@ -215,6 +215,7 @@ Builds the code, downloads and runs a Snyk CLI scan of the code into the Snyk da
     :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
     :mvn-params: Parameters to pass to the mvn CLI. (default: '')
     :mvn-version: Version of maven to use. (default: mvn35)
+    :snyk-cli-options: Additional Snyk CLI options. (default: '')
     :stream: Keyword that represents a release code-name.
         Often the same as the branch. (default: master)
     :submodule-recursive: Whether to checkout submodules recursively.
index 73a4744..84d31e8 100644 (file)
     mvn-opts: ""
     mvn-params: ""
     mvn-version: mvn35
+    snyk-cli-options: ""
     snyk-token-credential-id: snyk-token
     snyk-org-credential-id: snyk-org
     stream: master
           mvn-opts: "{mvn-opts}"
           mvn-params: "{mvn-params}"
           mvn-version: "{mvn-version}"
+      - string:
+          name: SNYK_CLI_OPTIONS
+          default: "{snyk-cli-options}"
+          description: Additional Snyk CLI commands and options
       - string:
           name: ARCHIVE_ARTIFACTS
           default: "{archive-artifacts}"
diff --git a/releasenotes/notes/add-maven-snyk-cli-options-92c8508767f05a61.yaml b/releasenotes/notes/add-maven-snyk-cli-options-92c8508767f05a61.yaml
new file mode 100644 (file)
index 0000000..28b797a
--- /dev/null
@@ -0,0 +1,5 @@
+---
+fixes:
+  - |
+    Add SNYK_CLI_OPTIONS parameter which can be used to pass additional Snyk
+    CLI options as per https://docs.snyk.io/snyk-cli/cli-reference.
index 63ba1cd..7e42784 100644 (file)
@@ -22,5 +22,5 @@ snyk --version
 echo "Authenticate with SNYK_TOKEN..."
 snyk auth "$SNYK_CLI"
 echo "Running Snyk CLI..."
-snyk test --json --severity-threshold=low --org="$SNYK_ORG"
-snyk monitor --severity-threshold=low --org="$SNYK_ORG"
+snyk test --json --severity-threshold=low "$SNYK_CLI_OPTIONS" --org="$SNYK_ORG"
+snyk monitor --severity-threshold=low "$SNYK_CLI_OPTIONS" --org="$SNYK_ORG"