diff --git a/README.md b/README.md index 648d08c..12ce2fb 100644 --- a/README.md +++ b/README.md @@ -540,6 +540,7 @@ Following inputs can be used as `step.with` keys: | `scan-type` | String | `image` | Scan type, e.g. `image` or `fs` | | `input` | String | | Tar reference, e.g. `alpine-latest.tar` | | `image-ref` | String | | Image reference, e.g. `alpine:3.10.2` | +| `server` | String | | server host, e.g. `https://scan.example.com` | | `scan-ref` | String | `/github/workspace/` | Scan reference, e.g. `/github/workspace/` or `.` | | `format` | String | `table` | Output format (`table`, `json`, `sarif`, `github`) | | `template` | String | | Output template (`@/contrib/gitlab.tpl`, `@/contrib/junit.tpl`) | diff --git a/action.yaml b/action.yaml index 02bcd34..eaeb9eb 100644 --- a/action.yaml +++ b/action.yaml @@ -91,6 +91,9 @@ inputs: tf-vars: description: "path to terraform tfvars file" required: false + server: + description: "server host" + required: false limit-severities-for-sarif: description: 'limit severities for SARIF format' required: false @@ -122,4 +125,5 @@ runs: - '-u ${{ inputs.github-pat }}' - '-v ${{ inputs.trivy-config }}' - '-x ${{ inputs.tf-vars }}' + - '-y ${{ inputs.server }}' - '-z ${{ inputs.limit-severities-for-sarif }}' diff --git a/entrypoint.sh b/entrypoint.sh index 0b6f46c..212cf3b 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,6 +1,6 @@ #!/bin/bash set -e -while getopts "a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:x:z:" o; do +while getopts "a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:x:y:z:" o; do case "${o}" in a) export scanType=${OPTARG} @@ -71,6 +71,9 @@ while getopts "a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:x:z:" o; do x) export tfVars=${OPTARG} ;; + y) + export server=${OPTARG} + ;; z) export limitSeveritiesForSARIF=${OPTARG} ;; @@ -137,7 +140,7 @@ if [ $skipDirs ];then fi if [ $tfVars ] && [ "$scanType" == "config" ];then ARGS="$ARGS --tf-vars $tfVars" -fi +fi if [ $trivyIgnores ];then for f in $(echo $trivyIgnores | tr "," "\n") @@ -162,14 +165,19 @@ if [ $ignorePolicy ];then SARIF_ARGS="$SARIF_ARGS --ignore-policy $ignorePolicy" fi if [ "$hideProgress" == "true" ];then - ARGS="$ARGS --quiet" - SARIF_ARGS="$SARIF_ARGS --quiet" + ARGS="$ARGS --no-progress" + SARIF_ARGS="$SARIF_ARGS --no-progress" fi listAllPkgs=$(echo $listAllPkgs | tr -d '\r') if [ "$listAllPkgs" == "true" ];then ARGS="$ARGS --list-all-pkgs" fi + +if [ $server ] ;then + ARGS="$ARGS --server $server" +fi + if [ "$skipFiles" ];then for i in $(echo $skipFiles | tr "," "\n") do