-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dev: add utility script to assist with development (#6)
Co-authored-by: Justin Burr <juburr@users.noreply.github.com>
- Loading branch information
Showing
1 changed file
with
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
# Convenience script, not used by directly by the production orb, but | ||
# for development purposes when adding SHA-512 checksums to the lookup | ||
# table in install.sh. | ||
|
||
set -e | ||
set +o history | ||
|
||
# Fetch CLI arguments | ||
# Can also be set as environment variables. | ||
while getopts :v: flag | ||
do | ||
case "${flag}" in | ||
v) VERSION=${OPTARG};; | ||
*) echo "Invalid option: -${OPTARG}" >&2; exit 1;; | ||
esac | ||
done | ||
|
||
# Validate input arguments | ||
if [[ -z "${VERSION}" ]]; then | ||
echo "Must specify a version number." | ||
echo "Usage: $0 -v 1.0.0" | ||
echo "Alternatively: VERSION=1.0.0 $0" | ||
exit 1 | ||
fi | ||
|
||
# Download the specified version and get the SHA-512 checksum of | ||
# the kubescape binary inside. Suppress output for readability; this is | ||
# dev script, so simply re-enable output if you need to debug anything. | ||
cd /tmp | ||
wget "https://github.com/kubescape/kubescape/releases/download/v${VERSION}/kubescape-ubuntu-latest" -O kubescape -q | ||
CHECKSUM=$(sha512sum /tmp/kubescape | awk '{ print $1 }') | ||
echo "[\"${VERSION}\"]=\"${CHECKSUM}\"" | ||
rm /tmp/kubescape |