diff --git a/README.md b/README.md index c1322dc..68a8edd 100644 --- a/README.md +++ b/README.md @@ -136,6 +136,7 @@ Following inputs can be used as `step.with` keys: | Name | Type | Default | Description | |------------------|---------|------------------------------------|-----------------------------------------------| | `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` | | `scan-ref` | String | `/github/workspace/` | Scan reference, e.g. `/github/workspace/` or `.`| | `format` | String | `table` | Output format (`table`, `json`, `template`) | diff --git a/action.yaml b/action.yaml index 56b13cc..fa49835 100644 --- a/action.yaml +++ b/action.yaml @@ -9,6 +9,10 @@ inputs: image-ref: description: 'image reference(for backward compatibility)' required: true + input: + description: 'reference of tar file to scan' + required: false + default: '' scan-ref: description: 'Scan reference' required: false @@ -60,3 +64,4 @@ runs: - '-i ${{ inputs.image-ref }}' - '-j ${{ inputs.scan-ref }}' - '-k ${{ inputs.skip-dirs }}' + - '-l ${{ inputs.input }}' diff --git a/entrypoint.sh b/entrypoint.sh index d243fc9..1f8090e 100644 --- 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:" o; do +while getopts "a:b:c:d:e:f:g:h:i:j:k:l:" o; do case "${o}" in a) export scanType=${OPTARG} @@ -35,6 +35,9 @@ while getopts "a:b:c:d:e:f:g:h:i:j:k:" o; do k) export skipDirs=${OPTARG} ;; + l) + export input=${OPTARG} + ;; esac done @@ -43,6 +46,10 @@ export artifactRef="${imageRef}" if [ "${scanType}" = "fs" ];then artifactRef=$(echo $scanRef | tr -d '\r') fi +input=$(echo $input | tr -d '\r') +if [ $input ]; then + artifactRef="--input $input" +fi ignoreUnfixed=$(echo $ignoreUnfixed | tr -d '\r') ARGS=""