From 8f4c7160b470bafe4299efdc1c8a1fb495f8325a Mon Sep 17 00:00:00 2001 From: Masayoshi Mizutani Date: Fri, 17 Dec 2021 01:31:49 +0900 Subject: [PATCH] feat: Add list-all-pkgs option (#88) --- README.md | 1 + action.yaml | 5 +++++ entrypoint.sh | 10 +++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ab6ccc4..3452f92 100644 --- a/README.md +++ b/README.md @@ -401,6 +401,7 @@ Following inputs can be used as `step.with` keys: | `cache-dir` | String | | Cache directory | | `timeout` | String | `2m0s` | Scan timeout duration | | `ignore-policy` | String | | Filter vulnerabilities with OPA rego language | +| `list-all-pkgs` | String | | Output all packages regardless of vulnerability | [release]: https://github.com/aquasecurity/trivy-action/releases/latest [release-img]: https://img.shields.io/github/release/aquasecurity/trivy-action.svg?logo=github diff --git a/action.yaml b/action.yaml index 2e28e9e..403fb49 100644 --- a/action.yaml +++ b/action.yaml @@ -69,6 +69,10 @@ inputs: description: 'hide progress output' required: false default: 'true' + list-all-pkgs: + description: 'output all packages regardless of vulnerability' + required: false + default: 'false' runs: using: 'docker' image: "Dockerfile" @@ -90,3 +94,4 @@ runs: - '-o ${{ inputs.ignore-policy }}' - '-p ${{ inputs.hide-progress }}' - '-q ${{ inputs.skip-files }}' + - '-r ${{ inputs.list-all-pkgs }}' diff --git a/entrypoint.sh b/entrypoint.sh index fc5eb47..f551372 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:" o; do +while getopts "a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:" o; do case "${o}" in a) export scanType=${OPTARG} @@ -53,6 +53,9 @@ while getopts "a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:" o; do q) export skipFiles=${OPTARG} ;; + r) + export listAllPkgs=${OPTARG} + ;; esac done @@ -115,6 +118,11 @@ fi if [ "$hideProgress" == "true" ];then ARGS="$ARGS --no-progress" fi + +listAllPkgs=$(echo $listAllPkgs | tr -d '\r') +if [ "$listAllPkgs" == "true" ];then + ARGS="$ARGS --list-all-pkgs" +fi if [ "$skipFiles" ];then for i in $(echo $skipFiles | tr "," "\n") do