-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Install Trivy for vulnerability scanning unit-testing
- Loading branch information
Showing
3 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
# Copyright The Shipwright Contributors | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# | ||
# Installs "kubectl" | ||
# | ||
|
||
set -euo pipefail | ||
|
||
# Find a suitable install location | ||
for CANDIDATE in "$HOME/bin" "/usr/local/bin" "/usr/bin"; do | ||
if [[ -w $CANDIDATE ]] && grep -q "$CANDIDATE" <<<"$PATH"; then | ||
TARGET_DIR="$CANDIDATE" | ||
break | ||
fi | ||
done | ||
|
||
# Bail out in case no suitable location could be found | ||
if [[ -z ${TARGET_DIR:-} ]]; then | ||
echo -e "Unable to determine a writable install location. Make sure that you have write access to either \\033[1m/usr/local/bin\\033[0m or \\033[1m${HOME}/bin\\033[0m and that is in your PATH." | ||
exit 1 | ||
fi | ||
|
||
echo "# Install Trivy" | ||
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b "$TARGET_DIR" | ||
|
||
echo "# Trivy version" | ||
trivy --version |