Update docker/trivy/start.sh
This commit is contained in:
parent
8e30076fc7
commit
92acccbb08
|
@ -7,10 +7,10 @@ LOW_PRIORITY=${LOW_PRIORITY:-true}
|
||||||
|
|
||||||
compare_scans() {
|
compare_scans() {
|
||||||
echo "Comparing scans..."
|
echo "Comparing scans..."
|
||||||
PREVIOUS_LOG="/var/log/trivy/previous_scan.log"
|
PREVIOUS_LOG="/log/previous_scan.log"
|
||||||
CURRENT_LOG="/var/log/trivy/trivy_scan.log"
|
CURRENT_LOG="/log/trivy_scan.log"
|
||||||
SCAN_DATE=$(date +%Y.%m.%d)
|
SCAN_DATE=$(date +%Y.%m.%d)
|
||||||
DIFF_LOG="/var/log/trivy/scandiff.$SCAN_DATE.log"
|
DIFF_LOG="/log/scandiff.$SCAN_DATE.log"
|
||||||
|
|
||||||
if [ -f "$PREVIOUS_LOG" ]; then
|
if [ -f "$PREVIOUS_LOG" ]; then
|
||||||
echo "Previous scan log found. Comparing with current scan..."
|
echo "Previous scan log found. Comparing with current scan..."
|
||||||
|
@ -35,7 +35,7 @@ compare_scans() {
|
||||||
|
|
||||||
report_scan_results() {
|
report_scan_results() {
|
||||||
is_diff=$1
|
is_diff=$1
|
||||||
DIFF_LOG="/var/log/trivy/scandiff.$(date +%Y.%m.%d).log"
|
DIFF_LOG="/log/scandiff.$(date +%Y.%m.%d).log"
|
||||||
|
|
||||||
if [ "$is_diff" = true ]; then
|
if [ "$is_diff" = true ]; then
|
||||||
echo "Scan differences detected:"
|
echo "Scan differences detected:"
|
||||||
|
@ -56,8 +56,8 @@ run_scan() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Archive existing log for comparison
|
# Archive existing log for comparison
|
||||||
if [ -f "/var/log/trivy/trivy_scan.log" ]; then
|
if [ -f "/log/trivy_scan.log" ]; then
|
||||||
mv /var/log/trivy/trivy_scan.log /var/log/trivy/previous_scan.log
|
mv /log/trivy_scan.log /log/previous_scan.log
|
||||||
fi
|
fi
|
||||||
|
|
||||||
run_scan
|
run_scan
|
||||||
|
|
Loading…
Reference in New Issue