Added input option support (#34)
* Added input option support * Fix position of input flag * update readme * Update README.md Co-authored-by: Simarpreet Singh <simar@linux.com>
This commit is contained in:
co-authored by
Simarpreet Singh
parent
6890ac5cba
commit
e2054f8b6a
@@ -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`) |
|
||||
|
||||
@@ -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 }}'
|
||||
|
||||
+8
-1
@@ -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=""
|
||||
|
||||
Reference in New Issue
Block a user