chore(): Adds new attach scan report script
Some checks are pending
continuous-integration/drone/push Build is running
Some checks are pending
continuous-integration/drone/push Build is running
This commit is contained in:
parent
9ebf78caca
commit
ca43188adf
2 changed files with 32 additions and 1 deletions
31
scripts/attach-scan-report
Executable file
31
scripts/attach-scan-report
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -xe
|
||||
|
||||
TIMESTAMP=$(date "+%F %T %Z")
|
||||
|
||||
image="$@"
|
||||
printf "Set image to $image...\n"
|
||||
|
||||
extra_vars=""
|
||||
|
||||
if [ ! -z $REGISTRY_USERNAME ]; then
|
||||
printf "Found registry username...\n"
|
||||
extra_vars="$extra_vars --username $REGISTRY_USERNAME"
|
||||
fi
|
||||
|
||||
if [ ! -z $REGISTRY_PASSWORD ]; then
|
||||
printf "Found registry password\n"
|
||||
extra_vars="$extra_vars --password $REGISTRY_PASSWORD"
|
||||
fi
|
||||
|
||||
extra_vars="$extra_vars -a \"org.opencontainers.trivy.created=$TIMESTAMP\" -a \"org.opencontainers.trivy.status=Passed\" -a \"org.opencontainers.trivy.tag=${DRONE_COMMIT_SHA:0:8}\""
|
||||
|
||||
printf "Checking for result file...\n"
|
||||
if [ -e result.json ]; then
|
||||
printf "Result file found, attaching it to container...\n"
|
||||
oras attach $extra_vars --artifact-type=application/json $image "result.json"
|
||||
else
|
||||
printf "Result file not found !\n"
|
||||
exit 1
|
||||
fi
|
|
@ -21,7 +21,7 @@ fi
|
|||
|
||||
if [ ! -z REGISTRY_PASSWORD ]; then
|
||||
printf "Found registry password\n"
|
||||
extra_vars="$extra_vars --password $REGISTRY_PASSWORD "
|
||||
extra_vars="$extra_vars --password $REGISTRY_PASSWORD"
|
||||
fi
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue